[BUG] Socket semaphore corrupted (Unix VM)

Yanni Jew yanni at home.com
Mon Mar 26 20:48:16 UTC 2001


I don't think it's platform specific. I've seen comments on this mailing
list indicating that the socket code is "weak" (i.e. is not rock solid,
like any networking code should be). Alternative socket code
has been posted by some, and there's been some mention of re-working
the socket code by the VM maintainers.

I've encountered a similar problem to yours. The read call returns,
before the data has arrived, so the code is still looking at the
old buffer contents when processing. I did not have a problem going
from Linux to Linux, but only saw it when connecting WinNT to Linux.

My workaround was to put in a half-second delay in my buffer fill code,
which suits me fine for now. At some point, if the base distribution
doesn't get fixed, then I'll have to look at some of the posted
alternatives, or work on custom socket code (as others have done).

--yanni


ajh18 at cornell.edu wrote:
> 
> Socket>>waitForDataUntil: does not wait on the readSemaphore.  Rather,
> "readSemaphore waitForTimeoutMSecs:" falls through causing the outer
> while loop to continously run until the deadline is reached.  Needless
> to say, this takes up much of the CPU.  I do not get this problem with
> the Windows VM, only with the Unix VM (in Linux).  To recreate the
> problem bring up two images.  In Image2 bring up the Transcript and edit
> Socket>>waitForDataUntil: adding (Transcript show: 'waiting '.) as the
> first line in the whileTrue: loop.  Then execute the following.
> 
> Image1> Socket initializeNetwork.
> Image1> Socket new listenOn: 2001.
> 
> Image2> Socket initializeNetwork.
> Image2> s _ Socket new connectTo: (NetNameResolver addressFromString:
> '127.0.0.1') port: 2001.
> Image2> s waitForDataUntil: Socket standardDeadline.
> 
> You should see 'waiting waiting ...' streaming across your Transcript
> until the deadline is reached 45 seconds later.  I suspect this
> semaphore problem is also the cause of my first Socket bug report
> entitled "[BUG]Socket waits unnecessarily in linux" (March 23, 2001).
> 
> Image version: Squeak3.1alpha of 27 February 2001 latest update: #3848
> VM version (3.0pre2): Squeak3.0 of 4 February 2001 [latest update:
> #3446] for: unix
> 
> Since, this bug is platform specific it must be in the unix src.  I
> would try to fix it myself but I am no Unix expert.
> 
> Thanks,
> Anthony





More information about the Squeak-dev mailing list