You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Jacek Gerbszt (JIRA)" <ji...@apache.org> on 2007/02/14 14:17:05 UTC
[jira] Created: (DIRMINA-352) races in ExecutorFilter
races in ExecutorFilter
-----------------------
Key: DIRMINA-352
URL: https://issues.apache.org/jira/browse/DIRMINA-352
Project: MINA
Issue Type: Bug
Components: Filter
Affects Versions: 1.1.0
Environment: any
Reporter: Jacek Gerbszt
You've got thread races in ExecutorFilter class. When the thread running ProcessEventRunnable is hanging up between polling the event and updating the processingCompleted flag, another thread has the chance to add new event and evaluate processingCompleted.compareAndSet() method in meantime. Now ProcessEventRunnable thread updates the flag and breaks the loop, but it's too late - no new task is scheduled. Added event stays n the queue waiting for the next event or timeout.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DIRMINA-352) races in ExecutorFilter
Posted by "Jacek Gerbszt (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jacek Gerbszt updated DIRMINA-352:
----------------------------------
Attachment: executorfilter.diff
Attached patch will probably solve the issue.
> races in ExecutorFilter
> -----------------------
>
> Key: DIRMINA-352
> URL: https://issues.apache.org/jira/browse/DIRMINA-352
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.1.0
> Environment: any
> Reporter: Jacek Gerbszt
> Attachments: executorfilter.diff
>
>
> You've got thread races in ExecutorFilter class. When the thread running ProcessEventRunnable is hanging up between polling the event and updating the processingCompleted flag, another thread has the chance to add new event and evaluate processingCompleted.compareAndSet() method in meantime. Now ProcessEventRunnable thread updates the flag and breaks the loop, but it's too late - no new task is scheduled. Added event stays n the queue waiting for the next event or timeout.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DIRMINA-352) races in ExecutorFilter
Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Lecharny closed DIRMINA-352.
-------------------------------------
> races in ExecutorFilter
> -----------------------
>
> Key: DIRMINA-352
> URL: https://issues.apache.org/jira/browse/DIRMINA-352
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.1.0
> Environment: any
> Reporter: Jacek Gerbszt
> Assignee: Trustin Lee
> Attachments: executorfilter.diff
>
>
> You've got thread races in ExecutorFilter class. When the thread running ProcessEventRunnable is hanging up between polling the event and updating the processingCompleted flag, another thread has the chance to add new event and evaluate processingCompleted.compareAndSet() method in meantime. Now ProcessEventRunnable thread updates the flag and breaks the loop, but it's too late - no new task is scheduled. Added event stays n the queue waiting for the next event or timeout.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-352) races in ExecutorFilter
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473292 ]
Trustin Lee commented on DIRMINA-352:
-------------------------------------
Thanks for pointing out the problem. You are right. ExecutorFilter in 1.1 has a race condition.
Before applying the patch, I have a question to you and community. Do we really need AtomicXXXX here? Does it really guarantee better performance with ConcurrentLinkedQueue?
Please compare the ExecutorFilter in trunk (2.0.0-M1-SNAPSHOT):
http://mina.apache.org/report/trunk/xref/org/apache/mina/filter/executor/ExecutorFilter.html
I found just a simple synchronized block outperforms ConcurrentLinkedQueue + AtomicXXXX during my performance test. The performance difference was not that big, but it was obvious.
If this is true for other people's tests, we could just revert the ExecutorFilter implementation in 1.1 to use synchronized blocks. Any ideas or test results are welcome.
> races in ExecutorFilter
> -----------------------
>
> Key: DIRMINA-352
> URL: https://issues.apache.org/jira/browse/DIRMINA-352
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.1.0
> Environment: any
> Reporter: Jacek Gerbszt
> Attachments: executorfilter.diff
>
>
> You've got thread races in ExecutorFilter class. When the thread running ProcessEventRunnable is hanging up between polling the event and updating the processingCompleted flag, another thread has the chance to add new event and evaluate processingCompleted.compareAndSet() method in meantime. Now ProcessEventRunnable thread updates the flag and breaks the loop, but it's too late - no new task is scheduled. Added event stays n the queue waiting for the next event or timeout.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-352) races in ExecutorFilter
Posted by "peter royal (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474349 ]
peter royal commented on DIRMINA-352:
-------------------------------------
The Synchronized approach looks like it might be best here, simpler to read.
> races in ExecutorFilter
> -----------------------
>
> Key: DIRMINA-352
> URL: https://issues.apache.org/jira/browse/DIRMINA-352
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.1.0
> Environment: any
> Reporter: Jacek Gerbszt
> Attachments: executorfilter.diff
>
>
> You've got thread races in ExecutorFilter class. When the thread running ProcessEventRunnable is hanging up between polling the event and updating the processingCompleted flag, another thread has the chance to add new event and evaluate processingCompleted.compareAndSet() method in meantime. Now ProcessEventRunnable thread updates the flag and breaks the loop, but it's too late - no new task is scheduled. Added event stays n the queue waiting for the next event or timeout.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (DIRMINA-352) races in ExecutorFilter
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trustin Lee resolved DIRMINA-352.
---------------------------------
Resolution: Fixed
Assignee: Trustin Lee
I reverted back to the 'synchronized' version, which yields better performance, and therefore, no more race condition.
> races in ExecutorFilter
> -----------------------
>
> Key: DIRMINA-352
> URL: https://issues.apache.org/jira/browse/DIRMINA-352
> Project: MINA
> Issue Type: Bug
> Components: Filter
> Affects Versions: 1.1.0
> Environment: any
> Reporter: Jacek Gerbszt
> Assigned To: Trustin Lee
> Attachments: executorfilter.diff
>
>
> You've got thread races in ExecutorFilter class. When the thread running ProcessEventRunnable is hanging up between polling the event and updating the processingCompleted flag, another thread has the chance to add new event and evaluate processingCompleted.compareAndSet() method in meantime. Now ProcessEventRunnable thread updates the flag and breaks the loop, but it's too late - no new task is scheduled. Added event stays n the queue waiting for the next event or timeout.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.