Hi James,
Thanks a lot for closely following up with this.
My case matches well with the discussion you referred me to:
I'm using Jets3t 0.6 and my application runs under Tomcat as well.
I'm doing gets when deadlock occurs.
I run my test with the following setup
s3service.max-thread-count=4
httpclient.max-connections=4
s3service.admin-max-thread-count=4
I restart my application to reset everything.
Then I simultaneously start 10 clients that will make one get(Object)
each on an S3 object (always the same but this should not matter). The
object returned to the client is written to a file, making sure that I
get it all when the server replies.
When I run this, I get different results. Sometimes all requests get
through (rarely though) sometimes I get 1, 3, ... But whenever I get
less than 10 results, I can be sure the deadlock is there and if I try
to make another request, it fails.
Here is the stack trace for a locked thread:
0xb75ce27d __pthread_cond_wait + 0x7d
0x0630b169 _ZN2os13PlatformEvent4parkEv + 0xb9
0x06362bf5 _ZN13ObjectMonitor4waitExbP6Thread + 0x615
0x0636045f _ZN18ObjectSynchronizer4waitE6HandlexP6Thread + 0x3f
0x0625de4a JVM_MonitorWait + 0x1da
0xb539c66e * java.lang.Object.wait(long) bci:0 (Interpreted
frame)
0xb5394edd *
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(org.apache.commons.h
ttpclient.HostConfiguration, long) bci:325 line:509 (Interpreted
frame)
0xb5394d77 *
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(org.apache.
commons.httpclient.HostConfiguration, long) bci:74 line:394
(Interpreted frame)
0xb5395253 *
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(org.apache.commons.httpclient.HttpMeth
od) bci:180 line:152 (Interpreted frame)
0xb5394edd *
org.apache.commons.httpclient.HttpClient.executeMethod(org.apache.commons.httpclient.HostConfiguratio
n, org.apache.commons.httpclient.HttpMethod,
org.apache.commons.httpclient.HttpState) bci:115 line:396 (Interpreted
fra
me)
0xb5394db9 *
org.apache.commons.httpclient.HttpClient.executeMethod(org.apache.commons.httpclient.HttpMethod)
bci:
14 line:324 (Interpreted frame)
0xb5394db9 *
org.jets3t.service.impl.rest.httpclient.RestS3Service.performRequest(
org.apache.commons.httpclient.Ht
tpMethodBase, int) bci:93 line:308 (Interpreted frame)
0xb5394edd *
org.jets3t.service.impl.rest.httpclient.RestS3Service.performRestGet(java.lang.String,
java.lang.Stri
ng, java.util.Map, java.util.Map) bci:51 line:605 (Interpreted frame)
0xb5394d77 *
org.jets3t.service.impl.rest.httpclient.RestS3Service.getObjectImpl(boolean,
java.lang.String, java.l
ang.String, java.util.Calendar, java.util.Calendar,
java.lang.String[], java.lang.String[], java.lang.Long, java.lang.L
ong) bci:517 line:1214 (Interpreted frame)
0xb5394d77 *
org.jets3t.service.impl.rest.httpclient.RestS3Service.getObjectImpl(java.lang.String,
java.lang.Strin
g, java.util.Calendar, java.util.Calendar, java.lang.String[],
java.lang.String[], java.lang.Long, java.lang.Long) bci:
15 line:1157 (Interpreted frame)
0xb5394d77 *
org.jets3t.service.S3Service.getObject(org.jets3t.service.model.S3Bucket,
java.lang.String, java.util
.Calendar, java.util.Calendar, java.lang.String[], java.lang.String[],
java.lang.Long, java.lang.Long) bci:24 line:1496
(Interpreted frame)
0xb5394d77 *
org.jets3t.service.S3Service.getObject(org.jets3t.service.model.S3Bucket,
java.lang.String) bci:16 li
ne:1133 (Interpreted frame)
I tried to do the same with a putObject and I could not reproduce the
issue. So there might be something wrong specific to getObject.
I'll have another look into my code but I doubt it's the root cause of
this issue.
Looking at Jets3t code, I suspect there might be connection leak when
S3ServiceException is thrown from performRequest method but I don't
see such exception being thrown in my case.
I tried the following config:
httpclient.connection-timeout-ms=10000
httpclient.socket-timeout-ms=11000
httpclient.retry-max=3
But these don't seem to be used at all unless I hack the existing
RestS3Service.java (see my previous post in this thread).
Any ideas on this point too?
Thanks,
Manu
On Jun 29, 1:34 am, "James Murty" <
ja...@misterm.org> wrote:
> By the way, what S3 operation are you performing when the deadlock occurs?
> And which version of JetS3t are you using?
>
> I have been doing some testing by performing more parallel connections than
> there are HTTP connections and I have not been able to replicate the
> deadlock with the #putObject, #getObjectDetails, or #deleteObject
> operations. I wonder if you are calling getObject without consuming and
> closing the resultant input stream?
>
> James
>
> ---
http://www.jamesmurty.com
>
> On Sun, Jun 29, 2008 at 10:04 AM, James Murty <
ja...@misterm.org> wrote:
> > Sorry Manu, I misunderstood your original question. If you are using only
> > RestS3Service for parallel connections and not one of the multi-threaded
> > classes in the JetS3t library, the "s3service.max-thread-count" and
> > "s3service.admin-max-thread-count" properties will have no effect.
>
> > I think the problem is due to the way the HttpClient connection manager
> > MultiThreadedHttpConnectionManager, as used in the RestS3Service, handles
> > multiple simultaneous connections -- if there are more connections in
> > parrallel than there are available HTTP connections (as set by
> > "httpclient.max-connections") this class seems to deadlock.
>
> > There is another discussion about this issue here:
> >
http://www.nabble.com/RestS3Service-locking-up-td17644333.html#a17644333
>
> > In the linked thread, I mention a couple of options for dealing with this
> > issue. Aside from increasing the number of available HTTP connections to
> > cope with any potential demands placed on your server, your best option may
> > be to try a different connection manager as mentioned in my last comment in
> > that thread.
>
> > I'm keen to track this problem down and reach a proper resolution, so
> > please let me know whether the suggestions from that other thread are
> > helpful.
>
> > Cheers,
> > James
>
> > ---
> >
http://www.jamesmurty.com
>