Skip to content

fix: complete futures whose tasks a SerialExecutor drops - #409

Merged
devopvoid merged 1 commit into
mainfrom
fix/serial-executor
Oct 22, 2026
Merged

devopvoid merged 1 commit into
mainfrom
fix/serial-executor

Conversation

@devopvoid

Copy link
Copy Markdown
Owner

A task the SerialExecutor could not schedule was dropped silently, so a future it would have completed stayed open forever: any operation on a peer after its runtime closed, and any result an application's own event executor rejected.

  • Tasks can carry a fallback that runs when they are dropped. The event tasks that complete futures (toPublic, whenConnected, whenClosed, whenOpen) use it, so those futures complete anyway.
  • A rejection by an executor that is not shut down goes to the error handler.
  • Once the runtime has stopped its control threads, every future of the API still open fails with PeerClosedException, including those of calls made after the close.
  • PeerImpl.open uses the fallback instead of the shutdown hook from fix: close races in MediaReader.getInfo and WebRtc.createPeer #406, and the unused SerialExecutor.shutdown() is removed.

A rejected task was dropped silently, so a future it would have completed
stayed open forever: any operation after the runtime closed, and any event
an application's own executor refused.

Tasks can now carry a fallback that runs when they are dropped; the event
tasks that complete futures use it, and a rejection by an executor that is
not shut down goes to the error handler. Once the runtime has stopped its
control threads, it fails every future of the API still open. This replaces
the shutdown hook PeerImpl.open used, and removes the unused shutdown().
@devopvoid
devopvoid merged commit 299805a into main Oct 22, 2026
25 checks passed
@devopvoid
devopvoid deleted the fix/serial-executor branch October 22, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant