ValleyCamp / AllStarHelper

Provides voice data for an AllStarLink node
GNU General Public License v3.0
2 stars 0 forks source link

net/http Get i/o timeout #5

Open ldaponte opened 8 years ago

ldaponte commented 8 years ago

I think the timeout is happening while Get looks up the IP address - substituting the fqdn with the IP address resolves this issue. I confirmed I can lookup names without error. Setting the client timeout to 30 seconds did not help using the code:

    timeout := time.Duration(30 * time.Second)
    client := http.Client{
            Timeout: timeout,
    }

    resp, err := client.Get(fmt.Sprintf("%s%d", gaugeUrl, gauge.Id))

larry@Server1:~/sources/AllStarHelper$ ./allstarhelper -verbose INFO: 2015/12/17 Starting run at 2015-12-17 23:25:55 CRITICAL: 2015/12/17 Station KWANORTH35 threw errror fetching station data. Error was: Get http://api.wunderground.com/api/xxxx/conditions/q/pws:KWANORTH35.json: dial tcp: lookup api.wunderground.com on 10.0.1.11:53: read udp 10.0.1.251:40696->10.0.1.11:53: i/o timeout CRITICAL: 2015/12/17 Error fetching data for gauge 12143400 . Error was: Get http://waterdata.usgs.gov/wa/nwis/uv?cb_all_00060_00065=on&cb_00060=on&cb_00065=on&format=rdb&period=1&site_no=12143400: dial tcp: lookup waterdata.usgs.gov on 10.0.1.11:53: read udp 10.0.1.251:33337->10.0.1.11:53: i/o timeout INFO: 2015/12/17 Done creating all files, exiting at 2015-12-17 23:26:05

ldaponte commented 8 years ago

Forcing cgo resolver fixed the dns timeout issue

export GODEBUG=netdns=cgo

or

go build -tags netcgo *.go