diehard
diehard copied to clipboard
Instant cannot be cast to Duration
I was trying to upgrade from 0.11.3
to 0.11.6
and one of my tests failed with this. Still investigating but possibly related to e82bf79560f1365f50a38f5e8f40714a3f6be53b?
#error {
:cause "class java.time.Instant cannot be cast to class java.time.Duration (java.time.Instant and java.time.Duration are in module java.base of loader 'bootstrap')"
:via
[{:type java.lang.ClassCastException
:message "class java.time.Instant cannot be cast to class java.time.Duration (java.time.Instant and java.time.Duration are in module java.base of loader 'bootstrap')"
:at [khana.ghdeploy$eval6533$deploy_and_email__6534$fn$reify__6543 get "NO_SOURCE_FILE" 48]}]
:trace
[[khana.ghdeploy$eval6533$deploy_and_email__6534$fn$reify__6543 get "NO_SOURCE_FILE" 48]
[dev.failsafe.Functions lambda$get$0 "Functions.java" 46]
[dev.failsafe.internal.RetryPolicyExecutor lambda$apply$0 "RetryPolicyExecutor.java" 74]
[dev.failsafe.SyncExecutionImpl executeSync "SyncExecutionImpl.java" 187]
[dev.failsafe.FailsafeExecutor call "FailsafeExecutor.java" 376]
[dev.failsafe.FailsafeExecutor get "FailsafeExecutor.java" 123]
[khana.ghdeploy$eval6533$deploy_and_email__6534$fn__6535$fn__6545 invoke "NO_SOURCE_FILE" 171]
[khana.ghdeploy$eval6533$deploy_and_email__6534$fn__6535 invoke "NO_SOURCE_FILE" 171]
[khana.ghdeploy$eval6533$deploy_and_email__6534 invoke "NO_SOURCE_FILE" 170]
[clojure.lang.Var invoke "Var.java" 388]
[khana.ghdeploy_test$fn__21614 invokeStatic "ghdeploy_test.clj" 126]
[khana.ghdeploy_test$fn__21614 invoke "ghdeploy_test.clj" 102]
[cider.nrepl.middleware.test$test_var$fn__6252 invoke "test.clj" 242]
[cider.nrepl.middleware.test$test_var invokeStatic "test.clj" 242]
[cider.nrepl.middleware.test$test_var invoke "test.clj" 234]
[cider.nrepl.middleware.test$test_vars$fn__6256$fn__6261 invoke "test.clj" 257]
[clojure.test$default_fixture invokeStatic "test.clj" 687]
[clojure.test$default_fixture invoke "test.clj" 683]
[cider.nrepl.middleware.test$test_vars$fn__6256 invoke "test.clj" 257]
[clojure.test$default_fixture invokeStatic "test.clj" 687]
[clojure.test$default_fixture invoke "test.clj" 683]
[cider.nrepl.middleware.test$test_vars invokeStatic "test.clj" 254]
[cider.nrepl.middleware.test$test_vars invoke "test.clj" 248]
[cider.nrepl.middleware.test$test_ns invokeStatic "test.clj" 270]
[cider.nrepl.middleware.test$test_ns invoke "test.clj" 261]
[cider.nrepl.middleware.test$test_var_query invokeStatic "test.clj" 281]
[cider.nrepl.middleware.test$test_var_query invoke "test.clj" 274]
[cider.nrepl.middleware.test$handle_test_var_query_op$fn__6300$fn__6301 invoke "test.clj" 319]
[clojure.lang.AFn applyToHelper "AFn.java" 152]
[clojure.lang.AFn applyTo "AFn.java" 144]
[clojure.core$apply invokeStatic "core.clj" 667]
[clojure.core$with_bindings_STAR_ invokeStatic "core.clj" 1990]
[clojure.core$with_bindings_STAR_ doInvoke "core.clj" 1990]
[clojure.lang.RestFn invoke "RestFn.java" 425]
[cider.nrepl.middleware.test$handle_test_var_query_op$fn__6300 invoke "test.clj" 311]
[clojure.lang.AFn run "AFn.java" 22]
[nrepl.middleware.session$session_exec$main_loop__1389$fn__1393 invoke "session.clj" 218]
[nrepl.middleware.session$session_exec$main_loop__1389 invoke "session.clj" 217]
[clojure.lang.AFn run "AFn.java" 22]
[java.lang.Thread run "Thread.java" 1589]]}
This should be caused by breaking changes introduced in failsafe 3.3, which replaces some Duration
API with Instant
. Can you show me some code so we can see which variable has the type change in this case (it's likely to be *start-time-ms*
)
This is the relevant code:
(defn- deploy-and-email [release {:keys [retry-delay-ms send-email port-current]
:as opts}]
(try
(with-retry
{:retry-on IllegalArgumentException
:delay-ms retry-delay-ms
:max-retries 3
:on-retry
(fn [_result ex]
(m/inc m-deploy-retry)
(when-not (str/includes? (str ex) "Host URL cannot be nil")
(send-email (str "Retry Deploy " release)
[:pre (with-out-str (print-stack-trace ex))])))}
(deploy-release release opts))
(m/inc m-deploy-success)
(send-email (str "Deployed " release) (release-email release opts))
(stop-target port-current opts)
(catch Throwable t
(m/inc m-deploy-fail)
(send-email (str "Failed Deploy " release)
[:pre (with-out-str (print-stack-trace t))]))))
This is weird. It should be *start-time-ms*
that being cast to Duration
. Have you tried a lein clean
for this case?