|
From: Ian I. <ian...@k-...> - 2006-01-30 14:04:00
|
Hiya Tom.
The problem is that it's hard (not possible) for JZKit to tell the
difference between a legitimate close of the other end of the
association, and the remote association simply shutting down the socket.
Although it may properly be thought of as "Not being an exceptional
situation", we've not yet found a better model for the behaviour in
java. When we port to NIO then there are some cleaner solutions we can
adopt, but for now, the best I can do is to catch and deal with this
exception inside the endpoint, so you don't see it. I've made that
change and committed it to subversion, i'll make a patch release shortly
and let you know.
Ian.
On Wed, 2006-01-04 at 09:40 -0800, Tom Talbott wrote:
> Hello,
>
> I am in the process of porting an application over from using jzkit
> 1.2.4 to jzkit2 2.0.1. Most everything works, but I am getting a
> SocketException when I close down the Searchable object (in my case the
> Z3950Origin). I can reproduce the problem by adding "s.close();" as the
> last line of the testLOC() method of your Z3950Test.java test case.
>
> =============
> for ( int i=0; ( ( e.hasMoreElements() ) && ( i < 60 ) ); i++) {
> System.err.println("Processing result "+i);
> Object o = e.nextElement();
> System.err.println(o);
> }
>
> s.close();
> ==============
>
> The close is required to shutdown the search thread, unless I'm missing
> something. If I remove it like you have in your test case, then I get a
> bunch of threads lying around.
>
> Below is the log. It looks like a close is encoded and sent, but the
> socket is closed before the response can be read.
>
> Jan 4, 2006 9:29:46 AM org.jzkit.search.provider.z3950.Z3950Origin close
> FINE: Z3950Origin::close()
> Jan 4, 2006 9:29:46 AM org.jzkit.z3950.util.ZEndpoint shutdown
> FINE: ZEndpoint::shutdown() - host=z3950.loc.gov status=2 running=true
> Jan 4, 2006 9:29:46 AM org.jzkit.z3950.util.ZEndpoint encodeAndSend
> FINE: encodeAndSend...
> Jan 4, 2006 9:29:46 AM org.jzkit.z3950.util.ZEndpoint run
> SEVERE: problem
> java.net.SocketException: socket closed
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.read(SocketInputStream.java:129)
> at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
> at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
> at
> org.jzkit.a2j.codec.runtime.BERInputStream.read(BERInputStream.java:661)
> at
> org.jzkit.a2j.codec.runtime.BERInputStream.decodeNextTag(BERInputStream.java:155)
> at
> org.jzkit.a2j.codec.runtime.BERInputStream.tag_codec(BERInputStream.java:126)
> at
> org.jzkit.a2j.codec.runtime.BERInputStream.constructedBegin(BERInputStream.java:541)
> at
> org.jzkit.a2j.codec.runtime.BERInputStream.sequenceBegin(BERInputStream.java:525)
> at
> org.jzkit.z3950.gen.v3.Z39_50_APDU_1995.InitializeRequest_codec.serialize(InitializeRequest_codec.java:52)
> at
> org.jzkit.a2j.codec.runtime.BERInputStream.implicit_tag(BERInputStream.java:612)
> at
> org.jzkit.a2j.codec.runtime.BERInputStream.choice(BERInputStream.java:488)
> at
> org.jzkit.z3950.gen.v3.Z39_50_APDU_1995.PDU_codec.serialize(PDU_codec.java:65)
> at org.jzkit.z3950.util.ZEndpoint.run(ZEndpoint.java:666)
> Jan 4, 2006 9:29:46 AM org.jzkit.z3950.util.ZEndpoint run
> INFO: SocketException
> Jan 4, 2006 9:29:46 AM org.jzkit.z3950.util.ZEndpoint run
> INFO: java.net.SocketException: socket closed - hostname=z3950.loc.gov
> Jan 4, 2006 9:29:46 AM org.jzkit.z3950.util.ZEndpoint notifyAPDUEvent
> FINE: notifyAPDUEvent : 22
> Jan 4, 2006 9:29:46 AM org.jzkit.z3950.util.ZEndpoint notifyAPDUEvent
> FINE: Incoming PDU refid: null
> Jan 4, 2006 9:29:46 AM org.jzkit.z3950.util.ZEndpoint run
> FINE: End of ZEndpoint listening thread for host z3950.loc.gov active z
> thread counter=0
>
> Thanks for looking into this,
>
________________________________________________________________________
Ian Ibbotson, Director
Knowledge Integration Ltd
Sheffield Technology Parks
Cooper Buildings
Arundel Street
Sheffield
South Yorkshire
S1 2NS
email: ian...@k-...
Tel: 0114 221 0746
Fax: 0114 221 1801
http://www.k-int.com
|