issue gethostbyname in rtems

Xiangfu Liu xiangfu at sharism.cc
Sun Jun 19 15:19:29 UTC 2011


Hi

I try to debug the TIMEOUT issue about libcurl in rtems, I setup this:
        curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1);
        curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
        curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 15);

we found when un-plug the network cable the TIMEOUT will not working
(sometimes even with network connected)

I have track down the issue is the 'gethostbyname', the TIMEOUT not include the 'gethostbyname'
and the libcurl CONNECTTIMEOUT not working on 'gethostbyname'.

the error log is like[1], the 'Querying server (# 1)....' needs 2~4 Minutes to finish. 

the correct log is like[2], both enable the cpukit/libnetworking DEBUG and libcurl VERBOSE

what I should to do? how can I make the TIMEOUT count on 'gethostbyname'? or how can I make the 
'gethostbyname' not take 2~4 minutes to look up the DNS?

thanks for advance.

BTW: is the /etc/hosts and /etc/resolv.conf will help? I saw the wiki pages says having those file 
is better, not sure if it will help is our case. we don't have such files in our file system.

[1]---------------------
xxxxxxxx
;; res_querydomain(downloads.qi-hardware.com, <Nil>, 1, 1)
;; res_query(downloads.qi-hardware.com, 1, 1)
;; res_mkquery(0, downloads.qi-hardware.com, 1, 1)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60636
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;;      downloads.qi-hardware.com, type = A, class = IN
;; Querying server (# 1) address = 8.8.8.8
res_send: recvfrom: No more processes
;; Querying server (# 1) address = 8.8.8.8
res_send: recvfrom: No more processes
;; Querying server (# 1) address = 8.8.8.8
res_send: recvfrom: No more processes
;; Querying server (# 1) address = 8.8.8.8
res_send: recvfrom: No more processes
;; res_query: send error
;; res_querydomain(downloads.qi-hardware.com, local, 1, 1)
;; res_query(downloads.qi-hardware.com.local, 1, 1)
;; res_mkquery(0, downloads.qi-hardware.com.local, 1, 1)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60637
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;;      downloads.qi-hardware.com.local, type = A, class = IN
;; Querying server (# 1) address = 8.8.8.8
res_send: recvfrom: No more processes
;; Querying server (# 1) address = 8.8.8.8
res_send: recvfrom: No more processes
;; Querying server (# 1) address = 8.8.8.8
res_send: recvfrom: No more processes
;; Querying server (# 1) address = 8.8.8.8
res_send: recvfrom: No more processes
;; res_query: send error
res_search failed (-1)
* Curl_ipv4_resolve_r failed for downloads.qi-hardware.com
* Couldn't resolve host 'downloads.qi-hardware.com'
* Closing connection #0
* Couldn't resolve host name
xxxxxxxx  done


[2]---------------------
xxxxxxxx
;; res_querydomain(downloads.qi-hardware.com, <Nil>, 1, 1)
;; res_query(downloads.qi-hardware.com, 1, 1)
;; res_mkquery(0, downloads.qi-hardware.com, 1, 1)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60635
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;;      downloads.qi-hardware.com, type = A, class = IN
;; Querying server (# 1) address = 8.8.8.8
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60635
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;;      downloads.qi-hardware.com, type = A, class = IN
downloads.qi-hardware.com.  12m4s IN CNAME  turandot.qi-hardware.com.
turandot.qi-hardware.com.  12m4s IN A  88.198.75.224
* About to connect() to downloads.qi-hardware.com port 80 (#0)
*   Trying 88.198.75.224... * connected
* Connected to downloads.qi-hardware.com (88.198.75.224) port 80 (#0)
> GET /people/xiangfu/tmp/README HTTP/1.1
User-Agent: flickernoise/1.0RC1
Host: downloads.qi-hardware.com
Accept: */*

< HTTP/1.1 200 OK
< Date: Sun, 19 Jun 2011 15:04:40 GMT
< Server: Apache/2.2.9 (Debian) DAV/2 SVN/1.5.1 PHP/5.3.2-1 with Suhosin-Patch
< Last-Modified: Tue, 22 Feb 2011 02:40:19 GMT
< ETag: "18c123-53-49cd5e6ae6ac0"
< Accept-Ranges: bytes
< Content-Length: 83
< Content-Type: text/plain
< 
* Failed writing body (0 != 83)
* Closing connection #0
* Failed writing received data to disk/application
xxxxxxxx  done



More information about the users mailing list