Skip to content

Conversation

@vtjnash
Copy link
Member

@vtjnash vtjnash commented Oct 17, 2025

  • Instead of preventing profiling entirely (which might deadlock if DllInit accesses Julia in any way), use a suggestion by @gbaraldi to abort the profile if it takes too long (100ms), allowing the stopped thread to release any locks and free up both threads to continue all. Many, many other projects have encountered this same bug, including dotNet (closed as won't fix) and Firefox (uses a single stepping debugger to find the memory address of the offending locks), but those seem difficult responses for us.
  • Define correct ordering for taking profile-related locks
  • Profile all threads instead of just main thread
  • Refactor needsSymRefreshModuleList to use a modern API for doing so reliably. The API does not appear to implement the documented behaviors, but it seems to do what we need.
  • Make stack unwinding on Windows thread-safe so that using multiple threads that throw exceptions won't cause memory corruption anymore
  • Use condition variables for correctly controlling profiler start/stop, instead of volatile

@vtjnash vtjnash requested a review from topolarity October 17, 2025 17:09
@vtjnash vtjnash added the system:windows Affects only Windows label Oct 17, 2025
@topolarity topolarity linked an issue Oct 17, 2025 that may be closed by this pull request
@vtjnash vtjnash added the merge me PR is reviewed. Merge when all tests are passing label Oct 18, 2025
@vtjnash vtjnash merged commit 8e7ed1d into master Oct 18, 2025
9 of 11 checks passed
@vtjnash vtjnash deleted the jn/59650 branch October 18, 2025 01:19
@IanButterworth
Copy link
Member

Profile all threads instead of just main thread

Great! Worth a NEWS entry and the docs for Profile.print have a note that needs removing

@vtjnash
Copy link
Member Author

vtjnash commented Oct 18, 2025

Sure, do you want to do that and also fix jl_profile_task with similar code?

@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Oct 18, 2025
@IanButterworth
Copy link
Member

No I'm good thanks, go ahead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

system:windows Affects only Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Profile test seems to sporadically hang on Window x86-64

4 participants