Tomcat 6.13 using APR, running under jsvc on linux (debian, but tomcat isn't installed via apt-get) 2.6.21 SMP. Sun Java 1.6.0. After tomcat was running for a short while (<15mins), cpu usage on one cpu would go to 100%, as shown by top. Using ps xU tomcat -fL showed that one tomcat thread was using far more cpu than all the others. Cross-referencing the thread id to a thread dump (from kill -3) showed that it was the sendfile thread that was consuming all the cpu time. Tomcat was still responding to requests while this was going on, but obviously the high cpu load was not necessary or helpful. Watching cpu usage via top showed that at times it would return to normal, but never for long. Workaround: I added 'useSendfile="false"' to the http connector, restarted tomcat, and it has now run with normal cpu usage for over 12 hours.
This is a result of AprEndpoint.Sendfile.init calling Poll.create with a timeout parameter but never calling Poll.maintain to deal with the resulting poll descriptor timeouts. My work around was to pass a timeout of -1 to Poll.create.
Created attachment 20930 [details] Proposed patch This patch replaces the TODO with code that calls maintain. I was not aware calling maintain was more or less mandatory.
This was fixed in rev 583650.
*** Bug 44938 has been marked as a duplicate of this bug. ***