Bug 1641563 - jwhois freeze on some requests
Summary: jwhois freeze on some requests
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: jwhois
Version: 28
Hardware: i686
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Vitezslav Crhonek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-10-22 08:33 UTC by Frantisek Hanzlik
Modified: 2019-03-15 03:34 UTC (History)
2 users (show)

Fixed In Version: jwhois-4.0-52.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-03-15 03:34:59 UTC
Type: Bug


Attachments (Terms of Use)
proposed patch (648 bytes, patch)
2019-02-20 09:05 UTC, Vitezslav Crhonek
no flags Details | Diff

Description Frantisek Hanzlik 2018-10-22 08:33:50 UTC
Description of problem:
jwhois not resolve some IPs and freeze on them.
E.g. this:

jwhois 204.45.103.35
[Querying whois.arin.net]
[Redirected to rwhois.fdcservers.net:4321]
[Querying rwhois.fdcservers.net]

and in this stay forever (I break it after several tens of minutes).

Version-Release number of selected component (if applicable):
jwhois-4.0-51.fc28.i686

Expected results:
When is impossible to resolve query, then program should terminate after some
(at best configurable) timeout.

Comment 1 Vitezslav Crhonek 2018-11-06 14:14:15 UTC
Unable to reproduce on f27.x86_64:

jwhois 204.45.103.35
[Querying whois.arin.net]
[Unable to connect to remote host]

There is a configurable timeout - see the tail of /etc/jwhois.conf configuration file. By default, the timeout is 75 seconds.

I'll try to get f28.i686 machine and test it there, but no change's been done between f27 and f28 in jwhois package.

Comment 2 Frantisek Hanzlik 2018-11-07 11:29:16 UTC
Hi,
Your output differs from mine - it seems as after WHOIS response from whois.arin.net your whois do not continue with RWHOIS request on rwhois.fdcservers.net:4321 - maybe You have blocked (SELinux, netfilter) TCP port 4321? Or, WHOIS response from whois.arin.net different IPs (has 3 IPv4 and 3 IPv6):
# host whois.arin.net
whois.arin.net has address 199.71.0.46
whois.arin.net has address 199.5.26.46
whois.arin.net has address 199.212.0.46
whois.arin.net has IPv6 address 2001:500:31::46
whois.arin.net has IPv6 address 2001:500:13::46
whois.arin.net has IPv6 address 2001:500:a9::46

 give different results?

Perhaps more tells this jwhois strace output:
# strace -o /var/tmp/jwhois.lst -s 400 -t jwhois 204.45.103.35
[Querying whois.arin.net]
[Redirected to rwhois.fdcservers.net:4321]
[Querying rwhois.fdcservers.net]
^C

