Author: markt Date: Thu Jul 28 17:12:42 2011 New Revision: 1151930 URL: http://svn.apache.org/viewvc?rev=1151930&view=rev Log: Improve error handling for APR connector if sendfile fails
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1151930&r1=1151929&r2=1151930&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Jul 28 17:12:42 2011 @@ -1448,6 +1448,13 @@ public class AprEndpoint extends Abstrac // Initialize fd from data given try { data.fdpool = Socket.pool(data.socket); + } catch (Exception e) { + // Pool not created so no need to destroy it. + log.error(sm.getString("endpoint.sendfile.error"), e); + data.socket = 0; + return false; + } + try { data.fd = File.open (data.fileName, File.APR_FOPEN_READ | File.APR_FOPEN_SENDFILE_ENABLED | File.APR_FOPEN_BINARY, @@ -1482,6 +1489,8 @@ public class AprEndpoint extends Abstrac } } catch (Exception e) { log.error(sm.getString("endpoint.sendfile.error"), e); + Pool.destroy(data.fdpool); + data.socket = 0; return false; } // Add socket to the list. Newly added sockets will wait Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1151930&r1=1151929&r2=1151930&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu Jul 28 17:12:42 2011 @@ -120,6 +120,10 @@ <bug>51557</bug>: Ignore HTTP headers that do not comply with RFC 2616 and use header names that are not tokens. (markt) </fix> + <add> + Improve error handling for HTTP APR if an error occurs while using + sendfile. (markt) + </add> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org