This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-01
Channels
- # aleph (2)
- # announcements (3)
- # architecture (9)
- # babashka (56)
- # beginners (18)
- # calva (7)
- # catalyst (16)
- # cider (18)
- # cljfx (3)
- # cljs-dev (23)
- # clojure-europe (11)
- # clojure-hungary (1)
- # clojure-nl (2)
- # clojure-norway (24)
- # clojure-sweden (2)
- # clojurescript (37)
- # code-reviews (47)
- # datalog (3)
- # datomic (8)
- # emacs (11)
- # events (2)
- # graalvm (7)
- # gratitude (1)
- # hyperfiddle (12)
- # java (1)
- # jvm (46)
- # kaocha (3)
- # lsp (3)
- # malli (4)
- # matcher-combinators (1)
- # music (1)
- # nbb (1)
- # nrepl (4)
- # releases (1)
- # sci (15)
- # shadow-cljs (21)
- # slack-help (21)
- # tools-deps (17)
We are using the library again https://github.com/liwp/again/tree/master for retry purposes
This library internally uses Thread/sleep
for delay purposes https://github.com/liwp/again/blob/master/src/again/core.clj#L90-L92
The problem is facing is when Thread/sleep
is invoked then the thread is not interrupted even it slept for enough delay time
depending on how fast the fails happen, how long the sleeps are, etc it is unlikely that at any point when you thread dump you will get a dump not sleeping
for example with this program
(defn work []
(Thread/sleep 10))
(defn backoff-and-retry []
(Thread/sleep 10000))
(loop []
(if (zero? (rand-int 5))
(do
(work)
(recur))
(do
(backoff-and-retry)
(recur))))
The thread dump will pretty much always contain the back-of-and-retry function, and not the work function, because of the ratio of the amount of time it spends executing each{:initial-retry-count 2
:initial-delay-ms 10
:exponential-backoff-multiplier 2.0
:max-delay-ms 1000}
ok, but is that the only retry? what is the behavior of the code that is driving this code
are those being served on a threadpool that is re-using the same thread? is the hset always failing quickly?
but Thread/sleep itself is pretty solid, it is used day in and day out by basically every non-trivial jvm program in existence
"initial-retry-count" as a string doesn't seem to appear in the library, maybe check to make sure your configuration is correct
I think it is same sleep because some of the messages from the kinesis stream are not processed
https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/timers.clj#L43 is the loop that services timeout channels, it is built on top of a delayqueue