8169358: httpserver does not close connections when RejectedExecutionException occurs

Catch unexpected exceptions in Dispatcher::handle

Reviewed-by: chegar, dfuchs, clanger
This commit is contained in:
KUBOTA Yuji 2018-03-08 11:21:57 +09:00 committed by KUBOTA Yuji
parent c866d037bc
commit 605827c671
2 changed files with 111 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -395,7 +395,6 @@ class ServerImpl implements TimeSource {
} else {
try {
if (key.isReadable()) {
boolean closed;
SocketChannel chan = (SocketChannel)key.channel();
HttpConnection conn = (HttpConnection)key.attachment();
@ -437,7 +436,6 @@ class ServerImpl implements TimeSource {
}
public void handle (SocketChannel chan, HttpConnection conn)
throws IOException
{
try {
Exchange t = new Exchange (chan, protocol, conn);
@ -448,6 +446,9 @@ class ServerImpl implements TimeSource {
} catch (IOException e) {
logger.log (Level.TRACE, "Dispatcher (5)", e);
closeConnection(conn);
} catch (Throwable e) {
logger.log (Level.TRACE, "Dispatcher (6)", e);
closeConnection(conn);
}
}
}