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
ObservableConnection.cleanupConnection() removes the ReadTimeoutHandler, if present, from the pipeline to avoid timeouts when the pooled connection is idle.
Netty's ChannelPipeline.remove() invoked here blocks till completion if invoked from any thread but the eventloop associated with the pipeline in question.
In the above example, "/fanout" request will trigger two outbound requests, the responses of which are zipped. The zip operator at the end unsubscribes from both the sources which in turn closes the underlying connection hence causing the ReadTimeoutHandler to be removed. Since, this unsubscription will be done from one of the eventloop of the client, one of the two connection close will be on a different eventloop and hence the remove() of ReadTimeoutHandler will be submitted to the eventloop and then the code will block for completion. Now, in a scenario where a few concurrent requests are being served by this server, it may so happen that the eventloop on which remove is scheduled, is itself waiting for some other remove to finish. In a convoluted scenario, these two eventloops may actually be waiting for each other hence causing a deadlock.
The text was updated successfully, but these errors were encountered:
ChannelPipeline.remove() is a blocking call when not called from the associated eventloop.
Now, instead of removing the handler from the pipeline, it is deactivated on close and re-activated when the pipeline is used again.
ObservableConnection.cleanupConnection()
removes theReadTimeoutHandler
, if present, from the pipeline to avoid timeouts when the pooled connection is idle.Netty's
ChannelPipeline.remove()
invoked here blocks till completion if invoked from any thread but the eventloop associated with the pipeline in question.The relevant code in netty can be found here
There will be situations in which this can cause a deadlock. Let us consider the following example
In the above example, "/fanout" request will trigger two outbound requests, the responses of which are zipped. The zip operator at the end unsubscribes from both the sources which in turn closes the underlying connection hence causing the
ReadTimeoutHandler
to be removed. Since, this unsubscription will be done from one of the eventloop of the client, one of the two connection close will be on a different eventloop and hence theremove()
ofReadTimeoutHandler
will be submitted to the eventloop and then the code will block for completion. Now, in a scenario where a few concurrent requests are being served by this server, it may so happen that the eventloop on which remove is scheduled, is itself waiting for some other remove to finish. In a convoluted scenario, these two eventloops may actually be waiting for each other hence causing a deadlock.The text was updated successfully, but these errors were encountered: