Fork me on GitHub
#missionary
<
2024-04-08
>
Eric Dvorsak15:04:13

I'm getting an interesting Exception in a missionary task:

[{:type java.lang.InterruptedException
   :message nil
   :at [java.util.concurrent.locks.AbstractQueuedSynchronizer tryAcquireSharedNanos "AbstractQueuedSynchronizer.java" 1133]}]
 :trace
 [[java.util.concurrent.locks.AbstractQueuedSynchronizer tryAcquireSharedNanos "AbstractQueuedSynchronizer.java" 1133]
  [java.util.concurrent.CountDownLatch await "CountDownLatch.java" 276]
  [clojure.core$promise$reify__8591 deref "core.clj" 7182]
  [clojure.core$deref invokeStatic "core.clj" 2341]
  [clojure.core$deref invoke "core.clj" 2323]
  [taoensso.encore$eval3772$get_hostname__3773 invokePrim "encore.cljc" 5621]
  [taoensso.timbre$get_hostname invokeStatic "timbre.cljc" 329]
  [taoensso.timbre$get_hostname invoke "timbre.cljc" 329]
  [taoensso.timbre$_log_BANG_$fn__4978 invoke "timbre.cljc" 483]
Seems like it is called by timbre when logging, it tries to get the hostname which uses encore, then some promise, which I suspect is interrupted by missionary Timbre is not safe to use with missionary?

leonoel15:04:52

is it called in a m/via ?

leonoel16:04:32

When a m/via task is cancelled, the thread running it is interrupted, at which point blocking calls are expected to throw InterruptedException. Most likely your task has a timbre call somewhere in a finally block, which fails because host resolution is blocking.

Eric Dvorsak16:04:32

Interesting so that would mean im accidently cancelling tasks

leonoel16:04:23

yes I would check that first

Eric Dvorsak07:04:56

does it necessarily mean the task was cancelled or could it be that the task was parked?

Eric Dvorsak07:04:55

it goes like this: (defn logged-task [] (m/via m/blk (do (log/info "logged throwing exception) (http-request))) then (m/? (logged-task))

Eric Dvorsak07:04:55

after moving the log out of the via I don't get the error anymore obviously, and it is probably more correct, but if it was happening because the task was cancelled I have a problem

leonoel10:04:40

What is the context of (m/? (logged-task)) ? If it's from a plain thread then check if it's been interrupted, if it's from a coroutine context then it must have been cancelled somehow

Eric Dvorsak11:04:08

@U053XQP4S yeah I realized that it was actually interrupted because higher up m/reduce call was malformed