Hi, all

Running jira 5 webapp on jetty 8.1.11 we repeatably find a lot of threads
stuck
in org.eclipse.jetty.io.nio.SelectChannelEndPoint.blockWritable :

"qtp1428677636-2594" prio=10 tid=0x00007fc0e409a000 nid=0x226 in
Object.wait() [0x00007fc0b7ffa000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.blockWritable(SelectChannelEndPoint.java:495)
        - locked <0x000000009a185548> (a
org.eclipse.jetty.io.nio.SelectChannelEndPoint)
        at
org.eclipse.jetty.http.AbstractGenerator.blockForOutput(AbstractGenerator.java:517)
        at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:170)
        at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:107)
        at
java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:253)
        at
java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:211)
        at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:146)
        - locked <0x000000009a190c30> (a java.util.zip.GZIPOutputStream)
        at
com.atlassian.gzipfilter.GzipResponseStream.write(GzipResponseStream.java:49)
        at
com.atlassian.gzipfilter.RoutableServletOutputStream.write(RoutableServletOutputStream.java:118)
        at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1026)

After reading through SelectChannelEndPoint.blockWritable source,
I think that this block of code (lines 490-508) have 2 problems:
...
                while (_writeBlocked && !isOutputShutdown())
                {
                    try
                    {
                        updateKey();
                        this.wait(timeoutMs>0?(end-now):10000);
                    }
                    catch (InterruptedException e)
                    {
                        LOG.warn(e);
                    }
                    finally
                    {
                        now=_selectSet.getNow();
                    }
                    if (_writeBlocked && timeoutMs>0 && now>=end)
                        return false;
                }
...

Problem 1: InterruptedException is just logged, but not re-throwed with
Thread.currentThread().interrupt();

Problem 2: if timeoutMs == 0, while loop in endless, even in thread is
interrupted due to problem 1

Bugzilla issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=401736 have no
discussion of this
possible causes of bug.

As a workaround we restart jetty once a week.

-- 
Best regards,
    Igor Poteryaev
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to