Issue #4411 - Jetty server spins on incomplete request.

Updated FastCGI code to pass the test.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2019-12-11 13:02:23 +01:00
parent 6bbec7f3b0
commit 8e875ab7a4
3 changed files with 16 additions and 4 deletions

View File

@ -125,6 +125,14 @@ public class HttpChannelOverFCGI extends HttpChannel
dispatcher.dispatch();
}
public boolean onIdleTimeout(Throwable timeout)
{
boolean handle = getRequest().getHttpInput().onIdleTimeout(timeout);
if (handle)
execute(this);
return !handle;
}
private static class Dispatcher implements Runnable
{
private final AtomicReference<State> state = new AtomicReference<>(State.IDLE);

View File

@ -105,6 +105,14 @@ public class ServerFCGIConnection extends AbstractConnection
}
}
@Override
protected boolean onReadTimeout(Throwable timeout)
{
return channels.values().stream()
.mapToInt(channel -> channel.onIdleTimeout(timeout) ? 0 : 1)
.sum() == 0;
}
private void parse(ByteBuffer buffer)
{
while (buffer.hasRemaining())

View File

@ -66,7 +66,6 @@ import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.IO;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@ -1273,9 +1272,6 @@ public class HttpClientStreamTest extends AbstractTest<TransportScenario>
@ArgumentsSource(TransportProvider.class)
public void testClientDefersContentServerIdleTimeout(Transport transport) throws Exception
{
// TODO: fix FCGI that is failing this test.
Assumptions.assumeTrue(transport != Transport.FCGI);
init(transport);
CountDownLatch dataLatch = new CountDownLatch(1);
CountDownLatch errorLatch = new CountDownLatch(1);