Closed gerritjvv closed 10 years ago
Hi Gerrit, sorry for the delay replying - was on vacation!
Is it possible you're setting the a timeout on your Redis connection? That's something you'll normally want to avoid for things like pub/sub or message queue connections.
Let me know if that's no help and we'll go from there!
Cheers :-)
Hi, I don't think I was setting the timeout. Basically the if the queue is empty it does not exist in redis. I fixed this by catching the exception, sleeping and then doing a retry.
Okay, sure.
Note that car/brpoplpush
is a blocking command - so it'll hold the TCP connection open until a response comes in. The java.net.SocketTimeoutException
you're seeing does seem to imply that there's a timeout being applied to the connection somewhere, otherwise the command should just silently block forever / until a response comes in.
Does that make sense?
Also, not sure if it was a typo - but you may not want to be nesting wcar
calls unless you're clear on exactly what that's doing?
Cheers! :-)
I'll check, my timeouts. The nesting was a typo, I did realise that nesting causes problems :),.
thanks,
Closing this for now, please feel free to reopen if you're still having trouble. Cheers! :-)
When running the below:
(require '[taoensso.carmine :as car :refer [wcar]]) (car/war redis-conn (car/war (car/brpoplpush "work" "working" 0)))
I the following exception only if the queue "work" does not exist.
java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:152) at java.net.SocketInputStream.read(SocketInputStream.java:122) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read(BufferedInputStream.java:254) at java.io.DataInputStream.readByte(DataInputStream.java:265) at taoensso.carmine.protocol$get_basic_reply.invoke(protocol.clj:126) at taoensso.carmine.protocol$get_parsed_reply.invoke(protocol.clj:188) at taoensso.carmine.protocol$get_parsed_replies.invoke(protocol.clj:216) at kafka_clj.client$eval3346$fn3348.invoke(form-init5770579010056726436.clj:1) at kafka_clj.client$eval3346.invoke(form-init5770579010056726436.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6619) at clojure.lang.Compiler.eval(Compiler.java:6582) at clojure.core$eval.invoke(core.clj:2852) at clojure.main$repl$read_eval_print6588$fn6591.invoke(main.clj:259) at clojure.main$repl$read_eval_print6588.invoke(main.clj:259) at clojure.main$repl$fn6597.invoke(main.clj:277) at clojure.main$repl.doInvoke(main.clj:277) at clojure.lang.RestFn.invoke(RestFn.java:1096) at clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn7360.invoke(interruptible_eval.clj:56) at clojure.lang.AFn.applyToHelper(AFn.java:159) at clojure.lang.AFn.applyTo(AFn.java:151) at clojure.core$apply.invoke(core.clj:617) at clojure.core$with_bindingsSTAR.doInvoke(core.clj:1788) at clojure.lang.RestFn.invoke(RestFn.java:425) at clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:41) at clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn7401$fn7404.invoke(interruptible_eval.clj:171) at clojure.core$comp$fn4154.invoke(core.clj:2330) at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn7394.invoke(interruptible_eval.clj:138) at clojure.lang.AFn.run(AFn.java:24) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744)
The problem is the the command removes an item from the queue everytime it runs and eventually empties the queue which in turn removes it causing this error to happen any time during my app processing.