# cat /var/tmp/jwhois.lst
...
04:32:33 socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
04:32:33 fcntl(3, F_GETFL)              = 0x2 (flags O_RDWR)
04:32:33 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
04:32:33 connect(3, {sa_family=AF_INET, sin_port=htons(43), sin_addr=inet_addr("199.71.0.46")}, 16) = -1 EINPROGRESS (Operation now in progress)
04:32:33 select(1024, NULL, [3], NULL, {tv_sec=75, tv_usec=0}) = 1 (out [3], left {tv_sec=74, tv_usec=807700})
04:32:34 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
04:32:34 write(3, "z + 204.45.103.35\r\n", 19) = 19
04:32:34 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
04:32:34 read(3, "\n#\n# ARIN WHOIS data and services are subject to the Terms of Use\n# available at: https://www.arin.net/whois_tou.html\n#\n# If you see inaccuracies in the results, please report at\n# https://www.arin.net/
resources/whois_reporting/index.html\n#\n# Copyright 1997-2018, American Registry for Internet Numbers, Ltd.\n#\n\n\n", 1023) = 313
04:32:34 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
04:32:34 read(3, "\n# start\n\nNetRange:       204.45.0.0 - 204.45.255.255\nCIDR:           204.45.0.0/16\nNetName:        FDCSERVERS\nNetHandle:      NET-204-45-0-0-1\nParent:         NET204 (NET-204-0-0-0-0)\nNetType:
 Direct Allocation\nOriginAS:       AS174, AS30058\nOrganization:   FDCservers.net (FDCSE)\nRegDate:        2009-07-20\nUpdated:        2018-10-12\nRef:            https://rdap.arin.net/registry/ip/204.45."..., 1023) = 1023
04:32:34 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
04:32:34 read(3, "hPhone:  +1-312-423-6675 \nOrgTechEmail:  abuse@fdcservers.net\nOrgTechRef:    https://rdap.arin.net/registry/entity/ABUSE438-ARIN\n\nOrgNOCHandle: ABUSE438-ARIN\nOrgNOCName:   ABUSE department\nOrgNOCPhone:
 +1-312-423-6675 \nOrgNOCEmail:  abuse@fdcservers.net\nOrgNOCRef:    https://rdap.arin.net/registry/entity/ABUSE438-ARIN\n\n# end\n\n\n# start\n\nNetRange:       204.45.0.0 - 204.45.25", 1023) = 377
04:32:34 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
04:32:34 read(3, "5.255\nCIDR:           204.45.0.0/16\nNetName:        FDCSERVERS-DENVER\nNetHandle:      NET-204-45-0-0-2\nParent:         FDCSERVERS (NET-204-45-0-0-1)\nNetType:        Reallocated\nOriginAS:       AS30058\n
Organization:   FDCservers.net (FDCSE-2)\nRegDate:        2012-03-28\nUpdated:        2012-03-28\nRef:            https://rdap.arin.net/registry/ip/204.45.0.0\n\n\nOrgName:        FDCservers.net\nOrgId:    "..., 1023) = 1023
04:32:34 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
04:32:34 read(3, "cservers.net\nOrgTechRef:    https://rdap.arin.net/registry/entity/ABUSE438-ARIN\n\nOrgNOCHandle: ABUSE438-ARIN\nOrgNOCName:   ABUSE department\nOrgNOCPhone:  +1-312-423-6675 \nOrgNOCEmail:  abuse@fdcservers.
net\nOrgNOCRef:    https://rdap.arin.net/registry/entity/ABUSE438-ARIN\n\n# end\n\n\n# start\n\nNetRange:       204.45.103.0 - 204.45.103.255\nCIDR:           204.45.103.0/24\nNetName: ", 1023) = 377
04:32:34 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
04:32:34 read(3, "       DEN1-204-45-103-0-24\nNetHandle:      NET-204-45-103-0-1\nParent:         FDCSERVERS-DENVER (NET-204-45-0-0-2)\nNetType:        Reallocated\nOriginAS:       AS174, AS30058\nOrganization:   Nexeon Techn
ologies, Inc. (NT-64)\nRegDate:        2016-02-22\nUpdated:        2016-03-23\nRef:            https://rdap.arin.net/registry/ip/204.45.103.0\n\n\nOrgName:        Nexeon Technologies, Inc.\nOrgId:        "..., 1023) = 1023
04:32:34 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
04:32:34 read(3, "sh Ln Ste 101\nComment:        Stafford, TX 77477\nComment:        United States\nRef:            https://rdap.arin.net/registry/entity/NT-64\n\n\nOrgNOCHandle: NETWO3628-ARIN\nOrgNOCName:   Network Operation
s\nOrgNOCPhone:  +1-877-639-3660 \nOrgNOCEmail:  noc@nexeontech.com\nOrgNOCRef:    https://rdap.arin.net/registry/entity/NETWO3628-ARIN\n\nOrgAbuseHandle: ABUSE2544-ARIN\nOrgAbuseName:   Abuse Department\nO"..., 1023) = 1023
04:32:34 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
04:32:34 read(3, "ble at: https://www.arin.net/whois_tou.html\n#\n# If you see inaccuracies in the results, please report at\n# https://www.arin.net/resources/whois_reporting/index.html\n#\n# Copyright 1997-2018, American Regi
stry for Internet Numbers, Ltd.\n#\n\n", 1023) = 238
04:32:34 select(4, [3], NULL, NULL, NULL) = 1 (in [3])
04:32:34 read(3, "", 1023)              = 0
04:32:34 brk(NULL)                      = 0x55605d28e000
04:32:34 brk(0x55605d2af000)            = 0x55605d2af000
04:32:34 write(1, "[Redirected to rwhois.fdcservers.net:4321]\n", 43) = 43
04:32:34 write(1, "[Querying rwhois.fdcservers.net]\n", 33) = 33
04:32:34 stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=114, ...}) = 0
04:32:34 openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_CLOEXEC) = 4
04:32:34 fstat(4, {st_mode=S_IFREG|0644, st_size=283, ...}) = 0
04:32:34 read(4, "127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4\n#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6\n90.178.49.32\tdsl.tezap.home wan.tezap.home dsl wan\n192.168.1.254\tven.tezap.home ven\n10.0.0.254\trolnicka.tezap.home rolnicka\n", 4096) = 283
04:32:34 read(4, "", 4096)              = 0
04:32:34 close(4)                       = 0
04:32:34 socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 4
04:32:34 connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
04:32:34 poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLOUT}])
04:32:34 sendmmsg(4, [{msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="d9\1\0\0\1\0\0\0\0\0\0\6rwhois\nfdcservers\3net\0\0\1\0\1", iov_len=39}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=39}, {msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="`K\1\0\0\1\0\0\0\0\0\0\6rwhois\nfdcservers\3net\0\0\34\0\1", iov_len=39}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=39}], 2, MSG_NOSIGNAL) = 2
04:32:34 poll([{fd=4, events=POLLIN}], 1, 5000) = 1 ([{fd=4, revents=POLLIN}])
04:32:34 ioctl(4, FIONREAD, [85])       = 0
04:32:34 recvfrom(4, "`K\201\200\0\1\0\0\0\1\0\0\6rwhois\nfdcservers\3net\0\0\34\0\1\300\23\0\6\0\1\0\0\5\n\0\"\3ns1\300\23\5abuse\300\23xH\264\333\0\0\16\20\0\0\2X\0$\352\0\0\0\16\20", 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [28->16]) = 85
04:32:34 poll([{fd=4, events=POLLIN}], 1, 4999) = 1 ([{fd=4, revents=POLLIN}])
04:32:34 ioctl(4, FIONREAD, [123])      = 0
04:32:34 recvfrom(4, "d9\201\200\0\1\0\1\0\2\0\2\6rwhois\nfdcservers\3net\0\0\1\0\1\300\f\0\1\0\1\0\0/:\0\0042\7\0_\300\23\0\2\0\1\0\0027\25\0\6\3ns2\300\23\300\23\0\2\0\1\0\0027\25\0\6\3ns1\300\23\300U\0\1\0\1\0\0027\25\0\0042\7\0p\300C\0\1\0\1\0\0027\25\0\0042\7\0l", 65536, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.1")}, [28->16]) = 123
04:32:34 close(4)                       = 0
04:32:34 socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
04:32:34 fcntl(4, F_GETFL)              = 0x2 (flags O_RDWR)
04:32:34 fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
04:32:34 connect(4, {sa_family=AF_INET, sin_port=htons(4321), sin_addr=inet_addr("50.7.0.95")}, 16) = -1 EINPROGRESS (Operation now in progress)
04:32:34 select(1024, NULL, [4], NULL, {tv_sec=75, tv_usec=0}) = 1 (out [4], left {tv_sec=74, tv_usec=855838})
04:32:34 getsockopt(4, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
04:32:34 write(4, "204.45.103.35\r\n", 15) = 15
04:32:34 select(5, [4], NULL, NULL, NULL) = 1 (in [4])
04:32:35 read(4, "%rwhois V-1.5:003fff:00 rwhois.fdcservers.net (by Network Solutions, Inc. V-1.5.9.6)\n", 1023) = 85
04:32:35 select(5, [4], NULL, NULL, NULL) = 1 (in [4])
04:32:35 read(4, "network:Auth-Area:204.45.0.0/16", 1023) = 31
04:32:35 select(5, [4], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be restarted if no handler)
06:01:54 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
06:01:54 +++ killed by SIGINT +++

I'm not programmer, but I see that select() call with timeout (75 sec) specif. is used only for it's first use after connect(), but in consequent select() calls is timeout unspecified (NULL) - and this may be reason for never ending operation (in this case I CTRL/C break jwhois after ~ 1.5 hours).

Comment 3 Vitezslav Crhonek 2018-11-07 11:58:05 UTC
Thanks for additional info. By the way, have you considered using 'whois' instead of 'jwhois'? The upstream development of whois is much more active compared to jwhois.

Comment 4 Vitezslav Crhonek 2019-02-20 08:50:49 UTC
Reproduced with IPv6 disabled.

Comment 5 Vitezslav Crhonek 2019-02-20 09:05:46 UTC
Created attachment 1536620 [details]
proposed patch

You're right, there's one select without timeout causing the freeze. Attached patch fixes the issue.

Comment 6 Fedora Update System 2019-02-21 13:49:39 UTC
jwhois-4.0-55.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-aacff1eb0a

Comment 7 Fedora Update System 2019-02-21 14:07:03 UTC
jwhois-4.0-52.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2019-068d063880

Comment 8 Fedora Update System 2019-02-22 01:35:32 UTC
jwhois-4.0-52.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-068d063880

Comment 9 Fedora Update System 2019-02-22 03:06:20 UTC
jwhois-4.0-55.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-aacff1eb0a

Comment 10 Fedora Update System 2019-02-23 02:07:20 UTC
jwhois-4.0-55.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2019-03-15 03:34:59 UTC
jwhois-4.0-52.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.