Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
v0.1.7 - 2026-11-28
All about the benchmarks this time.
Changed
- Remove always-on scheduler bookkeeping to tidy up our hot path:
- Skip priority scans and disabled
maybe_yield()calls - Track live fibers incrementally
- Gate diagnostic counters
- Keep park/queue state in pre-sized fiber slots
- Use raw fiber lookups plus a shared
['WAITING']marker on the park/resume path.
- Skip priority scans and disabled
- Eliminate repeated C job-pool scans and lock churn:
- Maintain pending counts and free/pending/sleep bitmaps
- Drain completions under one lock
- Merge completion publication with the next claim
- Deliver results in a flat buffer
- Make short waits cheaper without turning long idle periods into busy loops:
- Bounded sub-millisecond polling after job activity
- Longer fast-poll budget
- Wall clock spin windows for sub-tick sleeps
- High res
yieldspin for Windows sleeps up to 8 ms
- Reduce startup and virtual-timer work with a single fiber-table scan/call and ordered timers using a compacted fired prefix and parallel deadline/fiber arrays instead of per-timer arrayrefs.
- Trim common wait/cleanup paths by inlining the usual
Channel::get()/put()case, skipping fiber-local cleanup when no locals exist and stopping backtrace capture at the first library frame.
Fixed
- Size the high-volume driver tests against the descriptors they actually allocate, so a platform with more than the assumed 16 pre-existing handles (NetBSD 11, whose
FD_SETSIZEis 256) no longer parks a read on an unnameable fd and loses a wakeup. (https://matrix.perl-magpie.org/results/e76ea43a-e600-11f1-83c9-deb385cf8ea6)
v0.1.6 - 2026-11-20
Fixed
- On GNU/Hurd, cap the default fiber limit at 512 when
RLIMIT_DATAis unlimited (as it often is there, with the real ceiling coming from the Mach task or physical memory) instead of leaving it at 65536 and letting the first large burst fail with an mmap error. - Builder should only link
-lperlwhen an unversionedlibperlis actually present in the perl'sCOREdir.
v0.1.5 - 2026-11-20
Fixed
- Request
_LARGEFILE64_SOURCEbefore includingperl.h, so itsoff64_talias resolves under-D_FILE_OFFSET_BITS=64. - GNU/Hurd and Cygwin both use 2 MiB fiber stacks and clamp there instead of allowing a handful of 8 MiB stacks to exhaust the data-segment budget.
- Enforce
with_timeout()at the block boundary so a result that lands after the deadline throwsError::Timeouteven when a busy host fires the timer helper late. - Don't double-fail a deadline that was already delivered at a park.
- Several fixes for Cygwin:
- Fiber stacks now come from
VirtualAlloc(with aPAGE_NOACCESSguard page) and the initial ucontext is armed directly instead of throughmakecontext(). Cygwin'smmap()can't commit pages from inside a ucontext and itsmakecontext()jumps touc_linkrather than returning when called from one, which silently prevented nested fibers from ever running. - Warm the socket layer on the main stack at initialization. Cygwin's first
socket()call initializes Winsock lazily and fails withEINVALwhen made from a fiber's ucontext, which makesIO::Socket::INET->new()returnundef. spawn_blocking_fork()now croaks with a clear message instead of killing the whole process because Cygwin can'tfork()from a fiber stack. Cygwin perls have ithreads and should usespawn_blocking()anyway.
- Fiber stacks now come from
v0.1.4 - 2026-11-19
Added
- Native AArch64 ELF and Mach-O fiber context-switch backends. Windows ARM64 continues to use the OS fiber API which is architecture-neutral.
Fixed
- Android/Termux builds: removed a duplicate
PARA_HIDDENdefinition, switched CPU affinity to Bionic'ssched_setaffinity()with a kernel TID, and stopped falling through togetcontext/makecontext/swapcontext, which Bionic does not expose. - Removed the
endbr64workaround from the x86-64 trampoline. I misunderstood how it addressed CET/IBT rather than OpenBSD Retguard and seems have only worked by coincidence. The supported Retguard and BTI linker flags remain in place. - Fixed the shared-CV pad collision behind
Perl_pp_entersubassertion failures (AvFILLp(av) == -1) on real concurrent HTTP tests. Parataxis now swaps per-fiber padlists at every context switch instead of trying to make one globalCvDEPTHsafe for every fiber, so two fibers can never reuse the same pad layer.t/255_http_mock_pool.tno longer wraps pad-collision failures in a TODO block (let's see how far that gets me...)
v0.1.3 - 2026-10-28
Fixed
- Silly compiler fluff.
v0.1.2 - 2026-10-27
Trying to get 100% of CPAN smokers to pass tests I've run on a dozen other setups without failure because a solid green bar matters.
Changed
- Only consider zombies within our parent pid in
t/031_spawn_blocking_fork.t.
Fixed
- Deal with Retguard on OpenBSD/clang with an
endbr64instruction and proper compile and linker flags. The instruction is treated like a no-op on x64 CPUs without IBT.
v0.1.1 - 2026-10-25
Borrowing patterns from Rust, Erlang, Java, etc. to bring more familiar concurrency primitives to Parataxis. No real changes to the core this time.
Added
Acme::Parataxis::Blocking: CPU offloading onto a bounded pool of cloned interpreters viaspawn_blocking(lazily loads threads/shared modules on first use).spawn_blocking_fork: Process-based CPU offloading for non-ithreads Perls with IPC viaStorable, bounded worker pools, and signal-based cancellation viakill_blocking_fork.Acme::Parataxis::Actor: Mailbox-driven actors with bounded queues, backpressure,ask(returning aFuture),send, and graceful teardown.Acme::Parataxis::Supervisor: OTP-style supervision trees supportingOneForOne,OneForAll, andRestForOnerestart strategies with configurable restart budgets.- Synchronization primitives:
Acme::Parataxis::Sync::Mutex: Non-reentrant lock with strict FIFO hand-off and ownership tracking.Acme::Parataxis::Sync::RwLock: Writer-preferring, reentrant read/write lock.Acme::Parataxis::Sync::WaitGroup: Fiber job counter (add,done,wait).Acme::Parataxis::Sync::Barrier: Reusable phase rendezvous point.Acme::Parataxis::Sync::Once: Race-safe, single-execution initializer.
- Structured concurrency & flow control:
nursery( sub ($n) { ... } ): Structured fiber scopes where child errors cancel siblings and propagate outward.pmap( { concurrency => $n, }, sub ( $item ) { ... }, @items ): Parallel list mapping over a bounded fiber pool.with_timeout( $ms, [ $token, ] $code )andwith_cancel( $code ): Cooperative deadline and cancellation scopes.Acme::Parataxis::CancellationToken: Cooperative park-interrupt token.Acme::Parataxis::Local: Fiber-local ambient storage.Acme::Parataxis::Generator: Stackful, lazy pull iterator.Acme::Parataxis::Monitor: Non-owning fiber observer.
- Channels & Streams:
Acme::Parataxis::Channel::select: CSP-style waiting across multiple channels with random case selection to prevent starvation.try_get/try_putnon-blocking channel operations and per-channel timeout configurations.Acme::Parataxis::Stream: Backpressure-driven channel pipelines (map,filter,batch,batch_time,throttle).Acme::Parataxis::Ticker: Drift-free interval timer.Acme::Parataxis::RateLimiter: Token bucket limiter driven byTicker.
- Software Transactional Memory (STM):
Acme::Parataxis::TVarcells andatomicallytransactions with conflict detection andretry(). - Future combinators:
wait_allandwait_any. - Event loop & OS integration:
- Event loop drivers:
Acme::Parataxis::Driver::MojoandAcme::Parataxis::Driver::IOAsync. - Transparent unblocking (
Acme::Parataxis::Compat): Opt-in cooperativeCORE::GLOBALoverrides forsleep,read, andsysread. - Deterministic virtual clock via
run( virtual => 1 )andadvance( $ms ). - Graceful shutdown handlers via
run( on_shutdown => ... )forSIGINT/SIGTERM. fd_setsize()introspection helper.
- Event loop drivers:
- Diagnostics & Introspection:
dump_fibers()and backtrace-rich deadlock diagnostics.- New exceptions:
Acme::Parataxis::Error,Error::Cancelled, andError::Timeout. - Verified Perl
defercompatibility within fiber scopes.
Fixed
- Event loop drivers now key watches by handle identity rather than recycled file descriptor numbers, eliminating lost wakeups and orphaned slots.
- Fixed non-numeric string values being silently accepted in
Supervisor->new( within => ... ). - Fiber jump environments (
PL_top_env) are now preserved across context switches, preventing crashes (0xC0000005) when completion callbacks throw. - Blessed exceptions stringifying to empty strings (e.g.
Error::Timeout) are no longer misidentified as clean exits. - Fixed bare
Died at ...rethrows inrun()andChannel->getwhen evaluated blocks or messages return falsey values (0,''). - Deadlock detection now resets scheduler run queues and state so subsequent runs remain usable.
- Awaited fiber crashes are now caught and rethrown by
awaitrather than killing the entire scheduler loop. await_sleepnow uses native condition variable timed waits (pthread_cond_timedwait,SleepConditionVariableCS) instead of 4ms polling.- Context switches now strictly maintain canonical
AvREIFY_onlystate on argument pads, fixingPerl_pp_entersubassertions onDEBUGGINGbuilds. - Fiber-parking primitives now clean up
@_landing pads before parking to avoid cross-fiber pad pollution. submit_c_jobnow broadcasts condition variables to prevent queued jobs from stalling behind unrelated worker sleeps.- Enforced platform
FD_SETSIZEbounds checks on worker pool read/write jobs and event-loop watches to prevent stack buffer overflows. - Prevented uninitialized memory bugs in BSD
get_cpu_countsysctl lookups. exit()from inside yielded fibers is now safely trapped and re-raised across all platforms.- Fixed pad argument and buffer truncation when multiple fibers park inside the same shared subroutine.
- Resolved
Can't undef active subroutinewhen disablingAcme::Parataxis::Compatby correctly cleaning up fabricatedCvDEPTHframes. - Corrected C function signature for
para_release_cv_depthunder Affix on Windows. - Fixed
Can't undef active subroutine during global destructionwhen multiple fibers park concurrently in the same CV (Pass 1c depth settlement). - Traversed nested runlevels (
si_prev/si_next) during depth settlement to preventcx_popsub_argsassertion failures inside test subtest blocks.
Changed
- Maximum fiber limits are now dynamic: configurable via
max_fibers()andset_max_fibers(). - Increased default fiber limit from 1,024 to 65,536.
v0.1.0 - 2026-09-21
This started as a silly little diversion in February but I'm using this in actual projects now. I've even used it to shake out bugs in Affix.
I might move it out of the Acme namespace...
Anyway, the major win is that fiber hot path has been moved from Perl into C and roughly tripled context swapping throughput with no change to the public API.
Added
Acme::Parataxis::Channel: a buffered FIFO message queue for producer/consumer patterns between fibers. Writers block when full, readers when empty; a capacity of1makes it a rendezvous point. Built on two semaphores.Acme::Parataxis::Future: a one-shot placeholder for an eventual computation result. A producer firesset_result/set_errorexactly once; consumers pick it up withawait/resultor register anon_readycallback.Acme::Parataxis::Semaphore: a counting semaphore with no ownership: blocked fibers are parked (no busy-wait) and resumed FIFO as permits become available.Acme::Parataxis::Signal: a two-state flag with a FIFO queue of waiters.sendlatches the signal so a laterwaitconsumes it immediately, whilebroadcastwakes every queued waiter at once (and drops if nobody is waiting).
Fixed
- Fixed crash (double-free / use-after-free) when fibers call Affix'd functions on non-threaded Perl. The bug was in Affix's
SAVEVPTR/SAVEDESTRUCTOR_Xarena pattern, which was not fiber-safe; now fixed upstream in Affix v1.2.5+. - Fixed SIGSEGV on macOS and FreeBSD caused by fiber stacks being only 512KB (via
posix_memalign). All POSIX platforms now use a 64MBmmap-backed stack with a PROT_NONE guard page, matching the Linux path. The SIGSEGV guard handler is also available on macOS/FreeBSD now. - Fixed FreeBSD compilation: added
MAP_ANONYMOUSw/MAP_ANONfallback. - Fixed macOS SIGBUS: the guard region size is now derived from
sysconf(_SC_PAGESIZE)at runtime so it always covers at least one full page (16 KiB on Apple Silicon). Also fixedcleanup()to usemunmap()instead offree()on non-Linux POSIX platforms. is_finished()now rejects fiber ids ofMAX_FIBERSor greater instead of reading out of bounds of the fiber table.- Closed a busy-spin footgun:
wait, fiberawait,Semaphorewaits, andSignal->waitnow croak instead of burning 100% CPU when called from outside the scheduler, and->newcroaks when the 1024-slot fiber table is exhausted rather than creating a fiber that can never run. - A fiber that yields during its initial run is now re-enqueued by the scheduler instead of being dropped, which previously could hang a regex-heavy workload.
- The scheduler no longer hangs when a fiber object is created but never spawned (
->newwithoutspawn): live-fiber tracking only counts fibers that have actually started, matching Coro's ready-queue semantics. async/runis now re-entrant: a nestedasyncinside anotherasyncor inside a fiber shares the one run loop (like Coro's single global scheduler) and returns the block's value, instead of clobbering the outer scheduler and deadlocking.- A destroyed fiber's id is kept out of the free list until every job it submitted has been reclaimed, so a stale completion can never be misdelivered to a (or corrupt) fiber that later reuses the id.
- Pending-job tracking now reads the C-side outstanding job count instead of a run-local counter, so jobs left over from a
stopped run are drained and handled by the next run instead of trippingFATAL: deadlock detectedor sitting in the done-queue forever. Semaphoreup/adjustskip stale (already destroyed) waiters instead of consuming a wake that should go to a live fiber.- Channel constructors now reject a capacity below 1 instead of deadlocking on it at load time.
- The 1024-slot job queue is no longer fatal on the first try:
_submit_jobyields once and retries before croaking. Future::set_result/set_errorwake awaiters exactly once instead of appending a duplicate_wake_waiterscallback on everyawait.
Changed
- Spawned fibers run inline at spawn time.
- The fiber registry is replaced by strong references to each fiber object in C.
- Fiber completion moved from a Perl method into C: the entry point writes state directly into the object's slots with
av_store, and only dispatches callbacks when callbacks were actually registered. - To save time on FFI boundary crossings,
spawnnow performs the whole create run sequence in a single call and builds the fiber object in C. - Fiber objects are incrementally-filled AVs instead of HVs.
- On x86_64 ELF, context switching uses a hand written trampoline that only saves the callee-saved registers and stack pointer, avoiding
swapcontext's signal-mask syscall. spawnandawaithot paths flattened by inlining helpers.- Worker threads block on
select()for the fullawait_read/await_writetimeout instead of polling every 10ms, cutting idle syscalls by ~50x. On POSIX a shutdown pipe wakes any worker blocked inselect()duringcleanup().
v0.0.10 - 2026-02-22
This version comes with a dynamic thread pool and an improved API.
Added
- New ergonomic API using exported functions like
async { ... },fiber { ... }, andawait( $target ).
Changed
- Refactored native thread pool to use cond vars (
PARA_COND_*) instead of busy polling, reducing idle CPU usage to near zero. - Switched to a global job queue for the thread pool for better load balancing across worker threads.
- Reduced default fiber stack size from 4MB to 512K.
- Worker threads are now only spawned when the first asynchronous job is submitted.
- Increased
MAX_FIBERSlimit to 1024. - Expose thread pool config with
set_max_threadsandmax_threads.
v0.0.9 - 2026-02-21
Asynchronous HTTP::Tiny is basically a semi-automatic footgun.
Fixed
- Resolved
AvFILLp(av) == -1and!AvREAL(av)assertion failures inPerl_pp_entersubonDEBUGGINGbuilds of Perl. This was fixed by ensuring Slot 0 (the argument array) of the next pad depth is correctly initialized during fiber context switches.
Changed
- Increased fiber stack size to 4MB to provide better support for deep Perl calls and regex operations. This is a temp solution.
v0.0.8 - 2026-02-19
All the remaining failing smokers all had old versions of Affix and sure enough when I installed v1.0.6, I saw the same failure. Always the most obvious thing...
Changed
- Require Affix v1.0.7
v0.0.7 - 2026-02-18
Another dist targetting a specific CPAN smoker. I cannot replicate the failure in https://www.cpantesters.org/cpan/report/f0ca1d14-0cfa-11f1-9988-e7d94c615303, so I'm just trying different things...
Fixed?
- Arguments passed to a fiber might not be released until the fiber object was destroyed.
v0.0.6 - 2026-02-18
Fixed
- Resolved assertion failures in
Perl_cx_popsub_argsandPerl_pp_entersubwhen running on aDEBUGGINGbuild of Perl. This was fixed by ensuringCvDEPTHand pads are correctly restored during context switches. (I hope...)
Added
- Added
--debugbuild to GitHub Actions matrix to ensure future compatibility with Perl debugging builds.
Changed
- Refactored
swap_perl_stateto be more robust regarding Perl's internal stack management.
v0.0.5 - 2026-02-18
Changed
- I'm honeslty just throwing stuff at the wall. Between my local machines and GH CI workflows, I cannot replicate some of the failures I'm seeing from smokers which makes them virtually impossible to resolve.
v0.0.4 - 2026-02-17
Changed
- Attempt to only spawn max X threads in
t/006_parallel.twhere X is 3 or theget_thread_pool_size()? See https://www.cpantesters.org/cpan/report/ecf1410e-0c46-11f1-8628-aee76d8775ea - Recalculate
PL_curpad = AvARRAY(PL_comppad)inswap_perl_state? See https://www.cpantesters.org/cpan/report/e7244bd8-0c44-11f1-b3ab-94362698fc84
v0.0.3 - 2026-02-17
Changed
- Adding an optional timeout to
await_readandawait_write. - Allow fibers to return complex data (AV*, HV*).
v0.0.2 - 2026-02-17
Fixed
- Fixed segfault in
coro_yieldby adding NULL checks for destroyed or missing fibers. - Resolved stall in exception handling by introducing
last_sendertracking to preventparent_idcycles.
Changed
- Made unit tests a lot more noisy
v0.0.1 - 2026-02-16
Changes
- It exists! It shouldn't but it does.