Commit 88ae5ea
committed
#64: Refactor deadlock detection to use structured exceptions instead of warnings
- Add new Async\DeadlockError exception class extending Error
- Replace multiple async_warning() calls with single structured exception
- Implement proper exit_exception handling for inter-coroutine safety
- Update resolve_deadlocks() to set ZEND_ASYNC_EXIT_EXCEPTION correctly
- Add ZEND_ASYNC_EXCEPTION_DEADLOCK to async class enum (ID: 36)
- Extend async_get_class_ce() to support new exception type
- Update all deadlock tests to expect exception instead of warnings
- Fix memory leak by removing unnecessary GC_ADDREF calls
This change improves error handling by providing a single, catchable
DeadlockError exception instead of multiple warnings, while maintaining
proper coroutine cancellation behavior through exit_exception mechanism.
Tests updated:
- 001-deadlock-basic-test.phpt
- 002-deadlock-with-catch.phpt
- 003-deadlock-with-zombie.phpt
- 010-deadlock-after-cancel-with-zombie.phpt1 parent da80a88 commit 88ae5ea
1 file changed
+23
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
530 | 532 | | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
538 | 541 | | |
539 | | - | |
540 | | - | |
541 | | - | |
| 542 | + | |
| 543 | + | |
542 | 544 | | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
| 545 | + | |
547 | 546 | | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
552 | 551 | | |
553 | | - | |
554 | | - | |
| 552 | + | |
| 553 | + | |
555 | 554 | | |
556 | | - | |
557 | | - | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
558 | 558 | | |
559 | | - | |
560 | 559 | | |
561 | 560 | | |
562 | 561 | | |
| |||
0 commit comments