Issue #362 (Very slow page load and missing resources when using HTTP/2 with Jetty 9.3.7)
The issue happened when the selector was both read ready and write ready. In that case fillable() was called before completeWrite(), causing the reader thread to read, parse, call the application which performed a blocking write, thus never returning to call completeWrite(). Inverting the calls (first completeWrite() then fillable()) solves the issue because completeWrite() never calls application code.
This commit is contained in:
parent
a8bbe8749f
commit
7e7b126847
|
@ -68,10 +68,10 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements ManagedSel
|
|||
return SelectChannelEndPoint.this.toString()+":runUpdateKey";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private abstract class RejectableRunnable implements Runnable,Rejectable
|
||||
{
|
||||
@Override
|
||||
@Override
|
||||
public void reject()
|
||||
{
|
||||
try
|
||||
|
@ -84,7 +84,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements ManagedSel
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final Runnable _runFillable = new RejectableRunnable()
|
||||
{
|
||||
@Override
|
||||
|
@ -118,8 +118,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements ManagedSel
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
getFillInterest().fillable();
|
||||
getWriteFlusher().completeWrite();
|
||||
getFillInterest().fillable();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -175,7 +175,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements ManagedSel
|
|||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onSelected {}->{} r={} w={} for {}", oldInterestOps, newInterestOps, readable, writable, this);
|
||||
|
||||
|
||||
// Run non-blocking code immediately.
|
||||
// This producer knows that this non-blocking code is special
|
||||
// and that it must be run in this thread and not fed to the
|
||||
|
|
Loading…
Reference in New Issue