Pax JMS - ConcurrentModificationException

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Pax JMS - ConcurrentModificationException

Miroslav Beranič
Hi all,

I was getting ( sometimes ) ConcurrentModificationException when using PAX JMS ( 1.0.2 ). It turned out to be synchronization fail in ConnectionFactoryConfigManager. I've made a fix by replace HashMap with ConcurrentHashMap ( and removed synchronized methods ).

I write here, as I think Karaf is main user base of the PAX JMS library.

Any comment is welcome. Fix is located at:


P.S: I've also updated the dependencies ( in my local branch, not part of the pull request ) - something to have in mind when/if doing local build ( working with Karaf 4.2.2 ).

Kind Regards,
Miroslav



--
Miroslav Beranič
MIBESIS
+386(0)40/814-843
[hidden email]
http://www.mibesis.si
Reply | Threaded
Open this post in threaded view
|

Re: Pax JMS - ConcurrentModificationException

jbonofre
Hi Miroslav,

let me take a look on the Pax JMS PR (and eventually prepare a release
after the merge).

Thanks !
Regards
JB

On 01/10/2018 08:51, Miroslav Beranič wrote:

> Hi all,
>
> I was getting ( sometimes ) ConcurrentModificationException when using
> PAX JMS ( 1.0.2 ). It turned out to be synchronization fail in
> ConnectionFactoryConfigManager. I've made a fix by replace HashMap with
> ConcurrentHashMap ( and removed synchronized methods ).
>
> I write here, as I think Karaf is main user base of the PAX JMS library.
>
> Any comment is welcome. Fix is located at:
>
> https://github.com/ops4j/org.ops4j.pax.jms/pull/15
>
> P.S: I've also updated the dependencies ( in my local branch, not part
> of the pull request ) - something to have in mind when/if doing local
> build ( working with Karaf 4.2.2 ).
>
> Kind Regards,
> Miroslav
>
>
>
> --
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> [hidden email] <mailto:[hidden email]>
> http://www.mibesis.si

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Pax JMS - ConcurrentModificationException

jbonofre
In reply to this post by Miroslav Beranič
By the way, don't you think this commit:

https://github.com/ops4j/org.ops4j.pax.jdbc/commit/6bfeccea774195316d4d2382b5235a7c4d1501e0

already fix the issue ?

I think the synchronized on methods are enough, so I think your PR is
useless with this commit.

Regards
JB

On 01/10/2018 08:51, Miroslav Beranič wrote:

> Hi all,
>
> I was getting ( sometimes ) ConcurrentModificationException when using
> PAX JMS ( 1.0.2 ). It turned out to be synchronization fail in
> ConnectionFactoryConfigManager. I've made a fix by replace HashMap with
> ConcurrentHashMap ( and removed synchronized methods ).
>
> I write here, as I think Karaf is main user base of the PAX JMS library.
>
> Any comment is welcome. Fix is located at:
>
> https://github.com/ops4j/org.ops4j.pax.jms/pull/15
>
> P.S: I've also updated the dependencies ( in my local branch, not part
> of the pull request ) - something to have in mind when/if doing local
> build ( working with Karaf 4.2.2 ).
>
> Kind Regards,
> Miroslav
>
>
>
> --
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> [hidden email] <mailto:[hidden email]>
> http://www.mibesis.si

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Pax JMS - ConcurrentModificationException

jbonofre
Just to be clear, this fix is on Pax JDBC, but the same fix should be
applied to Pax JMS. Synchronized is IMHO better and consistent more than
using a ConcurrentHashMap.

Regards
JB

On 01/10/2018 11:05, Jean-Baptiste Onofré wrote:

> By the way, don't you think this commit:
>
> https://github.com/ops4j/org.ops4j.pax.jdbc/commit/6bfeccea774195316d4d2382b5235a7c4d1501e0
>
> already fix the issue ?
>
> I think the synchronized on methods are enough, so I think your PR is
> useless with this commit.
>
> Regards
> JB
>
> On 01/10/2018 08:51, Miroslav Beranič wrote:
>> Hi all,
>>
>> I was getting ( sometimes ) ConcurrentModificationException when using
>> PAX JMS ( 1.0.2 ). It turned out to be synchronization fail in
>> ConnectionFactoryConfigManager. I've made a fix by replace HashMap with
>> ConcurrentHashMap ( and removed synchronized methods ).
>>
>> I write here, as I think Karaf is main user base of the PAX JMS library.
>>
>> Any comment is welcome. Fix is located at:
>>
>> https://github.com/ops4j/org.ops4j.pax.jms/pull/15
>>
>> P.S: I've also updated the dependencies ( in my local branch, not part
>> of the pull request ) - something to have in mind when/if doing local
>> build ( working with Karaf 4.2.2 ).
>>
>> Kind Regards,
>> Miroslav
>>
>>
>>
>> --
>> Miroslav Beranič
>> MIBESIS
>> +386(0)40/814-843
>> [hidden email] <mailto:[hidden email]>
>> http://www.mibesis.si
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Pax JMS - ConcurrentModificationException

Miroslav Beranič
Hi JB,

agree, I guess I am more used to use ConcurrentHashMap than synchronized keyword. Ok, will close PR.

Kind Regards,
Miroslav


V V pon., 1. okt. 2018 ob 11:08 je oseba Jean-Baptiste Onofré <[hidden email]> napisala:
Just to be clear, this fix is on Pax JDBC, but the same fix should be
applied to Pax JMS. Synchronized is IMHO better and consistent more than
using a ConcurrentHashMap.

Regards
JB

