Skip to content

v0.3.0 - EXP Release

Latest
Compare
Choose a tag to compare
@EdmondDantes EdmondDantes released this 16 Jul 07:56
· 11 commits to main since this release

Stabilization release - 2025-07-16

Added

  • Docker support with multi-stage build (Ubuntu 24.04, libuv 1.49, curl 8.10)
  • PDO MySQL and MySQLi async support
  • TrueAsync API Extensions: Enhanced async API with new object creation and coroutine grouping capabilities
    • Added ZEND_ASYNC_NEW_GROUP() API for creating CoroutineGroup objects for managing multiple coroutines
    • Added ZEND_ASYNC_NEW_FUTURE_OBJ() and ZEND_ASYNC_NEW_CHANNEL_OBJ() APIs for creating Zend objects from async primitives
    • Extended zend_async_task_t structure with run method for thread pool task execution
    • Enhanced zend_async_scheduler_register() function with new API function pointers
  • Multiple Callbacks Per Event Support: Complete redesign of waker trigger system to support multiple callbacks on a single event
    • Modified zend_async_waker_trigger_s structure to use flexible array member with dynamic capacity
    • Added waker_trigger_create() and waker_trigger_add_callback() helper functions for efficient memory management
    • Implemented single-block memory allocation for better performance (trigger + callback array in one allocation)
    • Default capacity starts at 1 and doubles as needed (1 → 2 → 4 → 8...)
    • Fixed coroutine_event_callback_dispose() to remove only specific callbacks instead of entire events
    • Breaking Change: Events now persist until all associated callbacks are removed
  • Bailout Tests: Added 15 tests covering memory exhaustion and stack overflow scenarios in async operations
  • Garbage Collection Support: Implemented comprehensive GC handlers for async objects
    • Added async_coroutine_object_gc() function to track all ZVALs in coroutine structures
    • Added async_scope_object_gc() function to track ZVALs in scope structures
    • Proper GC tracking for context HashTables (values and keys)
    • GC support for finally handlers, exception handlers, and function call parameters
    • GC tracking for waker events, internal context, and nested async structures
    • Prevents memory leaks in complex async applications with circular references
  • Key Order Preservation: Added preserveKeyOrder parameter to async await functions
    • Added preserve_key_order parameter to async_await_futures() API function
    • Added preserve_key_order field to async_await_context_t structure
    • Enhanced awaitAll(), awaitAllWithErrors(), awaitAnyOf(), and awaitAnyOfWithErrors() functions with preserveKeyOrder parameter (defaults to true)
    • Allows controlling whether the original key order is maintained in result arrays

Fixed

  • Memory management improvements for long-running async applications
  • Proper cleanup of coroutine and scope objects during garbage collection cycles
  • Async Iterator API:
    • Fixed iterator state management to prevent memory leaks
  • Fixed the spawnWith() function for interaction with the ScopeProvider and SpawnStrategy interface
  • Build System Fixes:
    • Fixed macOS compilation error with missing field initializer in uv_stdio_container_t structure (libuv_reactor.c:1956)
    • Fixed Windows build script PowerShell syntax error (missing shell: cmd directive)
    • Fixed race condition issues in 10 async test files for deterministic test execution on all platforms

Changed

  • Breaking Change: Function Renaming - Major API reorganization for better consistency:
    • awaitAllFailFirst()awaitAllOrFail()
    • awaitAllWithErrors()awaitAll()
    • awaitAnyOfFailFirst()awaitAnyOfOrFail()
    • awaitAnyOfWithErrors()awaitAnyOf()
  • Breaking Change: awaitAll() Return Format - New awaitAll() (formerly awaitAllWithErrors()) now returns [results, exceptions] tuple:
    • First element [0] contains array of successful results
    • Second element [1] contains array of exceptions from failed coroutines
    • Migration: Update from $results = awaitAll($coroutines) to [$results, $exceptions] = awaitAll($coroutines)
  • LibUV requirement increased to ≥ 1.44.0 - Requires libuv version 1.44.0 or later to ensure proper UV_RUN_ONCE behavior and prevent busy loop issues that could cause high CPU usage
  • Async Iterator API:
    • Proper handling of REWIND/NEXT states in a concurrent environment.
      The iterator code now stops iteration in
      coroutines if the iterator is in the process of changing its position.
    • Added functionality for proper handling of exceptions from Zend iterators (\Iterator and generators).
      An exception that occurs in the iterator can now be handled by the iterator's owner.