read hang on datagram socket
Fredrik Lindberg
fli+freebsd-hackers at shapeshifter.se
Fri Jan 27 02:40:56 PST 2006
Kurt Miller wrote:
> On Thursday 26 January 2006 7:26 pm, Daniel Eischen wrote:
>
>>On Thu, 26 Jan 2006, Kurt Miller wrote:
>>
>>
>>>On Thursday 26 January 2006 6:56 pm, Daniel Eischen wrote:
>>>
>>>>On Thu, 26 Jan 2006, Kurt Miller wrote:
>>>>
>>>>
>>>>>I'm working on 1.5 jdk certification on 5.4 and 6.0. One of the jck
>>>>>tests hangs on 5.4 but works ok on 6.0. I've reduced the problem
>>>>>down to the following C program that hangs on 5.4 but works fine
>>>>>(finishes) on 6.0 and 4.11.
>>>>>
>>>>>I could use some assistance with finding a work-around to the
>>>>>problem or an explanation as to why the program hangs on 5.4.
>>>>
>>>>It exit'd in the last connect() in Solaris 9. I modified it
>>>>to work -- see below.
>>>
>>>Thanks, that was my bug (the jdk did it right). It Sill hangs on 5.4
>>>though.
>>
>>The modified version does not hang on 5.2. Do you have multiple
>>interfaces on your 5.4 box?
>
>
> No, the 5.4 box is virtually identical to the 6.0 box. I set them both
> up at the same time from initial installs for the project.
>
> truk at freebsd5-4$ ifconfig
> lnc0: flags=108843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> inet6 fe80::250:56ff:fe40:451a%lnc0 prefixlen 64 scopeid 0x1
> inet 172.16.1.36 netmask 0xffffff00 broadcast 172.16.1.255
> ether 00:50:56:40:45:1a
> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
> inet 127.0.0.1 netmask 0xff000000
> inet6 ::1 prefixlen 128
> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
>
> truk at freebsd6-0$ ifconfig
> lnc0: flags=108843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500
> inet6 fe80::250:56ff:fe40:4533%lnc0 prefixlen 64 scopeid 0x1
> inet 172.16.1.37 netmask 0xffffff00 broadcast 172.16.1.255
> ether 00:50:56:40:45:33
> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
> inet6 ::1 prefixlen 128
> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
> inet 127.0.0.1 netmask 0xff000000
>
>
>>What happens when you try using non-zero IP addresses and ports?
>>
>
>
> Setting the ports doesn't effect the problem, however setting the
> addresses does. It really seems like binding to INADDR_ANY only binds
> to loopback address 127.0.0.1 and not all the interfaces.
>
> If sock1 is bound to the hostAddress and sock2 connects to sock1 at
> the hostAddress it works ok. If sock1 is bound to INADDR_ANY and sock2
> connects to sock1 using INADDR_ANY it works. but any mixture of of
> using INADDR_ANY with the hostAddress fails.
>
> Unfortunately, I don't have control over the addresses, the java
> programs do. This particular jck test binds the first socket with
> INADDR_ANY (InetAddress.getByName("0.0.0.0")) and connects the second
> socket to the first using the hostAddress (InetAddress.getLocalHost()).
>
> netstat output when stopping the program at the sendto call on 5.4
> looks like this:
> udp4 0 0 localhost.55513 172.16.1.36.52099
>
> on 6.0:
> udp4 0 0 172.16.1.37.53952 172.16.1.37.62241
>
> Doesn't the above output indicate a problem with how datagram
> sockets are bound to INADDR_ANY?
>
> Perhaps its related to my configuration. Can anyone else with a
> 5.4-release system try the program to see if it works for them?
>
It works on a 5.4-RELEASE-p5 system.
fli> ./test
no hang
fli> ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_MTU>
inet 212.XX.XX.XX netmask 0xfffffff8 broadcast 212.XX.XX.XX
inet6 fe80::240:d0ff:fe43:b964%em0 prefixlen 64 scopeid 0x1
ether 00:40:d0:43:b9:64
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
em1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_MTU>
ether 00:40:d0:43:b9:65
media: Ethernet autoselect
status: no carrier
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
Stopping it before sendto() gives
udp4 0 0 212.XX.XX.XX.54074 212.XX.XX.XX.56604
Fredrik Lindberg
More information about the freebsd-hackers
mailing list