On 01/10/2018 11:05, Jean-Baptiste Onofré wrote:
> By the way, don't you think this commit:
>
> https://github.com/ops4j/org.ops4j.pax.jdbc/commit/6bfeccea774195316d4d2382b5235a7c4d1501e0
>
> already fix the issue ?
>
> I think the synchronized on methods are enough, so I think your PR is
> useless with this commit.
>
> Regards
> JB
>
> On 01/10/2018 08:51, Miroslav Beranič wrote:
>> Hi all,
>>
>> I was getting ( sometimes ) ConcurrentModificationException when using
>> PAX JMS ( 1.0.2 ). It turned out to be synchronization fail in
>> ConnectionFactoryConfigManager. I've made a fix by replace HashMap with
>> ConcurrentHashMap ( and removed synchronized methods ).
>>
>> I write here, as I think Karaf is main user base of the PAX JMS library.
>>
>> Any comment is welcome. Fix is located at:
>>
>> https://github.com/ops4j/org.ops4j.pax.jms/pull/15
>>
>> P.S: I've also updated the dependencies ( in my local branch, not part
>> of the pull request ) - something to have in mind when/if doing local
>> build ( working with Karaf 4.2.2 ).
>>
>> Kind Regards,
>> Miroslav
>>
>>
>>
>> --
>> Miroslav Beranič
>> MIBESIS
>> +386(0)40/814-843
>> [hidden email] <mailto:[hidden email]>
>> http://www.mibesis.si
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com


--
Miroslav Beranič
MIBESIS
+386(0)40/814-843
[hidden email]
http://www.mibesis.si
Reply | Threaded
Open this post in threaded view
|

Re: Pax JMS - ConcurrentModificationException

Miroslav Beranič
Hi all,

it seems PAX JMS version 1.0.2 has concurrency problems. I am getting :

karaf@root()> feature:install -r framework-demo
org.osgi.framework.BundleException: Activator stop error in bundle org.ops4j.pax.jms.pax-jms-config [315].
    at org.apache.felix.framework.Felix.stopBundle(Felix.java:2692)
    at org.apache.felix.framework.BundleImpl.stop(BundleImpl.java:1038)
    at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.stopBundle(BundleInstallSupportImpl.java:167)
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.stopBundle(FeaturesServiceImpl.java:1121)
    at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:748)
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)
    at java.util.HashMap$KeyIterator.next(HashMap.java:1466)
    at org.ops4j.pax.jms.config.impl.ConnectionFactoryConfigManager.destroy(ConnectionFactoryConfigManager.java:180)
    at org.ops4j.pax.jms.config.impl.Activator.stop(Activator.java:79)
    at org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:719)
    at org.apache.felix.framework.Felix.stopBundle(Felix.java:2636)
    ... 10 more
Error executing command: Activator stop error in bundle org.ops4j.pax.jms.pax-jms-config [315].

karaf@root()> list -t 0 -s | grep 315
315 │ Resolved │  80 │ 1.0.2.SNAPSHOT                     │ org.ops4j.pax.jms.pax-jms-config


As noted before, I've moved back to "stock" 1.0.2-SNAPSHOT PAX JMS Config bundle and getting error.

I guess I will move to changed version, with use of ConcurrentHashMap.

Kind Regards,
Miroslav




V V pon., 1. okt. 2018 ob 11:43 je oseba Miroslav Beranič <[hidden email]> napisala:
Hi JB,

agree, I guess I am more used to use ConcurrentHashMap than synchronized keyword. Ok, will close PR.

Kind Regards,
Miroslav


V V pon., 1. okt. 2018 ob 11:08 je oseba Jean-Baptiste Onofré <[hidden email]> napisala:
Just to be clear, this fix is on Pax JDBC, but the same fix should be
applied to Pax JMS. Synchronized is IMHO better and consistent more than
using a ConcurrentHashMap.

Regards
JB

On 01/10/2018 11:05, Jean-Baptiste Onofré wrote:
> By the way, don't you think this commit:
>
> https://github.com/ops4j/org.ops4j.pax.jdbc/commit/6bfeccea774195316d4d2382b5235a7c4d1501e0
>
> already fix the issue ?
>
> I think the synchronized on methods are enough, so I think your PR is
> useless with this commit.
>
> Regards
> JB
>
> On 01/10/2018 08:51, Miroslav Beranič wrote:
>> Hi all,
>>
>> I was getting ( sometimes ) ConcurrentModificationException when using
>> PAX JMS ( 1.0.2 ). It turned out to be synchronization fail in
>> ConnectionFactoryConfigManager. I've made a fix by replace HashMap with
>> ConcurrentHashMap ( and removed synchronized methods ).
>>
>> I write here, as I think Karaf is main user base of the PAX JMS library.
>>
>> Any comment is welcome. Fix is located at:
>>
>> https://github.com/ops4j/org.ops4j.pax.jms/pull/15
>>
>> P.S: I've also updated the dependencies ( in my local branch, not part
>> of the pull request ) - something to have in mind when/if doing local
>> build ( working with Karaf 4.2.2 ).
>>
>> Kind Regards,
>> Miroslav
>>
>>
>>
>> --
>> Miroslav Beranič
>> MIBESIS
>> +386(0)40/814-843
>> [hidden email] <mailto:[hidden email]>
>> http://www.mibesis.si
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com


--
Miroslav Beranič
MIBESIS
+386(0)40/814-843
[hidden email]
http://www.mibesis.si


--
Miroslav Beranič
MIBESIS
+386(0)40/814-843
[hidden email]
http://www.mibesis.si