-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hangs in clojure #75
Comments
Hi, You should call Cheers |
There's nothing in the readme about re-graph/destroy, and I don't see any other documentation. I'm using hato. |
Yes I realised when I replied that destroy is undocumented, I have added that. I will try to replicate your issue, in the meantime are you able to take a thread dump while it is hanging? That would help greatly. Thanks |
Closing this as no update, please let me know if you still face issues. Cheers |
Was able to reproduce and found this non-daemon thread preventing shutdown:
Turns out it was the executor from here: Going to talk to re-frame devs to find out more. Short term workaround is to kill that executor. |
@oliyh Hi Oli - did you ever get a resolution to this? Running
|
For now, I have a what can be charitably called a "workaround": (:require
[clojure.test :refer [is, testing, deftest, use-fixtures]
[re-frame.interop])
(def get-executor
(let [executor-var (resolve 're-frame.interop/executor)]
#(var-get executor-var)))
(defn shutdown-executor []
(.shutdown (get-executor)))
(use-fixtures :once
(fn [f]
(f) ; runs all tests
(shopify-api/shutdown-executor))) |
Hi @lowecg, Well done! This would probably be a great contribution to re-frame-test - if they accept it then could update martian to use it. If not then I'm also happy to accept this into martian as a test fixture. Cheers |
Hi @lowecg Did you get a chance to discuss this with the re-frame-test maintainers? I could open an issue and point them to this thread if not. Cheers |
I haven't yet (been limited on time). If you could open the thread, that
would be a big help. Thank you
…On Thu, 14 Nov 2024 at 22:03, Oliver Hine ***@***.***> wrote:
Hi @lowecg <https://github.com/lowecg>
Did you get a chance to discuss this with the re-frame-test maintainers? I
could open an issue and point them to this thread if not.
Cheers
—
Reply to this email directly, view it on GitHub
<#75 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHCVNQLC3MPSVDYZAZKESL2AUM4FAVCNFSM6AAAAABRAWZ2MCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZXGQ4TMOJQGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
EDIT: this turned out to be unnecessary - re-graph works fine in Lambda and SnapStart without having manipulate the executor. There is another angle to this functionality where I had to resurrect the executor. Problem: Solution: (defn reset-executor!
"Resets the executor used by re-frame (used by re-graph for GraphQL execution).
This allows repeat executions of Lambda"
[]
(let [current-executor (get-executor)]
(when (and current-executor (.isShutdown ^ExecutorService current-executor))
(alter-var-root #'re-frame.interop/executor
(fn [_] (Executors/newSingleThreadExecutor))))))
(defn shutdown-executor
"Shuts down the executor used by re-frame (used by re-graph for GraphQL execution).
Warning: once called, further GraphQL interactions will not be possible unless you call reset-executor!.
This is necessary as the non-daemon executor is not shut down by default and will cause short-lived processes (e.g. Lambda or tests run from the CLI) to hang."
[]
(.shutdown ^ExecutorService (get-executor))) |
I've raised a PR for this with re-frame, so 🤞 |
@oliyh would you consider this issue closed given that we have a workaround and the re-frame team (understandably) want to keep the executor internal? |
Following the other thread - let's see what happens there |
Hi, I'm trying to get re-graph working in a clojure command-line app. Following the examples, nothing happens, and the program will not exit, even if I add
(shutdown-agents)
at the end. E.g.Running it:
Adding the example code to send a query has no effect. What am I doing wrong?
The text was updated successfully, but these errors were encountered: