Hi Mike, I had suspected as much. Luckily, we only used SimpleHttpConnectionManager for Mac Classic's (since they use Java 1.1.8, and it wasn't really worth it to alter MultiThreadedConnectionManager for a dwindling userbase). It wouldn't hurt to create a new connection manager for each client (and always create a new client), although I think we will have to subclass SimpleHttpConnectionManager to always close the connection when releaseConnection is called, as there'll be no other way (other than garbage collection) to now that the connection is not going to be used anymore.
Also, FYI -- it turns out that the other issue with / not being parsed properly (instead of \) was not actually the problem we were experiencing. I suspect that the code still bugs out if a / exists instead of a \ anyways, but what was actually happening was our bug-viewing system was inserting an extra \ before all %'s, causing us to think the error message was: "Invalid uri 'http://address:port\%2Furi-res\%2FN2R\%3Furn\%3Asha1\%3ASK7HTJYN4QFCHXTA3OCYWAWQZX6F5YTL" when it actually should have been: "Invalid uri 'http://address:port%2Furi-res%2FN2R%3Furn%3Asha1%3ASK7HTJYN4QFCHXTA3OCYWAWQZX6F5YTL" which is indeed an invalid uri (and was a problem with where we URL-encoded a value). Thanks, Sam -----Original Message----- From: Michael Becke [mailto:[EMAIL PROTECTED] Sent: Sunday, December 21, 2003 6:02 PM To: Commons HttpClient Project Subject: Re: NPE with threading and SimpleConnectionManager Hi Sam, The SimpleHttpConnectionManager is not meant to be used by more than one thread. Threading is not explicitly mentioned, though it is implied by the JavaDocs. From SimpleHttpConnectionManager: A connection manager that provides access to a single HttpConnection. This manager makes no attempt to provide exclusive access to the contained HttpConnection. I will add something more definitive to the docs. For multi-threaded apps you need either the MultiThreadedHttpConnectionManager or one HttpClient instance per thread. Mike On Dec 21, 2003, at 3:37 PM, Sam Berlin wrote: > Hi Folks, > > It seems that SimpleConnectionManager is unable to properly manage > sessions over multiple threads (in rc2, atleast). Is it even supposed > to? (I don't see anything in the docs that mentions yay or nay.) The > problem is that SimpleConnectionManager.getConnection() calls close on > the existing connection if it is open and HttpConnection throws an > IllegalStateException in various places if the connection is not open. > Thus, for example, one thread can enter write(byte[], int, int) and > another can then call close() on it, leaving the first thread to throw > an IllegalStateException when it resumes. > > I imagine that there is no real pressing desire to fix this, as > SimpleConnectionManager should be just that (simple). Perhaps the > documentation for SimpleConnectionManager should explicitly state that > it is not designed to be used across multiple threads? Should we > create a new SimpleConnectionManager (or, not provide one in the > constructor for HttpClient, leaving it to create its own) for each > client? The only problem with this that multiple requests won't reuse > the same connection. > > For the stracktrace, visit: > http://bugs.limewire.com/dev/exceptions/3.7.1/ > java.lang.IllegalStateException/Mac%20OS/1.1.8/err51460.txt . (Note > that the line numbers may be off because I've modified the source > slightly to work with 1.1.8, but the spirit of the bug still exists in > the unmodified source.) > > Thanks, > Sam > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]