You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Miroslav Beranič <mi...@mibesis.si> on 2018/10/01 06:51:09 UTC

Pax JMS - ConcurrentModificationException

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
miroslav.beranic@mibesis.si
http://www.mibesis.si

Re: Pax JMS - ConcurrentModificationException

Posted by Miroslav Beranič <mi...@mibesis.si>.
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č <
miroslav.beranic@mibesis.si> 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é <
> jb@nanthrax.net> 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
>> >> miroslav.beranic@mibesis.si <ma...@mibesis.si>
>> >> http://www.mibesis.si
>> >
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>
>
> --
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> miroslav.beranic@mibesis.si
> http://www.mibesis.si
>


-- 
Miroslav Beranič
MIBESIS
+386(0)40/814-843
miroslav.beranic@mibesis.si
http://www.mibesis.si

Re: Pax JMS - ConcurrentModificationException

Posted by Miroslav Beranič <mi...@mibesis.si>.
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é <
jb@nanthrax.net> 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
> >> miroslav.beranic@mibesis.si <ma...@mibesis.si>
> >> http://www.mibesis.si
> >
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>


-- 
Miroslav Beranič
MIBESIS
+386(0)40/814-843
miroslav.beranic@mibesis.si
http://www.mibesis.si

Re: Pax JMS - ConcurrentModificationException

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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
>> miroslav.beranic@mibesis.si <ma...@mibesis.si>
>> http://www.mibesis.si
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Pax JMS - ConcurrentModificationException

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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
> miroslav.beranic@mibesis.si <ma...@mibesis.si>
> http://www.mibesis.si

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Pax JMS - ConcurrentModificationException

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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
> miroslav.beranic@mibesis.si <ma...@mibesis.si>
> http://www.mibesis.si

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com