Hi Martin, > -----Original Message----- > From: Martin Holz [mailto:[EMAIL PROTECTED]] > Sent: 04 February 2002 16:36 > To: [EMAIL PROTECTED] > Subject: Re: NPE in URLSource under high load > > Hi, > > Chris Newland wrote: > > Hi All, > > > > I'm encountering a null pointer exception in the > > org.apache.cocoon.components.source.URLSource file when I run a > stress test > > of my Cocoon 2 system: > > > > java.lang.NullPointerException > > at > > > org.apache.cocoon.components.source.URLSource.getInfos(URLSource.java:95) > > at > > > org.apache.cocoon.components.source.URLSource.getLastModified(URLS > ource.jav > >a > > <snip> > > <snipped more>
<lots of snipping> > > If have noticed this from time to time too in Coccon 2.0 and 2.0.1. > Are you sure, the exception is in > this.connection.getContentLength() and not > one line before in this.connection.getLastModified() ? > I believe, this.url.openConnection() returns null instead of > throwing a IOException. Looks like a bug in the JDK. The error page (and the log file) are reporting the exception as coming from line 95. I've never known it to misreport the line number but nothing's impossible. Line 94: this.lastModificationDate = this.connection.getLastModified(); Line 95: this.contentLength = this.connection.getContentLength(); <------ NPE is thrown here Assuming the NPE does occur on line 95, I would have to assume that multiple threads are executing in this method and that the following situation occurs (I'm on very thin ice here ;) Thread A executes line 94 ... Thread B causes the value of 'this.connection' to be set to null ... Thread A calls getContentLength() on 'this.connection' which causes the NPE > > However I have a different JDK: > java version "1.3.0" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0) > Classic VM (build 1.3.0, J2RE 1.3.0 IBM build cx130-20000815 (JIT > enabled: > jitc)) > > Don't know how the IBM JDK is related to Sun's 1.3.1_02. > > Enviroment: SuSE 7.1,Linux 2.4.0-64GB-SMP, Dual Processor Intel, JDK see > above, Cocoon 2.01, Tomcat 4.0.1. I'm using a dual-proc Intel system too. I read an article on VMs a while back warning about the dangers of assuming that threading behaviour is the same between uniprocessor and multiprocessor systems. Perhaps this is a manifestation of this problem. > > Problem seems to happen more often with IE 5.5 than with Mozilla > 0.97, maybe > because IE is faster. Reloading the page always solves the problem. > > Maybe, Cocoon should catch not only the IOException, but also the NPE. I guess this would work but I don't think its a good idea if the real problem is in CocoonServlet. > > -- > Martin Holz <[EMAIL PROTECTED]> phone: 0049-30-39977 218 > FIZ CHEMIE BERLIN > Best Regards, Chris --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]