[BUG]Socket waits unnecessarily in linux

ajh18 at cornell.edu ajh18 at cornell.edu
Fri Mar 23 16:01:24 UTC 2001


When doing two-way communication and even though my socket
primitiveOnlySupportsOneSemaphore = false, my socket sometimes get stuck
waiting for data even though there is data to be read.  To recreate the
problem bring up two images side-by-side with Transcripts and do the
following:

Image1> s1 _ Socket new listenOn: 2001.
Image2> s2 _ Socket new connectTo: (NetNameResolver addressFromString:
'127.0.0.1') port: 2001.
Image1> [[true] whileTrue: [
		(s1 waitForDataUntil: Socket standardDeadline)
			ifTrue: [Transcript show: s1 getData]
			ifFalse: [Transcript show: 'waiting...']]] fork.
Image2> [[true] whileTrue: [
		(s2 waitForDataUntil: Socket standardDeadline)
			ifTrue: [Transcript show: s2 getData]
			ifFalse: [Transcript show: 'waiting...']]] fork.
Image1> s1 sendData: 'hello '.
Image2> s2 sendData: 'hello '.

Repeat the last two lines several times, one after the other, and
observe the hello message showing up in the other image.  Before I do it
about 15 times one or both of the messages get stuck.  They finally show
up but only after many seconds goes by.

Also, I noticed the excessSignals of the writeSemaphore of each Socket
is always growing by about a 1000 per second while the wait-for-data
loop is running.

If I just do onw-way communication I don't get this problem.

Also, even while just waiting in the wait-for-data loop and receiving no
data Squeak is taking up about 70% of my CPU.

I'm using an updated 3.1 image and VM although I did regenerate the
interpreter from the the image after update 3776 and recompiled the VM.

Image version: Squeak3.1alpha of 27 February 2001
latest update: #3848
VM version: Squeak3.1alpha of 27 February 2001 [latest update: #3776]
for: unix

Anyone else getting this problem?

Thanks,
Anthony





More information about the Squeak-dev mailing list