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
// TODO : Daniel : Review : Why is this number so much higher than the worker count when using persistent connections?
111
+
// When using RESTIFY - we kill a lot of connections because read returns -1 while waiting for preamble.
112
+
// This causes us to close a lot of workers. When using the JDK REST client this doesn't happen.
113
+
// I don't know if this is just working as designed for HTTPURLConnection, or if it is related to
114
+
// the read ahead we are doing.
115
+
// Show Brian to see if he has any ideas.
110
116
if (instrumenter != null) {
111
117
instrumenter.acceptedConnection();
112
118
}
@@ -187,8 +193,18 @@ public void run() {
187
193
ClientInfoclient = iterator.next();
188
194
Threadthread = client.thread();
189
195
longthreadId = thread.threadId();
190
-
if (!thread.isAlive()) {
191
-
logger.trace("[{}] Remove dead client worker. Born [{}]. Died at age [{}] ms. Requests handled [{}].", threadId, client.getStartInstant(), client.getAge(), client.getHandledRequests());
196
+
booleanthreadIsAlive = thread.isAlive();
197
+
varthreadState = thread.getState();
198
+
if (threadState == Thread.State.TERMINATED) {
199
+
if (threadIsAlive) {
200
+
System.out.println("[" + threadId + "] is alive in state [" + threadState + "]");
201
+
}
202
+
} elseif (!threadIsAlive) {
203
+
System.out.println("[" + threadId + "] is dead in state [" + threadState + "]");
204
+
}
205
+
206
+
if (!threadIsAlive) {
207
+
logger.debug("[{}] Remove dead client worker. Thread state [{}] Born [{}]. Died at age [{}] ms. Requests handled [{}].", threadId, threadState, client.getStartInstant(), client.getAge(), client.getHandledRequests());
logger.info("[{}] Closing socket with status [{}]. Bad request, failed to parse request. Reason [{}] Parser state [{}]", Thread.currentThread().threadId(), Status.BadRequest, pe.getMessage(), pe.getState());
238
+
} catch (ParseExceptione) {
239
+
logger.debug("[{}] Closing socket with status [{}]. Bad request, failed to parse request. Reason [{}] Parser state [{}]", Thread.currentThread().threadId(), Status.BadRequest, e.getMessage(), e.getState());
240
240
closeSocketOnError(response, Status.BadRequest);
241
241
} catch (SocketExceptione) {
242
242
// This should only happen when the server is shutdown and this thread is waiting to read or write. In that case, this will throw a
@@ -246,13 +246,13 @@ public void run() {
246
246
logger.debug("[{}] Closing socket. Server is shutting down.", Thread.currentThread().threadId());
247
247
closeSocketOnly(CloseSocketReason.Expected);
248
248
}
249
-
} catch (IOExceptionio) {
250
-
logger.debug(String.format("[%s] Closing socket with status [%d]. An IO exception was thrown during processing. These are pretty common.", Thread.currentThread().threadId(), Status.InternalServerError), io);
249
+
} catch (IOExceptione) {
250
+
logger.debug(String.format("[%s] Closing socket with status [%d]. An IO exception was thrown during processing. These are pretty common.", Thread.currentThread().threadId(), Status.InternalServerError), e);
logger.error(String.format("[%s] Closing socket with status [%d]. An HTTP worker threw an exception while processing a request.", Thread.currentThread().threadId(), status), t);
255
+
logger.error(String.format("[%s] Closing socket with status [%d]. An HTTP worker threw an exception while processing a request.", Thread.currentThread().threadId(), status), e);
0 commit comments