Skip to content

Conversation

EdmondDantes
Copy link
Contributor

… 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.phpt

… 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.phpt
@EdmondDantes EdmondDantes added this to the RFC v1.4 milestone Oct 1, 2025
@EdmondDantes EdmondDantes requested a review from Copilot October 1, 2025 11:17
@EdmondDantes EdmondDantes self-assigned this Oct 1, 2025
@EdmondDantes EdmondDantes added the enhancement New feature or request label Oct 1, 2025
@EdmondDantes EdmondDantes linked an issue Oct 1, 2025 that may be closed by this pull request
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors deadlock detection to use structured exception handling instead of warnings. The change replaces multiple async_warning() calls with a single Async\DeadlockError exception that extends Error, providing better error handling and catchable exceptions.

Key changes:

  • Introduced Async\DeadlockError exception class extending Error
  • Updated deadlock resolution to throw structured exceptions instead of warnings
  • Modified all deadlock test cases to expect fatal errors with the new exception

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scheduler.c Updated resolve_deadlocks() to create and set DeadlockError as exit exception
exceptions.stub.php Added DeadlockError class definition extending Error
exceptions_arginfo.h Generated registration function for new DeadlockError class
exceptions.h Added class entry declaration and throw function for DeadlockError
exceptions.c Implemented DeadlockError class registration and async_throw_deadlock()
async_API.c Extended async_get_class_ce() to support ZEND_ASYNC_EXCEPTION_DEADLOCK
test files Updated expected output to show fatal error instead of warnings
CHANGELOG.md Documented breaking change from warnings to exceptions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@EdmondDantes EdmondDantes moved this to Done in True Async Board Oct 1, 2025
@EdmondDantes EdmondDantes merged commit a7dff7c into main Oct 1, 2025
1 check passed
@EdmondDantes EdmondDantes deleted the 64-add-a-special-deadlock-exception-instead-of-a-warning branch October 1, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add a special DeadLock exception instead of a warning.
1 participant