Will the real sqUnixSocket.c step forward?

John M McIntosh johnmci at smalltalkconsulting.com
Fri May 3 04:43:16 UTC 2002


>>Hopefully John, Ian and Lex can work through the current code and get it
>>working. And then we need to decide what to do with the Unix port at
>>SF. IMHO we
>>need to have Ian "with us" - let's just find a good "procedure" for this.
>>
>>regards, Göran
>>
>>Göran Hultgren, goran.hultgren at bluefish.se
>>GSM: +46 70 3933950, http://www.bluefish.se
>>\"Department of Redundancy department.\" -- ThinkGeek
>
>Well the fix exposed a problem with the code.
>
>Now correct me if I'm wrong, but I don't think CONN_NOTIFY flag is
>actually set anywhere?
>Thus you don't get the notification an incoming connection has occured.

Ha, so I've a few BSD boxes about so I went to compile this and noted 
that Ian's
patch of  3.1/src/unix/sqUnixSocket.c	Wed Apr 24 15:15:58 2002 
contains some of the missing CONN_NOTIFY. However I think we're 
missing one in sqSocketCloseConnection (maybe), and the server one in 
sqSocketAcceptFromRecvBytesSendBytesSemaID


but I was doing some more testing and found some interesting issues

in fact after lots of messing about I noted that
in sqSocketReceiveDataAvailable

after realizing socketReadable is false, we set
READ_NOTIFY true
and call aioHandle with AIO_RWX

which is read,write,exceptions

This then drives
things like so

aioEnable(12) socket 12
data available (no)
aioHandle(12, dataHandler,7) set_fd socket 12 for read/write/exceptions
aioSuspend(12)  suspend socket 12?

dataHandler(12,0xXXXXXXX,4) callback for socket 12

a long pause as the delay times out
then Data available (yes!)

It seems here in the dataHandler callback the flags value is 
indicated as AIO_WR which
*does that indicate write is ok?* However we never get a AIO_RD thus 
the read delay logic
comes into play and hammers the servers ability to respond. Do I get 
a AIO_WR because we can write to the socket, and the AIO_RD never 
gets triggered? Or which direction is reading and writting here?

Now if I change the logic to say I'm only interested in
AIO_RX (read and exception)

Then things are different.

but changing that results in different behavior and before I can 
really confirm things here what usually happens is I get a 53 on the 
accept(pss->s,0,0) in acceptHandler

and the listen logic goes dead...
Which seems to be an ongoing issue here on my freebsd boxes and the 
openbsd (68k) box too!

This 53 error would be nice to fix since I've seen it on the 3.0.pre2 
squeak vm in the BSD Ports collection, hence my desire to upgrade to 
3.1beta-4478 to solve the fact I lose internal swiki every other day 
or so because of the accept error.


-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================



More information about the Squeak-dev mailing list