-
Notifications
You must be signed in to change notification settings - Fork 180
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
serve() fails when run from an :interactive thread (Julia >=1.9) #970
Comments
Fixes #970. The issue here is that our `access_threaded` function, and thread-specific arrays, all relied on `Threads.nthreads()`, which by default only returns the number of threads in the `:default` threadpool. In the new world where the `:interactive` threadpool exists, there can also be threads there. There is a new function `Threads.maxthreadid()` which helpfully tells us the max id of any thread, regardless of threadpool. So the proposed fix here is that if that function is defined, use that, otherwise fallback to `Threads.nthreads()`.
Thanks for the report; this is somewhat due to my own naivety with how the new threadpools work in Julia, so it was a good learning experience for me. It's actually not really related to the server code really, but due to our utilities we have around global objects that we try to make threadsafe via |
The minimal example fails to return a valid response (but doesn't throw any errors) when run from an
:interactive
thread, but works fine if:interactive
is removed. Julia should be started with-t2,1
.I also tested and got the same results with 1.9.0-alpha1.
The text was updated successfully, but these errors were encountered: