Fixed multiple issues reported by Claude Opus 4.6 - #686
frankmorgner wants to merge 5 commits into
Conversation
5124459 to
e5f24fb
Compare
- fixes race in EC method init - fixes legacy EC ex_data reference leak
|
Most of the changes look good to me ( The EC method initialization change in It would also be helpful to complete the PR description, since this PR contains several independent fixes and the Current Behavior, New Behavior, Scope of Changes, and Testing sections are currently empty. |
|
Reviewed at 4ebb2a9 against master (fd366be). One blocking finding in the new EC initialization locking; the other changes look reasonable. The initialization mutex is itself initialized unsafely [High]
Reinitializing an initialized pthread mutex is undefined behavior, potentially causing hangs or defeating mutual exclusion. I reproduced duplicate initialization attempts with two threads calling the public The probe suppressed the second actual initialization to avoid undefined behavior; this confirms the invalid attempt, not a reproduced crash. The base already has method-initialization races, but this mutex-lifetime bug is newly introduced. Suggestion: initialize the lock through a platform-compatible once mechanism, then acquire it before every method-pointer check. The existing outer unlocked check also allows callers to receive the method after allocation but before callbacks are installed; adding this mutex does not fix that pre-existing Behavioural changes worth mentioningThe PR includes concurrency changes, not just refactoring. Its description should explain the intended initialization guarantees and include a concurrent-first-use regression test. |
Great minds think alike. |
|
Indeed I was fiddeling around with the race conditions. Other modifications of global data were flagged as problematic as well, but the naive approach of a fix led to deadlocks in CI. As I am unfamiliar with the overall codebase, I suggest to remove the threading "fixes" from this PR and let you decide on how to proceed with the possible race conditions. Would that be acceptable? |
Pull Request Type
Related Issue
Issue number: N/A
Current Behavior
New Behavior
Scope of Changes
Testing
Additional Notes
License Declaration