Repository navigation
fix over-eager deletion of task groups on trap - #14555
Conversation
alexcrichton
left a comment
There was a problem hiding this comment.
I'm a bit confused by how this works -- the finished field is never set to true while the groups are in the table, except when the store is torn down. Was this a problem where during teardown the same group was deleted twice? If so could that be solved by reordering some teardown?
|
|
Do we need to run this on |
No, we don't have to; I figured it would be best to do it promptly, but I'd be fine with only doing it on store teardown. And note that we'd have to make sure it's pretty much the last thing we do on store teardown if we want to delete any task groups before their reference counts go to zero; otherwise, we'll risk hitting this issue again. |
|
I think that'd be best to implement yeah, I found it pretty surprising that |
|
@alexcrichton I've applied your feedback and rebased onto |
We now delay deleting the task groups until all fibers have been disposed, and we no longer do so immediately upon trapping. This ensures that no code will run later that might get tripped up on prematurely-deleted (i.e. deleted before the refcount goes to zero) groups. Fixes bytecodealliance#14504 Co-Authored-By: Alex Crichton <alex@alexcrichton.com>
Instead of deleting any outstanding task groups when trapping, we now just record that we've notified the task hook so we don't do it again if and when the group's ref count goes to zero.
Fixes #14504