ASF Bugzilla – Attachment 24827 Details for
Bug 48470
Tomcat hangs while stoppping
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
bug48470.patch (text/plain), 6.37 KB, created by
Mark Thomas
on 2010-01-11 08:10:35 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Mark Thomas
Created:
2010-01-11 08:10:35 UTC
Size:
6.37 KB
patch
obsolete
>Index: java/org/apache/coyote/http11/Http11AprProtocol.java >=================================================================== >--- java/org/apache/coyote/http11/Http11AprProtocol.java (revision 897610) >+++ java/org/apache/coyote/http11/Http11AprProtocol.java (working copy) >@@ -226,6 +226,11 @@ > public int getSoTimeout() { return endpoint.getSoTimeout(); } > public void setSoTimeout(int soTimeout) { endpoint.setSoTimeout(soTimeout); } > >+ public int getUnlockTimeout() { return endpoint.getUnlockTimeout(); } >+ public void setUnlockTimeout(int unlockTimeout) { >+ endpoint.setUnlockTimeout(unlockTimeout); >+ } >+ > /** > * The number of seconds Tomcat will wait for a subsequent request > * before closing the connection. >Index: java/org/apache/coyote/http11/Http11Protocol.java >=================================================================== >--- java/org/apache/coyote/http11/Http11Protocol.java (revision 897610) >+++ java/org/apache/coyote/http11/Http11Protocol.java (working copy) >@@ -426,6 +426,11 @@ > public int getSoTimeout() { return endpoint.getSoTimeout(); } > public void setSoTimeout(int soTimeout) { endpoint.setSoTimeout(soTimeout); } > >+ public int getUnlockTimeout() { return endpoint.getUnlockTimeout(); } >+ public void setUnlockTimeout(int unlockTimeout) { >+ endpoint.setUnlockTimeout(unlockTimeout); >+ } >+ > // HTTP > /** > * Return the Keep-Alive policy for the connection. >Index: java/org/apache/tomcat/util/net/AprEndpoint.java >=================================================================== >--- java/org/apache/tomcat/util/net/AprEndpoint.java (revision 897610) >+++ java/org/apache/tomcat/util/net/AprEndpoint.java (working copy) >@@ -18,6 +18,7 @@ > package org.apache.tomcat.util.net; > > import java.net.InetAddress; >+import java.net.InetSocketAddress; > import java.util.ArrayList; > import java.util.HashMap; > import java.util.concurrent.Executor; >@@ -399,6 +400,16 @@ > > > /** >+ * Unlock timeout. >+ */ >+ protected int unlockTimeout = 250; >+ public int getUnlockTimeout() { return unlockTimeout; } >+ public void setUnlockTimeout(int unlockTimeout) { >+ this.unlockTimeout = unlockTimeout; >+ } >+ >+ >+ /** > * SSL engine. > */ > protected boolean SSLEnabled = false; >@@ -880,16 +891,21 @@ > */ > protected void unlockAccept() { > java.net.Socket s = null; >+ InetSocketAddress saddr = null; > try { > // Need to create a connection to unlock the accept(); > if (address == null) { >- s = new java.net.Socket(InetAddress.getByName("localhost").getHostAddress(), port); >+ saddr = new InetSocketAddress("localhost", port); > } else { >- s = new java.net.Socket(address, port); >- // setting soLinger to a small value will help shutdown the >- // connection quicker >- s.setSoLinger(true, 0); >+ saddr = new InetSocketAddress(address,port); > } >+ s = new java.net.Socket(); >+ s.setSoTimeout(soTimeout); >+ s.setSoLinger(true ,0); >+ if (log.isDebugEnabled()) { >+ log.debug("About to unlock socket for: " + saddr); >+ } >+ s.connect(saddr, unlockTimeout); > } catch(Exception e) { > if (log.isDebugEnabled()) { > log.debug(sm.getString("endpoint.debug.unlock", "" + port), e); >Index: java/org/apache/tomcat/util/net/JIoEndpoint.java >=================================================================== >--- java/org/apache/tomcat/util/net/JIoEndpoint.java (revision 897610) >+++ java/org/apache/tomcat/util/net/JIoEndpoint.java (working copy) >@@ -20,6 +20,7 @@ > import java.io.IOException; > import java.net.BindException; > import java.net.InetAddress; >+import java.net.InetSocketAddress; > import java.net.ServerSocket; > import java.net.Socket; > import java.util.concurrent.Executor; >@@ -261,6 +262,16 @@ > public ServerSocketFactory getServerSocketFactory() { return serverSocketFactory; } > > >+ /** >+ * Unlock timeout. >+ */ >+ protected int unlockTimeout = 250; >+ public int getUnlockTimeout() { return unlockTimeout; } >+ public void setUnlockTimeout(int unlockTimeout) { >+ this.unlockTimeout = unlockTimeout; >+ } >+ >+ > public boolean isRunning() { > return running; > } >@@ -617,16 +628,24 @@ > */ > protected void unlockAccept() { > Socket s = null; >+ InetSocketAddress saddr = null; > try { > // Need to create a connection to unlock the accept(); > if (address == null) { >- s = new Socket(InetAddress.getByName("localhost").getHostAddress(), port); >+ saddr = new InetSocketAddress("localhost", port); > } else { >- s = new Socket(address, port); >- // setting soLinger to a small value will help shutdown the >- // connection quicker >- s.setSoLinger(true, 0); >+ saddr = new InetSocketAddress(address,port); > } >+ s = new java.net.Socket(); >+ s.setSoTimeout(soTimeout); >+ s.setSoLinger(true ,0); >+ if (log.isDebugEnabled()) { >+ log.debug("About to unlock socket for: " + saddr); >+ } >+ s.connect(saddr, unlockTimeout); >+ if (log.isDebugEnabled()) { >+ log.debug("Socket unlock completed for:"+saddr); >+ } > } catch (Exception e) { > if (log.isDebugEnabled()) { > log.debug(sm.getString("endpoint.debug.unlock", "" + port), e); >Index: java/org/apache/tomcat/util/net/NioEndpoint.java >=================================================================== >--- java/org/apache/tomcat/util/net/NioEndpoint.java (revision 897610) >+++ java/org/apache/tomcat/util/net/NioEndpoint.java (working copy) >@@ -1048,7 +1048,7 @@ > try { > // Need to create a connection to unlock the accept(); > if (address == null) { >- saddr = new InetSocketAddress("127.0.0.1", port); >+ saddr = new InetSocketAddress("localhost", port); > } else { > saddr = new InetSocketAddress(address,port); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 48470
: 24827