--- java/org/apache/catalina/connector/CoyoteAdapter.java (revision 1149270) +++ java/org/apache/catalina/connector/CoyoteAdapter.java (working copy) @@ -318,8 +318,6 @@ } catch (IOException e) { ; - } catch (Throwable t) { - log.error(sm.getString("coyoteAdapter.service"), t); } finally { req.getRequestProcessor().setWorkerThreadName(null); // Recycle the wrapper request and response --- java/org/apache/catalina/connector/LocalStrings.properties (revision 1149270) +++ java/org/apache/catalina/connector/LocalStrings.properties (working copy) @@ -34,7 +34,6 @@ # # CoyoteAdapter # -coyoteAdapter.service=An exception or error occurred in the container during the request processing coyoteAdapter.read=The servlet did not read all available bytes during the processing of the read event coyoteAdapter.parseSession=Unable to parse the session ID using encoding [{0}]. The session ID in the URL will be ignored. coyoteAdapter.parsePathParam=Unable to parse the path parameters using encoding [{0}]. The path parameters in the URL will be ignored. --- java/org/apache/catalina/connector/LocalStrings_es.properties (revision 1149270) +++ java/org/apache/catalina/connector/LocalStrings_es.properties (working copy) @@ -29,7 +29,6 @@ coyoteConnector.protocolUnregistrationFailed = Ha fallado la parada del manejador de protocolo # # CoyoteAdapter -coyoteAdapter.service = Ha tenido lugar una excepci\u00F3n o error en el contenedor durante el procesamiento del requerimiento coyoteAdapter.read = El servlet no ley\u00F3 todos los bytes disponibles durante el procesamiento del evento de lectura # # CoyoteResponse --- java/org/apache/catalina/connector/LocalStrings_fr.properties (revision 1149270) +++ java/org/apache/catalina/connector/LocalStrings_fr.properties (working copy) @@ -31,12 +31,6 @@ coyoteConnector.protocolHandlerResumeFailed=Le red\u00e9marrage du gestionnaire de protocole a \u00e9chou\u00e9 # -# CoyoteAdapter -# - -coyoteAdapter.service=Une exception ou une erreur s''est produite dans le conteneur durant le traitement de la requ\u00eate - -# # CoyoteResponse # --- java/org/apache/catalina/connector/LocalStrings_ja.properties (revision 1149270) +++ java/org/apache/catalina/connector/LocalStrings_ja.properties (working copy) @@ -31,12 +31,6 @@ coyoteConnector.protocolHandlerResumeFailed=\u30d7\u30ed\u30c8\u30b3\u30eb\u30cf\u30f3\u30c9\u30e9\u306e\u518d\u958b\u306b\u5931\u6557\u3057\u307e\u3057\u305f # -# CoyoteAdapter -# - -coyoteAdapter.service=\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u51e6\u7406\u4e2d\u306b\u30b3\u30cd\u30af\u30bf\u3067\u4f8b\u5916\u307e\u305f\u306f\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f - -# # CoyoteResponse # --- java/org/apache/coyote/http11/Http11NioProtocol.java (revision 1149270) +++ java/org/apache/coyote/http11/Http11NioProtocol.java (working copy) @@ -746,13 +746,7 @@ // In the middle of processing a request/response. Keep the // socket associated with the processor. connections.put(socket, processor); - - if (processor.comet) { - NioEndpoint.KeyAttachment att = (NioEndpoint.KeyAttachment)socket.getAttachment(false); - socket.getPoller().add(socket,att.getCometOps()); - } else { - socket.getPoller().add(socket); - } + socket.getPoller().add(socket); } else if (state == SocketState.OPEN) { // In keep-alive but between requests. OK to recycle // processor. Continue to poll for the next request. --- java/org/apache/jk/server/JkCoyoteHandler.java (revision 1149270) +++ java/org/apache/jk/server/JkCoyoteHandler.java (working copy) @@ -189,6 +189,7 @@ try { adapter.service( req, res ); } catch( Exception ex ) { + ep.setStatus(MsgContext.JK_STATUS_ERROR); log.info("Error servicing request " + req,ex); } if(ep.getStatus() != MsgContext.JK_STATUS_CLOSED) { --- java/org/apache/tomcat/util/net/NioEndpoint.java (revision 1149270) +++ java/org/apache/tomcat/util/net/NioEndpoint.java (working copy) @@ -2251,83 +2251,85 @@ } public void run() { - NioEndpoint.this.activeSocketProcessors.addAndGet(1); - SelectionKey key = null; - try { - key = socket.getIOChannel().keyFor(socket.getPoller().getSelector()); - int handshake = -1; - + synchronized (socket) { + NioEndpoint.this.activeSocketProcessors.addAndGet(1); + SelectionKey key = null; try { - if (key!=null) handshake = socket.handshake(key.isReadable(), key.isWritable()); - }catch ( IOException x ) { - handshake = -1; - if ( log.isDebugEnabled() ) log.debug("Error during SSL handshake",x); - }catch ( CancelledKeyException ckx ) { - handshake = -1; - } - if ( handshake == 0 ) { - // Process the request from this socket - boolean closed = (status==null)?(handler.process(socket)==Handler.SocketState.CLOSED) : - (handler.event(socket,status)==Handler.SocketState.CLOSED); - - if (closed) { - // Close socket and pool - try { - KeyAttachment ka = null; - if (key!=null) { - ka = (KeyAttachment) key.attachment(); - if (ka!=null) ka.setComet(false); - socket.getPoller().cancelledKey(key, SocketStatus.ERROR, false); + key = socket.getIOChannel().keyFor(socket.getPoller().getSelector()); + int handshake = -1; + + try { + if (key!=null) handshake = socket.handshake(key.isReadable(), key.isWritable()); + }catch ( IOException x ) { + handshake = -1; + if ( log.isDebugEnabled() ) log.debug("Error during SSL handshake",x); + }catch ( CancelledKeyException ckx ) { + handshake = -1; + } + if ( handshake == 0 ) { + // Process the request from this socket + boolean closed = (status==null)?(handler.process(socket)==Handler.SocketState.CLOSED) : + (handler.event(socket,status)==Handler.SocketState.CLOSED); + + if (closed) { + // Close socket and pool + try { + KeyAttachment ka = null; + if (key!=null) { + ka = (KeyAttachment) key.attachment(); + if (ka!=null) ka.setComet(false); + socket.getPoller().cancelledKey(key, SocketStatus.ERROR, false); + } + if (socket!=null) nioChannels.offer(socket); + socket = null; + if ( ka!=null ) keyCache.offer(ka); + ka = null; + }catch ( Exception x ) { + log.error("",x); } - if (socket!=null) nioChannels.offer(socket); - socket = null; - if ( ka!=null ) keyCache.offer(ka); - ka = null; - }catch ( Exception x ) { - log.error("",x); + } + } else if (handshake == -1 ) { + KeyAttachment ka = null; + if (key!=null) { + ka = (KeyAttachment) key.attachment(); + socket.getPoller().cancelledKey(key, SocketStatus.DISCONNECT, false); } - } - } else if (handshake == -1 ) { - KeyAttachment ka = null; - if (key!=null) { - ka = (KeyAttachment) key.attachment(); - socket.getPoller().cancelledKey(key, SocketStatus.DISCONNECT, false); + if (socket!=null) nioChannels.offer(socket); + socket = null; + if ( ka!=null ) keyCache.offer(ka); + ka = null; + } else { + final SelectionKey fk = key; + final int intops = handshake; + final KeyAttachment ka = (KeyAttachment)fk.attachment(); + ka.getPoller().add(socket,intops); } - if (socket!=null) nioChannels.offer(socket); + }catch(CancelledKeyException cx) { + socket.getPoller().cancelledKey(key,null,false); + } catch (OutOfMemoryError oom) { + try { + oomParachuteData = null; + socket.getPoller().cancelledKey(key,SocketStatus.ERROR,false); + releaseCaches(); + log.error("", oom); + }catch ( Throwable oomt ) { + try { + System.err.println(oomParachuteMsg); + oomt.printStackTrace(); + }catch (Throwable letsHopeWeDontGetHere){} + } + }catch ( Throwable t ) { + log.error("",t); + socket.getPoller().cancelledKey(key,SocketStatus.ERROR,false); + } finally { socket = null; - if ( ka!=null ) keyCache.offer(ka); - ka = null; - } else { - final SelectionKey fk = key; - final int intops = handshake; - final KeyAttachment ka = (KeyAttachment)fk.attachment(); - ka.getPoller().add(socket,intops); + status = null; + //return to cache + processorCache.offer(this); + NioEndpoint.this.activeSocketProcessors.addAndGet(-1); } - }catch(CancelledKeyException cx) { - socket.getPoller().cancelledKey(key,null,false); - } catch (OutOfMemoryError oom) { - try { - oomParachuteData = null; - socket.getPoller().cancelledKey(key,SocketStatus.ERROR,false); - releaseCaches(); - log.error("", oom); - }catch ( Throwable oomt ) { - try { - System.err.println(oomParachuteMsg); - oomt.printStackTrace(); - }catch (Throwable letsHopeWeDontGetHere){} - } - }catch ( Throwable t ) { - log.error("",t); - socket.getPoller().cancelledKey(key,SocketStatus.ERROR,false); - } finally { - socket = null; - status = null; - //return to cache - processorCache.offer(this); - NioEndpoint.this.activeSocketProcessors.addAndGet(-1); } + } } - } // ---------------------------------------------- TaskQueue Inner Class