-
Notifications
You must be signed in to change notification settings - Fork 17
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
fix: ensure proper order of signal emission #281
Conversation
CodSpeed Performance ReportMerging #281 will degrade performances by 10.47%Comparing Summary
Benchmarks breakdown
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #281 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 1880 1883 +3
=========================================
+ Hits 1880 1883 +3 ☔ View full report in Codecov by Sentry. |
minor modification suggested in Czaki#1 |
please merge main here and make sure all the tests we've discussed are added, then ping for review |
@tlambert03 compiled test are ending with Segfault. Did you meet something like this before:
|
no, I haven't seen that before. I can reproduce locally as well though (was just trying as you wrote), but not on main. (btw, to test locally, you can run |
Ok. The problem is that hatch/mypyc performs compilation in tmp directory (unlike cython that places c/cpp files in the structure of packages. So the debugger cannot find the source files. I will try to dig, but maybe you know how to change this behavior or disable cleaning tmp
|
good sleuthing. i also don't know, but happy to look into it if you can't find it easily |
Im going to Warsaw Python meeting so will not be active today. Will sit to this at evening or toomorow |
if len(self._emit_queue) > RECURSION_LIMIT: | ||
raise RecursionError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This simulated stack is 2-3x times bigger than the original one, but maybe it not a problem.
except Exception as e: | ||
raise EmitLoopError(cb=caller, args=args, exc=e, signal=self) from e | ||
finally: | ||
self._emit_queue.clear() | ||
|
||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me! Thanks.
I'm not worried about the very small benchmark decreases on emit to setattr and setitem for large numbers of callbacks.
Thanks for working on this
I have noticed that If some callback triggers emission of an event during an existing loop, the events may come in incorrect order, leading to a corrupted state.
I think that it is a bug, but I'm not sure if my approach to solve is correct.