Bug 49095 - org.apache.tomcat.util.net.AprEndpoint.unlockAccept does not wakeup accepts with deferred accept or BSD filters
org.apache.tomcat.util.net.AprEndpoint.unlockAccept does not wakeup accepts w...
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Connectors
6.0.26
All All
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-04-12 08:16 UTC by Ruediger Pluem
Modified: 2010-06-07 01:11 UTC (History)
0 users



Attachments
Patch to fix issue (1.87 KB, patch)
2010-04-12 08:16 UTC, Ruediger Pluem
Details | Diff
2010-06-02_tc6_bug49095.patch (2.11 KB, patch)
2010-06-02 14:11 UTC, Konstantin Kolinko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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)