Commit b15c597
Fix GH-19983: GC assertion failure with fibers, generators and destructors
When GC runs inside a fiber handling an exception (e.g. during
zend_fiber_object_destroy), EG(exception) is set.
gc_call_destructors_in_fiber() saved and cleared the exception after
creating the destructor fiber. Since zend_call_function() returns early
when EG(exception) is set, the destructor fiber's handler never ran,
leaving DTOR_GARBAGE entries in the root buffer. On the next GC cycle,
gc_collect_roots() hit an alignment assertion on these stale entries.
Move remember_prev_exception() before the destructor fiber
creation/resume so EG(exception) is cleared before zend_call_function()
runs inside the fiber.
Closes GH-215291 parent cd568cb commit b15c597
3 files changed
+35
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1893 | 1893 | | |
1894 | 1894 | | |
1895 | 1895 | | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
1896 | 1899 | | |
1897 | 1900 | | |
1898 | 1901 | | |
1899 | 1902 | | |
1900 | 1903 | | |
1901 | 1904 | | |
1902 | | - | |
1903 | 1905 | | |
1904 | 1906 | | |
1905 | 1907 | | |
| |||
0 commit comments