From: Eli T. <he...@ne...> - 2003-03-14 18:00:36
|
Good news. I believe I solved the problem. =20 The exception was occurring while loading a new character set. It looks like two threads were concurrently trying to load the "US-ASCII" character set at the same time, thus causing some sort of issue in a method that didn't support concurrent thread use. =20 Perhaps this problem was occurring somewhere else higher up, because the J2SE JavaDocs state "All of the methods defined in this class [java.nio.charset.Charset] are safe for use by multiple concurrent threads." (http://java.sun.com/j2se/1.4/docs/api/java/nio/charset/Charset.html). Either that or there is a bug in the Linux version of the JDK. Anyway, I solved the problem by adding a static initializer at the beginning of one of my classes to preload used character sets upon startup. static { Charset c1 =3D Charset.forName("US-ASCII"); Charset c2 =3D Charset.forName("UTF-8"); Charset c3 =3D Charset.forName("ISO-8859-1"); } =20 This appears to have solved my problem. - Eli http://nerdmonkey.com -----Original Message----- From: jzj...@li... [mailto:jzj...@li...] On Behalf Of Eli Tucker Sent: Wednesday, March 12, 2003 11:05 AM To: ian...@k-... Cc: Jzj...@li... Subject: RE: [Jzjkit-user] Exception when connecting to multiple servers 1) No. I have not tried building JZKit (or running the jzkit unit tests) on the machine that is producing the errors. 2) I'm using j2sdk1.4.1_01. =20 If you look at the exception, the last place outside of the JVM code that we see is in the com.k_int.gen.AsnUseful.GeneralString_codec.serialize(Unknown Source) method. This appears to actually exist in the a2j toolkit, correct? =20 It looks like the JVM is trying to load another character set when the exception occurs. I'm wondering if perhaps this is a thread safety issue? Two threads are attempting to load the new character set at once, causing some sort of problem in methods that aren't thread safe? Do you have any advice as to where I should look to solve this problem? Would any other information about the problem be useful? Thanks, Eli -----Original Message----- From: Ian Ibbotson [mailto:ian...@k-...]=20 Sent: Wednesday, March 12, 2003 2:51 AM To: Eli Tucker Cc: Jzj...@li... Subject: Re: [Jzjkit-user] Exception when connecting to multiple servers Eeek... Well, two questions: 1) I don't suppose that this error is generated by the=20 AssocDestructionTest unit test? 2) What Java VM are you using? Cheers, Ian. Eli Tucker wrote: >Hello. > >I'm getting a NullPointerException intermittently when trying to use the >JZKit client to connect to a Z39.50 server. =20 > >What's interesting about this exception is that: > >1. It only occurs about 1 in every 5 executions. > >2. It seems to only appear on Linux machines, not on Windows machines. >(at least so far) > >3. It only seems to appear when the application is making connections >to multiple Z39.50 servers. When the application is only connecting to >one server, I am unable to reproduce the exception. > >I'm using the latest JZKit code from CVS. > >The exception is as follows: > >java.lang.NullPointerException > at java.util.TreeMap.rotateRight(TreeMap.java:1265) > at java.util.TreeMap.fixAfterInsertion(TreeMap.java:1298) > at java.util.TreeMap.put(TreeMap.java:477) > at >sun.nio.cs.AbstractCharsetProvider.lookup(AbstractCharsetProvider.java: 1 >02) > at >sun.nio.cs.AbstractCharsetProvider.charsetForName(AbstractCharsetProvid e >r.java:114) > at java.nio.charset.Charset.lookup(Charset.java:380) > at java.nio.charset.Charset.isSupported(Charset.java:405) > at java.lang.StringCoding.lookupCharset(StringCoding.java:80) > at java.lang.StringCoding.encode(StringCoding.java:361) > at java.lang.String.getBytes(String.java:591) > at com.k_int.gen.AsnUseful.GeneralString_codec.serialize(Unknown >Source) > at >com.k_int.gen.Z39_50_APDU_1995.InternationalString_codec.serialize(Inte r >nationalString_codec.java:31) > at com.k_int.codec.runtime.BEROutputStream.implicit_tag(Unknown >Source) > at >com.k_int.gen.Z39_50_APDU_1995.idPass_inline0_codec.serialize(idPass_in l >ine0_codec.java:41) > at com.k_int.codec.runtime.BEROutputStream.choice(Unknown Source) > at >com.k_int.gen.Z39_50_APDU_1995.IdAuthentication_codec.serialize(IdAuthe n >tication_codec.java:47) > at com.k_int.codec.runtime.BEROutputStream.explicit_tag(Unknown >Source) > at >com.k_int.gen.Z39_50_APDU_1995.InitializeRequest_codec.serialize(Initia l >izeRequest_codec.java:52) > at com.k_int.codec.runtime.BEROutputStream.choice(Unknown Source) > at >com.k_int.gen.Z39_50_APDU_1995.PDU_codec.serialize(PDU_codec.java:66) > at >com.k_int.z3950.util.ZEndpoint.internalEncodeAndSend(ZEndpoint.java:678 ) > at >com.k_int.z3950.util.ZEndpoint.encodeAndSend(ZEndpoint.java:623) > at >com.k_int.z3950.util.ZEndpoint.sendInitRequest(ZEndpoint.java:319) > at com.k_int.z3950.util.ZEndpoint.connect(ZEndpoint.java:932) > at com.k_int.z3950.util.ZEndpoint.connect(ZEndpoint.java:853) > at com.k_int.z3950.util.ZEndpoint.run(ZEndpoint.java:739) > >---------------------------------- > >I also have log output, but it doesn't seem that helpful. Here's a >snippet of the log -- let me know if the full log would be more helpful >to you. =20 > > [junit] 1158 [main] DEBUG Z3950Origin - Association is not yet >active, queue the search for later > [junit] 1158 [main] DEBUG Z3950Origin - Association is not yet >active, queue the search for later > [junit] 1159 [main] INFO Z3950Origin - Assoc is null.... Create >new association > [junit] 1159 [main] INFO Z3950Origin - Assoc is null.... Create >new association > [junit] 1165 [main] DEBUG Z3950Origin - Create association and >message adapter > [junit] 1165 [main] DEBUG Z3950Origin - Create association and >message adapter > [junit] 1166 [main] DEBUG Z3950Origin - Calling >ZEndpoint.start() > [junit] 1166 [main] DEBUG Z3950Origin - Calling >ZEndpoint.start() >1167 [Z3950 Search Thread fsz3950.someprovider.org] DEBUG ZEndpoint >- Bringing assoc up........Active Z Thread counter =3D 2 >1168 [Z3950 Search Thread fsz3950.someprovider.org] DEBUG ZEndpoint >- My thread priority : 5 >1168 [Z3950 Search Thread fsz3950.someprovider.org] DEBUG ZEndpoint >- My isDaemon: false >1168 [Z3950 Search Thread fsz3950.someprovider.org] DEBUG ZEndpoint >- Attempting to connect to fsz3950.someprovider.org:210 > [junit] 1168 [main] DEBUG Z3950Origin - timeout <=3D 0. > [junit] 1168 [main] DEBUG Z3950Origin - timeout <=3D 0. >1250 [Z3950 Search Thread z39.anotherprovider.com] DEBUG ZEndpoint - >Connect completed OK, send init request (nodelay=3Dfalse, timeout=3D0,=20 > >linger=3D-1) >1259 [Z3950 Search Thread z39.anotherprovider.com] DEBUG ZEndpoint - >Using idpass authentication : user:"********", group:"null",=20 > >pass:"*********" >1262 [Z3950 Search Thread fsz3950.someprovider.org] DEBUG ZEndpoint >- Connect completed OK, send init request (nodelay=3Dfalse, = timeout=3D0,=20 > >linger=3D-1) >1262 [Z3950 Search Thread fsz3950.someprovider.org] DEBUG ZEndpoint >- Using idpass authentication : user:"***********", group:"null",=20 > >pass:"**********" >1263 [Z3950 Search Thread fsz3950.someprovider.org] DEBUG ZEndpoint >- encodeAndSend... >1263 [Z3950 Search Thread z39.anotherprovider.com] DEBUG ZEndpoint - >encodeAndSend... >java.lang.NullPointerException >1276 [Z3950 Search Thread z39.anotherprovider.com] DEBUG ZEndpoint - >Sent init request >1277 [Z3950 Search Thread z39.anotherprovider.com] DEBUG ZEndpoint - >Connect completed OK, Listening for incoming PDUs >1277 [Z3950 Search Thread z39.anotherprovider.com] DEBUG ZEndpoint - >Waiting for data on input stream..... > at java.util.TreeMap.rotateLeft(TreeMap.java:1248) > at java.util.TreeMap.fixAfterInsertion(TreeMap.java:1293) > at java.util.TreeMap.put(TreeMap.java:477) > at >sun.nio.cs.AbstractCharsetProvider.lookup(AbstractCharsetProvider.java: 1 >02) > at >sun.nio.cs.AbstractCharsetProvider.charsetForName(AbstractCharsetProvid e >r.java:114) > at java.nio.charset.Charset.lookup(Charset.java:380) > at java.nio.charset.Charset.isSupported(Charset.java:405) > at java.lang.StringCoding.lookupCharset(StringCoding.java:80) > at java.lang.StringCoding.encode(StringCoding.java:361) > at java.lang.String.getBytes(String.java:591) > at com.k_int.gen.AsnUseful.GeneralString_codec.serialize(Unknown >Source) > at >com.k_int.gen.Z39_50_APDU_1995.InternationalString_codec.serialize(Inte r >nationalString_codec.java:31) > at com.k_int.codec.runtime.BEROutputStream.implicit_tag(Unknown >Source) > at >com.k_int.gen.Z39_50_APDU_1995.idPass_inline0_codec.serialize(idPass_in l >ine0_codec.java:41) > at com.k_int.codec.runtime.BEROutputStream.choice(Unknown Source) > at >com.k_int.gen.Z39_50_APDU_1995.IdAuthentication_codec.serialize(IdAuthe n >tication_codec.java:47) > at com.k_int.codec.runtime.BEROutputStream.explicit_tag(Unknown >Source) > at >com.k_int.gen.Z39_50_APDU_1995.InitializeRequest_codec.serialize(Initia l >izeRequest_codec.java:52) > at com.k_int.codec.runtime.BEROutputStream.choice(Unknown Source) > at >com.k_int.gen.Z39_50_APDU_1995.PDU_codec.serialize(PDU_codec.java:66) > at >com.k_int.z3950.util.ZEndpoint.internalEncodeAndSend(ZEndpoint.java:678 ) > at >com.k_int.z3950.util.ZEndpoint.encodeAndSend(ZEndpoint.java:623) > at >com.k_int.z3950.util.ZEndpoint.sendInitRequest(ZEndpoint.java:319) > at com.k_int.z3950.util.ZEndpoint.connect(ZEndpoint.java:932) > at com.k_int.z3950.util.ZEndpoint.connect(ZEndpoint.java:853) > at com.k_int.z3950.util.ZEndpoint.run(ZEndpoint.java:739) >2923 [Z3950 Search Thread z39.anotherprovider.com] DEBUG ZEndpoint - >Notifiy observers >2924 [Z3950 Search Thread z39.anotherprovider.com] DEBUG ZEndpoint - >notifyAPDUEvent >2924 [Z3950 Search Thread z39.anotherprovider.com] DEBUG ZEndpoint - >Incoming PDU refid: null >2926 [Z3950 Search Thread z39.anotherprovider.com] DEBUG Z3950Origin >- Processing init response from null >2926 [Z3950 Search Thread z39.anotherprovider.com] DEBUG Z3950Origin >- Processing init response from null >2927 [Z3950 Search Thread z39.anotherprovider.com] DEBUG Z3950Origin >- Incoming refid is NULL! >2927 [Z3950 Search Thread z39.anotherprovider.com] DEBUG Z3950Origin >- Incoming refid is NULL! >2927 [Z3950 Search Thread z39.anotherprovider.com] INFO Z3950Origin >- Implementation ID : 1996 >2927 [Z3950 Search Thread z39.anotherprovider.com] INFO Z3950Origin >- Implementation ID : 1996 >2928 [Z3950 Search Thread z39.anotherprovider.com] INFO Z3950Origin >- Implementation Name : Anotherprovider Information and Learning >2928 [Z3950 Search Thread z39.anotherprovider.com] INFO Z3950Origin >- Implementation Name : Anotherprovider Information and Learning >2928 [Z3950 Search Thread z39.anotherprovider.com] INFO Z3950Origin >- Implementation Version : 1.0 >2928 [Z3950 Search Thread z39.anotherprovider.com] INFO Z3950Origin >- Implementation Version : 1.0 >2929 [Z3950 Search Thread z39.anotherprovider.com] INFO Z3950Origin >- Target supports named result sets >2929 [Z3950 Search Thread z39.anotherprovider.com] INFO Z3950Origin >- Target supports named result sets >2929 [Z3950 Search Thread z39.anotherprovider.com] INFO Z3950Origin >- Target does not support concurrent operations >2929 [Z3950 Search Thread z39.anotherprovider.com] INFO Z3950Origin >- Target does not support concurrent operations > >----------------------------- > >Does anyone have any idea what could be going wrong? > >Thanks in advance, > > - Eli Tucker > >http://nerdmonkey.com > > > > > >------------------------------------------------------- >This SF.net email is sponsored by:Crypto Challenge is now open!=20 >Get cracking and register here for some mind boggling fun and=20 >the chance of winning an Apple iPod: >http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en >_______________________________________________ >Jzjkit-user mailing list >Jzj...@li... >https://lists.sourceforge.net/lists/listinfo/jzjkit-user > > > =20 > --=20 Ian Ibbotson (ian...@k-...) Knowledge Integration Ltd Sheffield Science & Technology Parks Cooper Buildings Arundel Street Sheffield S1 2NS http://www.k-int.com ------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open!=20 Get cracking and register here for some mind boggling fun and=20 the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en _______________________________________________ Jzjkit-user mailing list Jzj...@li... https://lists.sourceforge.net/lists/listinfo/jzjkit-user |