mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stuart Scott (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DIRMINA-803) ProtocolCodecFilter.filterWrite() is no longer thread-safe
Date Mon, 18 Oct 2010 10:52:23 GMT

     [ https://issues.apache.org/jira/browse/DIRMINA-803?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Stuart Scott updated DIRMINA-803:
---------------------------------

    Description: 
In revision 'r912149 | elecharny | 2010-02-20 22:04:32 +0500 (Sat, 20 Feb 2010)' the loop
that flushes the encoded messages was modified and is no longer thread-safe. In the trunk
the queue is checked if it is empty then polled for the next element. Between these calls
another thread could have taken the last element in the queue and the element is not checked
if it is null.

Starting at line 328:

while (!bufferQueue.isEmpty()) {
    Object encodedMessage = bufferQueue.poll();
...

could be replaced with the previous loop:

for (;;) {
    Object encodedMessage = bufferQueue.poll();
    if (encodedMessage == null) {
        break;
    }
...

to make the method thread-safe again.

The same issue exists in ProtocolEncoderOutputImpl.flush().

  was:
In revision 'r912149 | elecharny | 2010-02-20 22:04:32 +0500 (Sat, 20 Feb 2010)' the loop
that flushes the encoded messages was modified and is no longer thread-safe. In the trunk
the queue is checked if it is empty then polled for the next element. Between these calls
another thread could have taken the last element in the queue and the element is not checked
if it is null.

Starting at line 328:

while (!bufferQueue.isEmpty()) {
    Object encodedMessage = bufferQueue.poll();
...

could be replaced with the previous loop:

for (;;) {
    Object encodedMessage = bufferQueue.poll();
    if (encodedMessage == null) {
        break;
    }
...

to make the method thread-safe again.


> ProtocolCodecFilter.filterWrite() is no longer thread-safe
> ----------------------------------------------------------
>
>                 Key: DIRMINA-803
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-803
>             Project: MINA
>          Issue Type: Bug
>          Components: Filter
>    Affects Versions: 2.0.0
>            Reporter: Stuart Scott
>
> In revision 'r912149 | elecharny | 2010-02-20 22:04:32 +0500 (Sat, 20 Feb 2010)' the
loop that flushes the encoded messages was modified and is no longer thread-safe. In the trunk
the queue is checked if it is empty then polled for the next element. Between these calls
another thread could have taken the last element in the queue and the element is not checked
if it is null.
> Starting at line 328:
> while (!bufferQueue.isEmpty()) {
>     Object encodedMessage = bufferQueue.poll();
> ...
> could be replaced with the previous loop:
> for (;;) {
>     Object encodedMessage = bufferQueue.poll();
>     if (encodedMessage == null) {
>         break;
>     }
> ...
> to make the method thread-safe again.
> The same issue exists in ProtocolEncoderOutputImpl.flush().

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message