help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] TCP Server Socket issue


From: Holger Hans Peter Freyther
Subject: Re: [Help-smalltalk] TCP Server Socket issue
Date: Sun, 16 Jan 2011 23:34:28 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b2 Thunderbird/3.1.7

On 11/11/2010 03:32 PM, Paolo Bonzini wrote:
> On 11/07/2010 09:55 PM, Holger Hans Peter Freyther wrote:

>>
>> and this is silently on the GST shell when I CTRL+C and listen again. So the
>> old ServerSocket is still around when I create the new one.
> 
> Do you have a strace?  It should raise an exception:
> 
>     [(self
>         bind: fd
>         to: addr
>         addrLen: addr size) < 0 ifTrue: [File checkError: self soError]
>             ifCurtailed: [self close].

Hi,

it took me a bit. So below is the test case, the result in terms of netstat,
the output of strace. So the bind is failing but the socket has no SOL_ERROR
at all... instead we end up listening (didn't see that) on a socket that is
not properly configured.

>From a quick look at the socket/ipv4/ipv6 impl I don't see anyone assigning
sk_err to anything in case of a failed bind, so I am not sure where the
SO_ERROR != 0 on failed bind is coming from.



st> server1 := Sockets.ServerSocket port: 8080 bindTo: addr.
Sockets.ServerSocket[127.0.0.1:8080]
st> server2 := Sockets.ServerSocket port: 8080 bindTo: addr.
Sockets.ServerSocket[0.0.0.0:0]

on netstat this is looking like this:
tcp  0 0 0.0.0.0:59247 0.0.0.0:*  LISTEN      28233/gst
tcp  0 0 127.0.0.1:8080 0.0.0.0:* LISTEN      28233/gst

and on strace:
socket(PF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 6
rt_sigprocmask(SIG_BLOCK, ~[QUIT ILL ABRT BUS SEGV RTMIN RT_1], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
... too many of these...
setsockopt(6, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(6, {sa_family=AF_INET, sin_port=htons(8080),
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EADDRINUSE (Address already in use)

getsockopt(6, SOL_SOCKET, SO_ERROR, [0], [4]) = 0

getsockname(6, {sa_family=AF_INET, sin_port=htons(0),
sin_addr=inet_addr("0.0.0.0")}, [16]) = 0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]