[BUG] Socket assumes connection in Linux

Patrik Nordebo patrik at nordebo.com
Fri Mar 30 21:19:04 UTC 2001


On Thu, Mar 29, 2001 at 10:11:25AM -0500, ajh18 at cornell.edu wrote:
> Patrik, thanks for looking at this socket problem.  If you have a chance
> please look at the socket semaphore corruption problem also.  I posted a
> bug report about this on March 26 and its entitled "[BUG] Socket
> semaphore corrupted (Unix VM)".  I wish I could help but I am not
> familiar with platform specifics.  Smalltalk has happily sheltered me
> from those details for many years.

This problem appears to be a VM problem, because AFAICT, the Unix
socket implementation never signals the semaphore, but it still
remains at 1.

BTW, Squeak is constantly segfaulting for me if I quit it after having
opened a socket. It seems to me that this should be happening to
everyone running Squeak on Linux/Unix, but I haven't seen anyone
mention it. I missed it while I was writing my fix because I was tired
and I wasn't looking for it.

This happens because when the asynchronous I/O system shuts down it
first sets the pointer to the private socket structure to 0, then
tries to close the socket in the private socket structure. This should
never ever work. Reversing the order of these two operations appears to
cure the problem.

Patch:
--- sqUnixSocket_orig.c Wed Mar 28 05:58:18 2001
+++ sqUnixSocket.c      Sat Mar 31 07:20:39 2001
@@ -502,8 +502,8 @@
   for (i= 0; i < lastSocket+1; i++)
     if (sockets[i])
       {
-       aioDisable(sockets[i]);
        close(sockets[i]->s);
+       aioDisable(sockets[i]);
       }
 }






More information about the Squeak-dev mailing list