[Linux][VM][3.2-5] Socket problem 'dataHandler: selected socket would block (why?)'

Stephan Rudlof sr at evolgo.de
Wed Oct 23 20:00:50 UTC 2002


Dear All,

I have a difficult socket problem with a client/server app: two Squeak
instances are communicating over a bidirectional socket, which is used
permanently.
For each instance there is
- a reader process polling and waiting for incoming data from, and
- a writer process, which sends data to
the other instance.
Reader and sender processes are communicating with user processes via a
SharedQueue. The reader process has higher priority as the writer process.

After searching the bug for a long time in my own code, I think there may be
a problem in the socket code instead.


The error arises deeply in the system in
  Squeak-3.2-5/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c
after some time transferring data back and forth (hundreds to thousands
sends/receives in both directions) and results in an interrupted connection.

It seems to be that the implementor of the socket code wonders
himself/herself about the err msg (see log of 'First Squeak' below)
  'dataHandler: selected socket would block (why?)'
(just search for 'why' to find it in the C src).
After that the socket is
  a Socket[otherEndClosedButNotThisEnd]
in the first Squeak, but Linux
  netstat
doesn't support this view:

Proto Recv-Q Send-Q Local Address           Foreign Address         State
    PID/Program name
tcp        0      0 localhost:35373         localhost:nebraska
ESTABLISHED 11506/squeak
tcp        0      0 localhost:nebraska      localhost:35373
ESTABLISHED 11505/squeak

, and the second Squeak, too (there stays a Socket[connected]).

The inpredictability of the time of the error suggests some kind of timing
problem.


Has anybody seen this error?
Has anybody an idea how to hunt the bug further?

Any ideas are highly appreciated.

Greetings,

Stephan


>From the debug logs (#define DEBUG for sqUnixSocket.c)
------------------------------------------------------

First Squeak (the error is just before 'second Squeak'):
...
receiveDataAvailable(7) -> false [aioHandle is set]
socketStatus(7) -> 2
socketStatus(7) -> 2
TCP sendData(7, 79)
sendData(7) done = 79
socketStatus(7) -> 2
socketStatus(7) -> 2
socketStatus(7) -> 2
socketStatus(7) -> 2
receiveDataAvailable(7) -> false [aioHandle is set]
socketStatus(7) -> 2
socketStatus(7) -> 2
receiveDataAvailable(7) -> false [aioHandle is set]
dataHandler(7=7, 0x814ddd0, 2)
notify 7 read
socketStatus(7) -> 2
socketStatus(7) -> 2
receiveDataAvailable(7) -> true
socketStatus(7) -> 2
receiveDataAvailable(7) -> true
receiveData(7) done = 56
socketStatus(7) -> 2
receiveDataAvailable(7) -> false [aioHandle is set]
socketStatus(7) -> 2
socketStatus(7) -> 2
receiveDataAvailable(7) -> false [aioHandle is set]
socketStatus(7) -> 2
socketStatus(7) -> 2
TCP sendData(7, 79)
sendData(7) done = 79
socketStatus(7) -> 2
socketStatus(7) -> 2
socketStatus(7) -> 2
socketStatus(7) -> 2
receiveDataAvailable(7) -> false [aioHandle is set]
socketStatus(7) -> 2
socketStatus(7) -> 2
receiveDataAvailable(7) -> false [aioHandle is set]
dataHandler(7=7, 0x814ddd0, 2)
dataHandler: selected socket would block (why?)
notify 7 read
socketStatus(7) -> 3
socketStatus(7) -> 3
...

>From here the connection is interrupted.


Second Squeak for comparison (no error):
...
receiveDataAvailable(8) -> false [aioHandle is set]
dataHandler(8=8, 0x8147460, 2)
notify 8 read
socketStatus(8) -> 2
socketStatus(8) -> 2
receiveDataAvailable(8) -> true
socketStatus(8) -> 2
receiveDataAvailable(8) -> true
receiveData(8) done = 79
socketStatus(8) -> 2
receiveDataAvailable(8) -> false [aioHandle is set]
socketStatus(8) -> 2
socketStatus(8) -> 2
receiveDataAvailable(8) -> false [aioHandle is set]
socketStatus(8) -> 2
socketStatus(8) -> 2
TCP sendData(8, 56)
sendData(8) done = 56
socketStatus(8) -> 2
socketStatus(8) -> 2
socketStatus(8) -> 2
socketStatus(8) -> 2
receiveDataAvailable(8) -> false [aioHandle is set]
socketStatus(8) -> 2
socketStatus(8) -> 2
receiveDataAvailable(8) -> false [aioHandle is set]
dataHandler(8=8, 0x8147460, 2)
notify 8 read
socketStatus(8) -> 2
socketStatus(8) -> 2
receiveDataAvailable(8) -> true
socketStatus(8) -> 2
receiveDataAvailable(8) -> true
receiveData(8) done = 79
socketStatus(8) -> 2
receiveDataAvailable(8) -> false [aioHandle is set]
socketStatus(8) -> 2
socketStatus(8) -> 2
receiveDataAvailable(8) -> false [aioHandle is set]
socketStatus(8) -> 2
socketStatus(8) -> 2
TCP sendData(8, 56)
sendData(8) done = 56
socketStatus(8) -> 2
socketStatus(8) -> 2
receiveDataAvailable(8) -> false [aioHandle is set]
socketStatus(8) -> 2
socketStatus(8) -> 2
socketStatus(8) -> 2
socketStatus(8) -> 2
receiveDataAvailable(8) -> false [aioHandle is set]
socketStatus(8) -> 2
socketStatus(8) -> 2
receiveDataAvailable(8) -> false [aioHandle is set]
socketStatus(8) -> 2
...

-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3




More information about the Squeak-dev mailing list