Skip to content

Commit

Permalink
UNDERTOW-791 Potential stack overflow with websockets when worker is …
Browse files Browse the repository at this point in the history
…shut down
  • Loading branch information
stuartwdouglas committed Jan 29, 2017
1 parent f1dba84 commit e774426
Showing 1 changed file with 12 additions and 10 deletions.
Expand Up @@ -941,6 +941,18 @@ private class FrameCloseListener implements ChannelListener<CloseableChannel> {

@Override
public void handleEvent(final CloseableChannel c) {

if (Thread.currentThread() != c.getIoThread() && !c.getWorker().isShutdown()) {
runInIoThread(new Runnable() {
@Override
public void run() {
ChannelListeners.invokeChannelListener(c, FrameCloseListener.this);
}
});
return;
}


if(c instanceof StreamSinkChannel) {
sinkClosed = true;
} else if(c instanceof StreamSourceChannel) {
Expand Down Expand Up @@ -973,16 +985,6 @@ public void run() {

return;
}

if (Thread.currentThread() != c.getIoThread()) {
runInIoThread(new Runnable() {
@Override
public void run() {
ChannelListeners.invokeChannelListener(c, FrameCloseListener.this);
}
});
return;
}
R receiver = AbstractFramedChannel.this.receiver;
try {
if (receiver != null && receiver.isOpen() && receiver.isReadResumed()) {
Expand Down

0 comments on commit e774426

Please sign in to comment.