You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "im-james (JIRA)" <ji...@apache.org> on 2007/07/28 13:37:54 UTC
[jira] Created: (DIRMINA-410) DefaultIoFilterChainBuilder
synchronization issue with contains(...) methods
DefaultIoFilterChainBuilder synchronization issue with contains(...) methods
----------------------------------------------------------------------------
Key: DIRMINA-410
URL: https://issues.apache.org/jira/browse/DIRMINA-410
Project: MINA
Issue Type: Bug
Affects Versions: 1.1.1, 2.0.0-M1
Reporter: im-james
Fix For: 1.1.2, 2.0.0-M1
In org.apache.mina.common.DefaultIoFilterChainBuilder, most public methods are synchronized to guard the variables "entries" and "entriesByName".
However, 2 methods are not synchronized and I believe that they should be synchronized.
I'm talking about these 2:
public boolean contains(IoFilter filter) {...}
public boolean contains(Class<? extends IoFilter> filterType) {...}
it should be:
public synchronized boolean contains(IoFilter filter) {...}
public synchronized boolean contains(Class<? extends IoFilter> filterType) {...}
The version on the trunk is different but I've got the impression that there is another type of bug:
I've noticed that the variable "entries" is initialized with a "new CopyOnWriteArrayList<Entry>()". However, the clear() method put a regular "new ArrayList<Entry>()" into it. This is probably not what is intended.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DIRMINA-410) DefaultIoFilterChainBuilder
synchronization issue with contains(...) methods
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trustin Lee updated DIRMINA-410:
--------------------------------
Fix Version/s: (was: 2.0.0-M1)
1.0.5
Assignee: Trustin Lee
Affects Version/s: (was: 2.0.0-M1)
1.0.0
1.0.1
1.0.2
1.0.3
1.1.0
1.0.4
> DefaultIoFilterChainBuilder synchronization issue with contains(...) methods
> ----------------------------------------------------------------------------
>
> Key: DIRMINA-410
> URL: https://issues.apache.org/jira/browse/DIRMINA-410
> Project: MINA
> Issue Type: Bug
> Affects Versions: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.0.4, 1.1.1
> Reporter: im-james
> Assignee: Trustin Lee
> Fix For: 1.0.5, 1.1.2
>
>
> In org.apache.mina.common.DefaultIoFilterChainBuilder, most public methods are synchronized to guard the variables "entries" and "entriesByName".
> However, 2 methods are not synchronized and I believe that they should be synchronized.
> I'm talking about these 2:
> public boolean contains(IoFilter filter) {...}
> public boolean contains(Class<? extends IoFilter> filterType) {...}
> it should be:
> public synchronized boolean contains(IoFilter filter) {...}
> public synchronized boolean contains(Class<? extends IoFilter> filterType) {...}
> The version on the trunk is different but I've got the impression that there is another type of bug:
> I've noticed that the variable "entries" is initialized with a "new CopyOnWriteArrayList<Entry>()". However, the clear() method put a regular "new ArrayList<Entry>()" into it. This is probably not what is intended.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (DIRMINA-410) DefaultIoFilterChainBuilder
synchronization issue with contains(...) methods
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trustin Lee resolved DIRMINA-410.
---------------------------------
Resolution: Fixed
I made the following changes to simplify DefaultIoFilterChainBuilder:
http://svn.apache.org/viewvc/mina/branches/1.1/core/src/main/java/org/apache/mina/common/DefaultIoFilterChainBuilder.java?r1=562335&r2=562334&pathrev=562335
The issues you addressed are also fixed in the change above.
> DefaultIoFilterChainBuilder synchronization issue with contains(...) methods
> ----------------------------------------------------------------------------
>
> Key: DIRMINA-410
> URL: https://issues.apache.org/jira/browse/DIRMINA-410
> Project: MINA
> Issue Type: Bug
> Affects Versions: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.0.4, 1.1.1
> Reporter: im-james
> Assignee: Trustin Lee
> Fix For: 1.0.5, 1.1.2
>
>
> In org.apache.mina.common.DefaultIoFilterChainBuilder, most public methods are synchronized to guard the variables "entries" and "entriesByName".
> However, 2 methods are not synchronized and I believe that they should be synchronized.
> I'm talking about these 2:
> public boolean contains(IoFilter filter) {...}
> public boolean contains(Class<? extends IoFilter> filterType) {...}
> it should be:
> public synchronized boolean contains(IoFilter filter) {...}
> public synchronized boolean contains(Class<? extends IoFilter> filterType) {...}
> The version on the trunk is different but I've got the impression that there is another type of bug:
> I've noticed that the variable "entries" is initialized with a "new CopyOnWriteArrayList<Entry>()". However, the clear() method put a regular "new ArrayList<Entry>()" into it. This is probably not what is intended.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-410) DefaultIoFilterChainBuilder
synchronization issue with contains(...) methods
Posted by "im-james (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12516172 ]
im-james commented on DIRMINA-410:
----------------------------------
I'm looking at that again and I think that I have missed a few method in the branch 1.1.1.
As you synchronized (indirectly) the puts (IE: when you set "this.entries = newEntries;") you have to synchronize the get too.
This means that the following methods:
public void buildFilterChain(IoFilterChain chain) throws Exception{...}
public String toString() {...}
public Object clone() {...}
should also be synchronized:
public synchronized void buildFilterChain(IoFilterChain chain) throws Exception{...}
public synchronized String toString() {...}
public synchronized Object clone() {...}
The reason for that is that you iterate over "entries" and if you don't synchronize I think that some visibility problem might occur.
> DefaultIoFilterChainBuilder synchronization issue with contains(...) methods
> ----------------------------------------------------------------------------
>
> Key: DIRMINA-410
> URL: https://issues.apache.org/jira/browse/DIRMINA-410
> Project: MINA
> Issue Type: Bug
> Affects Versions: 1.1.1, 2.0.0-M1
> Reporter: im-james
> Fix For: 1.1.2, 2.0.0-M1
>
>
> In org.apache.mina.common.DefaultIoFilterChainBuilder, most public methods are synchronized to guard the variables "entries" and "entriesByName".
> However, 2 methods are not synchronized and I believe that they should be synchronized.
> I'm talking about these 2:
> public boolean contains(IoFilter filter) {...}
> public boolean contains(Class<? extends IoFilter> filterType) {...}
> it should be:
> public synchronized boolean contains(IoFilter filter) {...}
> public synchronized boolean contains(Class<? extends IoFilter> filterType) {...}
> The version on the trunk is different but I've got the impression that there is another type of bug:
> I've noticed that the variable "entries" is initialized with a "new CopyOnWriteArrayList<Entry>()". However, the clear() method put a regular "new ArrayList<Entry>()" into it. This is probably not what is intended.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DIRMINA-410) DefaultIoFilterChainBuilder
synchronization issue with contains(...) methods
Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Lecharny closed DIRMINA-410.
-------------------------------------
> DefaultIoFilterChainBuilder synchronization issue with contains(...) methods
> ----------------------------------------------------------------------------
>
> Key: DIRMINA-410
> URL: https://issues.apache.org/jira/browse/DIRMINA-410
> Project: MINA
> Issue Type: Bug
> Affects Versions: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.0.4, 1.1.1
> Reporter: im-james
> Assignee: Trustin Lee
> Fix For: 1.0.5, 1.1.2
>
>
> In org.apache.mina.common.DefaultIoFilterChainBuilder, most public methods are synchronized to guard the variables "entries" and "entriesByName".
> However, 2 methods are not synchronized and I believe that they should be synchronized.
> I'm talking about these 2:
> public boolean contains(IoFilter filter) {...}
> public boolean contains(Class<? extends IoFilter> filterType) {...}
> it should be:
> public synchronized boolean contains(IoFilter filter) {...}
> public synchronized boolean contains(Class<? extends IoFilter> filterType) {...}
> The version on the trunk is different but I've got the impression that there is another type of bug:
> I've noticed that the variable "entries" is initialized with a "new CopyOnWriteArrayList<Entry>()". However, the clear() method put a regular "new ArrayList<Entry>()" into it. This is probably not what is intended.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.