michaelklishin / welle

An expressive Clojure client for Riak with batteries included
http://clojureriak.info
92 stars 26 forks source link

Apache HTTP Pool connection leak #21

Closed dgrnbrg closed 11 years ago

dgrnbrg commented 11 years ago

I believe that when you call toRiakObject in clojurewerkz.welle.core on line 186, you need to close the associated stream. Today in production I encountered this issue in calls to clojurewerkz.welle.kv/store and clojurewerkz.welle.kv/fetch. I traced through the riak-java-client and welle code paths, and my current conclusion is that the connection is leaked. What do you think?

I should mention that simply calling connect! again fixed the issue. I haven't checked to see whether httpclient's connection pools are a static or instance member, however.

michaelklishin commented 11 years ago

Need to see what the Java client does. Do they explicitly close streams in the higher-level client?

dgrnbrg commented 11 years ago

I didn't see them closing the streams where I looked, in RiakObject and some Connection class.

michaelklishin commented 11 years ago

It may be because they rely on connection pooling? (just a hypothesis)

dgrnbrg commented 11 years ago

Based on my read of the stackoverflow post, riak-java-client is using the connection pooling automatically, and somehow there's a bad interaction/connection pool leak somewhere in the stack.

On Fri, Nov 8, 2013 at 9:48 AM, Michael Klishin notifications@github.comwrote:

It may be because they rely on connection pooling? (just a hypothesis)

— Reply to this email directly or view it on GitHubhttps://github.com/michaelklishin/welle/issues/21#issuecomment-28067524 .

michaelklishin commented 11 years ago

Thanks. FWIW, Welle is basically a thin Clojure layer on top of their "raw client" and it does not open or close connections at any point. Feel free to reopen if you find out more.