You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2014/09/05 12:44:29 UTC
[jira] [Updated] (DIRMINA-942) Infinite loop flushing to broken
pipe
[ https://issues.apache.org/jira/browse/DIRMINA-942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Lecharny updated DIRMINA-942:
--------------------------------------
Fix Version/s: 2.0.8
> Infinite loop flushing to broken pipe
> -------------------------------------
>
> Key: DIRMINA-942
> URL: https://issues.apache.org/jira/browse/DIRMINA-942
> Project: MINA
> Issue Type: Bug
> Affects Versions: 2.0.7
> Reporter: Joshua Warner
> Fix For: 2.0.8
>
>
> Every once in a while (in production only, of course), a couple of threads will go off into the weeds, consuming 100% CPU, and never come back. They're sitting in an infinite loop that looks something like this:
> * We're chugging merrily along in the main processing loop (AbstractPollingIoProcessor.java:1070)
> * Decide to flush the single session in flushingSessions (AbstractPollingIoProcessor.java:773, :1129)
> * According to "SessionState state = getState(session)", the session is OPENED, which I think is a lie, and perhaps the root of the problem.
> * Enter "flushNow" (AbstractPollingIoProcessor.java:821, :789, :1129)
> * Begin processing a queued message (AbstractPollingIoProcessor.java:861, :789, :1129)
> * Try to write out the message in writeBuffer (AbstractPollingIoProcessor.java:931, :861, :789, :1129)
> * Catch an IOException ("Broken pipe") in writeBuffer (AbstractPollingIoProcessor.java:935, :861, :789, :1129), call "session.close(true)"
> * Next time around the loop at (AbstractPollingIoProcessor.java:1070), the session is put back in flushingSessions, because apparently the session is still writable (liar!) (AbstractPollingIoProcessor.java:671, :653, :1124)
> * Repeat, Ad Infinitum!
> The suggested fix, courtesy [~elecharny], is:
> add this line in the AbstractPollingIoProcessor
> class, line 927 :
> {code}
> try {
> localWrittenBytes = write(session, buf, length);
> } catch (IOException ioe) {
> // We have had an issue while trying to send data to the
> // peer : let's close the session.
> buf.free();
> session.close(true);
> destroy(session); // <<<<<<<<<<<<<<<<<---- This line
> return 0;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)