Bug 49095

Summary: org.apache.tomcat.util.net.AprEndpoint.unlockAccept does not wakeup accepts with deferred accept or BSD filters
Product: Tomcat 6 Reporter: Ruediger Pluem <rpluem>
Component: ConnectorsAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 6.0.26   
Target Milestone: default   
Hardware: All   
OS: All   
Attachments: Patch to fix issue
2010-06-02_tc6_bug49095.patch

Description Ruediger Pluem 2010-04-12 08:16:23 UTC
Created attachment 25266 [details]
Patch to fix issue

org.apache.tomcat.util.net.AprEndpoint.unlockAccept does not wakeup accepts with deferred accept or BSD filters. This is because it only connects to its connector for causing the accept call to return. This is not enough in the case of a deferred accept / BSD filters as the accept call only returns from the kernel if data was sent / a HTTP request was sent. The attached patch fixes that by sending and OPTIONS * in this case.
Comment 1 Mark Thomas 2010-05-25 09:56:53 UTC
Fixed in trunk and proposed for 6.0.x.
Thanks for the patch.
Comment 2 Konstantin Kolinko 2010-06-02 14:11:48 UTC
Created attachment 25510 [details]
2010-06-02_tc6_bug49095.patch

Updated the tc6.0.x patch to explicitly specify the encoding used by the Writer. That is r950682 of trunk.
Comment 3 Konstantin Kolinko 2010-06-07 01:11:05 UTC
Fixed in 6.0 in r952090 and will be in 6.0.27 onwards.



Note, that all the affected lines are guarded by if(deferAccept) clauses.
It is easy to remove that clause and extend this implementation of unlockAccept() that sends a valid "OPTIONS" request upon other connector implementations. Is it worth doing?


Regarding the 'BSD filters': apparently the documentation on them is here: [1], [2]

[1] http://www.freebsd.org/cgi/man.cgi?query=accept_filter&sektion=9
[2] http://www.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2  (see SO_ACCEPTFILTER)