taoensso / carmine

Redis client + message queue for Clojure
https://www.taoensso.com/carmine
Eclipse Public License 1.0
1.16k stars 131 forks source link

pool issue? ConnectException Address already in use #161

Closed funston closed 8 years ago

funston commented 8 years ago

I have a fairly basic setup, and something is causing what seems like a pool corruption, at some point in processing data, I get the following stack trace. Only when processing hundreds of items (Using pmap). Not sure how to break the app down into anything reproducible but can work on isolating the issue.

Note: when i switched out to use redis-async, i never see the problemo.

Caused by: java.net.ConnectException: Address already in use at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at taoensso.carmine.connections$make_new_connection.invoke(connections.clj:73)

(defn get_redis_conn [env](cond %28= env) {:host "localhost" :port 6379 :timeout 5000} :else {:host "localhost" :port 6379 :timeout 5000}))

(def redis-conn {:pool {:max-total 10 } :spec (get_redis_conn (or (System/getenv "CLJ_ENV") "dev"))})

(defmacro wcar* [& body] `(car/wcar redis-conn ~@body))

expez commented 8 years ago

I'm seeing this too. In my case it happens in my integration tests where I take a test system up and down repeatedly. I'm using Component and the error happens during component/start when with-new-pubsub-listener runs.

In the same component's stop function i run close-listener, so I should be starting and stopping an equal amount of listeners. Can this error occur because resources are leaking, somehow?

ptaoussanis commented 8 years ago

Hi there, what version of Carmine are you using? A rare pooling issue was fixed in v2.13.0-RC1; could you confirm whether you're still having problems with this version?

Thanks, cheers :-)

funston commented 8 years ago

i just tried 2.13.0 and still get the issue.

ptaoussanis commented 8 years ago

Hi Rich, thanks for the confirmation.

Only when processing hundreds of items (Using pmap). Not sure how to break the app down into anything reproducible but can work on isolating the issue.

Yeah, will unfortunately need more to go on. Could you show an example of what you mean by "processing hundreds of items using pmap"?

Have you checked your pool/TCP configuration? A quick search pulled up two references that might be relevant?:

http://stackoverflow.com/questions/36519366/jedisconnectionexception-java-net-connectexception-address-already-in-use

http://stackoverflow.com/questions/29363586/jedis-exception-java-net-connectexception-address-already-in-use

ptaoussanis commented 8 years ago

Closing for now, please feel free to reopen if you have a reproducible example or more info to go on. Thanks!