Skip to content

Conversation

@aviks
Copy link
Member

@aviks aviks commented Oct 8, 2025

This function is called from the finalizer as of 74ce7df

Tentative fix for #44 but I'm not 100% sure that's enough. But hopefully this helps.

This function is called from the finalizer.
@ancapdev
Copy link

ancapdev commented Oct 8, 2025

What about the lock, is that safe? If the lock is taken, the task is put in the wait queue, and it yields.

@ancapdev
Copy link

ancapdev commented Oct 8, 2025

According to the manual, locks are not safe to take in finalizers: https://docs.julialang.org/en/v1/devdocs/locks/#Locks

There's some discussion here: https://discourse.julialang.org/t/acquiring-locks-in-finalizers/119628/3

Links example code for working around the general unsafety of locks in finalizers, here: https://github.com/JuliaMath/FFTW.jl/blob/f888022d7a1ff78491abf8f33f1055cc52a68f0a/src/fft.jl#L351-L381

@aviks
Copy link
Member Author

aviks commented Oct 10, 2025

Yes, indeed, the locks seemingly need fixing if this is called from a finalizer. I've taken a detour to fix the tests (#47) since it was annoying to work on any changes when the tests failed for other reasons. I'll get back to this after that.

It would be nice to get a reproducer for #44 -- it's scary to be doing major surgery to multithreaded code without a reproducer.

@aviks
Copy link
Member Author

aviks commented Oct 13, 2025

Closed in favour of #48

@aviks aviks closed this Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants