db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kathey Marsden <kmars...@Sourcery.Org>
Subject Help detecting client disconnects for network server
Date Fri, 08 Oct 2004 23:41:09 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello

I am hoping there is a network programming expert out there who can
help me.	

I am working on an issue with Network Server where the server does not
clean up connection threads properly for disconnected clients.  I get an
 IOException if the client program is killed or aborted with <ctrl> c
but if the network cable is just unplugged or the machine turned off, we
don't detect the disconnect properly.


So, if I do this on the client machine

create table t (i int);
autocommit off;
lock table t in exclusive mode;

Then disconnect the cable, the server will continue to block on the
inputStream.read() and the connection will continue to hold the lock so
no one else can select from the table.


Reading a little about this it seems the only way to really detect if
the socket is active is to attempt a write. This of course is not an
option since it will mess up the drda protocol.  Other things I have
looked at are Socket.setSoTimeout, which seems no good because the
client might in fact just be sitting there doing nothing for a long time.

Any ideas?

Thanks

Kathey


Here's the trace where network server blocks.

"DRDAConnThread_3" prio=5 tid=0x0ADCD560 nid=0x7f8 runnable
[b7bf000..b7bfd88]
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at org.apache.derby.impl.drda.DDMReader.fill(DDMReader.java)
        at
org.apache.derby.impl.drda.DDMReader.ensureALayerDataInBuffer(DDMReader.java)
        at
org.apache.derby.impl.drda.DDMReader.readDssHeader(DDMReader.java)
        at
org.apache.derby.impl.drda.DRDAConnThread.processCommands(DRDAConnThread.java)
        at
org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java)








-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBZyWVG0h36bFmkocRAsySAKCg998gIH7bHqAUTx47aFNH+iBYZgCglThJ
XrlMH/9M+LLYgZKIFTD1e0M=
=Up2F
-----END PGP SIGNATURE-----

Mime
View raw message