You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NIOSSLHandler observes the channel events in this order:
NIOSSLHandler sees the following channel events:
handlerAdded
close (triggered from a Channel.close())
channelInactive (triggered from BaseSocketChannel.close0) [BUG HERE (channelInactive without channelActive)]
channelActive (triggered from BaseSocketChannel.writable -> BaseSocketChannel.finishConnect -> BaseSocketChannel.becomeActive()) [BUG HERE (channelActive after channelInactive)]
Obviously those channel events are wrong. That's a bug in NIO too.
The text was updated successfully, but these errors were encountered:
case (.fullyRegistered, .activate):
self.currentState = .activated
return { promise, pipeline in
promise?.succeed(())
pipeline.syncOperations.fireChannelActive()
}
So NIO (like Netty) will always fulfil the promise first and then fire the channel pipeline event. That leads to this reorder:
Channel.connect succeeds
connect's promise gets fulfilled
user calls Channel.close() in connect promise callback
channelInactive gets called (because of the close)
channelActive gets called once we move past the promise?.succeed(()) line
weissi
changed the title
NIO can send channelInactive before channelActive reordered
NIO can send channelInactive before channelActive reordered if user Channel.close()s in connect promise callback
Jul 9, 2024
Expected behavior
channelInactive
comes afterchannelActive
channelInactive
doesn't happen ifchannelActive
hasn't happenedActual behavior
It's possible to get
channelActive
followingchannelInactive
.Steps to reproduce
Channel.close()
d really early on.This seems related to apple/swift-nio-ssl#467
NIOSSLHandler observes the channel events in this order:
NIOSSLHandler
sees the following channel events:handlerAdded
close
(triggered from aChannel.close()
)channelInactive
(triggered fromBaseSocketChannel.close0
) [BUG HERE (channelInactive
withoutchannelActive
)]channelActive
(triggered fromBaseSocketChannel.writable
->BaseSocketChannel.finishConnect
->BaseSocketChannel.becomeActive()
) [BUG HERE (channelActive
afterchannelInactive
)]Obviously those channel events are wrong. That's a bug in NIO too.
The text was updated successfully, but these errors were encountered: