Skip to content

Keep channel object alive during processReceived - #106

Merged
michalovits merged 1 commit into
bloomberg:mainfrom
michalovits:ch-keepalive
Nov 4, 2026
Merged

michalovits merged 1 commit into
bloomberg:mainfrom
michalovits:ch-keepalive

Conversation

@michalovits

Copy link
Copy Markdown
Contributor

Keep a reference to the channel in ChannelMap::processReceived. This is just defence. It makes it impossible to invalidate the channel object during this call.

Currently that can't happen anyway:

  • A connection owns the channels through ChannelMap and Connection::readHandler keeps the connection alive.
  • ChannelMap::removeChannel only runs after Channel::processReceived returns (if it returns CLEANUP).
  • Connection::socketShutdown is only called from socket and timer callbacks, frames on channel 0 and scheduled closes, none of which can run under Channel::processReceived.
  • The only user code that runs inline is a continuation on createProducerAsync or createConsumerAsync. If it destroys the producer, consumer or connection objects, the close is scheduled to the event loop for later.

@michalovits
michalovits requested a review from a team November 4, 2026 10:32
@michalovits
michalovits enabled auto-merge (squash) November 4, 2026 10:33
@michalovits
michalovits merged commit 4aecec6 into bloomberg:main Nov 4, 2026
7 of 8 checks passed
@michalovits
michalovits deleted the ch-keepalive branch November 4, 2026 11:32
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.

2 participants