You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by Minto van der Sluis <mi...@xup.nl> on 2014/01/14 12:20:11 UTC

Re: ConcurrentModificationException (CME)

Since we experience CMEs either "no concurrent access" is broken or like
Andy mentioned in [1] java iterators are abused.

Even though it should not be necessary, according to "no concurrent
access", my application still synchronized all access to TcManager. This
additional synchonization did result in a significant drop in the number
of CME occurrences. But I still have a few.

Most occurrences happen while reading (executing a query). Should we
also explicitly start read transactions? Currently
BaseTdbTcProvider.executeSparqlQuery() does not include starting a read
transaction.

dataset.begin(ReadWrite.READ)


IMO this is either caused by abusing java iterators or the internal
SyncThread. But on the other hand SyncThread also uses write locks.

Am I the only one experiencing CMEs? Are there other application running
with multiple concurrent users that make use of Clerezza TDB provider?

Regards,

Minto


Reto Gmür schreef op 14-1-2014 10:22:
> Well, TDB should work with transaction but also with no concurrent access.
> The latter is what clerezza supports and enforces. It supports it in that
> while iterating one should aquire a read lock. It enforces in that every
> write operation automatically aquires a write-lock on the dataset.
>
> Cheers,
> Reto
>
>
> On Tue, Jan 14, 2014 at 9:22 AM, Minto van der Sluis <mi...@xup.nl> wrote:
>
>> Hi Folks,
>>
>> A reply [1]  from Andy to one of my mails triggered me. I looked up the
>> "serializable transactions" that Andy mentioned [2]. Especially the
>> "Multi-threaded use" section caught my attention. If I read it correctly
>> using a single dataset in multiple threads is discouraged.
>>
>> Looking at Clerezza's use of Jena's dataset I see no sign of
>> multi-threading support. Might this be the cause of our
>> ConcurrentModificationException perils? Am I on to something here?
>>
>> Please share your thoughts.
>>
>> Regards,
>>
>> Minto
>>
>> [1]
>>
>> http://mail-archives.apache.org/mod_mbox/clerezza-dev/201401.mbox/%3C52D41088.5070802%40apache.org%3E
>> [2] http://jena.apache.org/documentation/tdb/tdb_transactions.html
>>
>>
>>


-- 
ir. ing. Minto van der Sluis
Software innovator / renovator
Xup BV

Mobiel: +31 (0) 626 014541


Re: ConcurrentModificationException (CME)

Posted by Reto Gmür <re...@wymiwyg.com>.
On Tue, Jan 14, 2014 at 12:20 PM, Minto van der Sluis <mi...@xup.nl> wrote:

> Since we experience CMEs either "no concurrent access" is broken or like
> Andy mentioned in [1] java iterators are abused.
>
> Even though it should not be necessary, according to "no concurrent
> access", my application still synchronized all access to TcManager. This
> additional synchonization did result in a significant drop in the number
> of CME occurrences. But I still have a few.
>
> Most occurrences happen while reading (executing a query). Should we
> also explicitly start read transactions? Currently
> BaseTdbTcProvider.executeSparqlQuery() does not include starting a read
> transaction.
>
> dataset.begin(ReadWrite.READ)
>

Did you see the my recent resolution of CLEREZZA-252? Not sure if using a
transaction in one place would help as long as the other access happens
without transactions.

Cheers,
Reto

>
>
> IMO this is either caused by abusing java iterators or the internal
> SyncThread. But on the other hand SyncThread also uses write locks.
>
> Am I the only one experiencing CMEs? Are there other application running
> with multiple concurrent users that make use of Clerezza TDB provider?
>
> Regards,
>
> Minto
>
>
> Reto Gmür schreef op 14-1-2014 10:22:
> > Well, TDB should work with transaction but also with no concurrent
> access.
> > The latter is what clerezza supports and enforces. It supports it in that
> > while iterating one should aquire a read lock. It enforces in that every
> > write operation automatically aquires a write-lock on the dataset.
> >
> > Cheers,
> > Reto
> >
> >
> > On Tue, Jan 14, 2014 at 9:22 AM, Minto van der Sluis <mi...@xup.nl>
> wrote:
> >
> >> Hi Folks,
> >>
> >> A reply [1]  from Andy to one of my mails triggered me. I looked up the
> >> "serializable transactions" that Andy mentioned [2]. Especially the
> >> "Multi-threaded use" section caught my attention. If I read it correctly
> >> using a single dataset in multiple threads is discouraged.
> >>
> >> Looking at Clerezza's use of Jena's dataset I see no sign of
> >> multi-threading support. Might this be the cause of our
> >> ConcurrentModificationException perils? Am I on to something here?
> >>
> >> Please share your thoughts.
> >>
> >> Regards,
> >>
> >> Minto
> >>
> >> [1]
> >>
> >>
> http://mail-archives.apache.org/mod_mbox/clerezza-dev/201401.mbox/%3C52D41088.5070802%40apache.org%3E
> >> [2] http://jena.apache.org/documentation/tdb/tdb_transactions.html
> >>
> >>
> >>
>
>
> --
> ir. ing. Minto van der Sluis
> Software innovator / renovator
> Xup BV
>
> Mobiel: +31 (0) 626 014541
>
>