You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Marcel Reutegger <ma...@gmx.net> on 2007/12/18 11:23:51 UTC
synchronization issues
hi all,
there are a number of synchronization issues I would like to resolve for the 1.4
release. some of them are related to using the new FineGrainedISMLocking but
most of them are general synchronization issues that may happen with both
DefaultISMLocking and FineGrainedISMLocking, though more visible with the latter.
JCR-1271 - this issue happens with both ISMLocking implementations. The cache in
LocalItemStateManager is accessed at the same time by the thread using the
session and by the thread that notifies ItemState changes. JCR-935 happens for
the same reason.
JCR-1272 - this issue happens with both ISMLocking implementations. instead of
adding synchronization, I suggest to operate on possibly stale states. see patch.
JCR-1274 - this is only an issue with the FineGrainedISMLocking. when using the
DefaultISMLocking the exclusive write lock prevents any reading from the cache.
this is different when using FineGrainedISMLocking. This locking strategy allows
reading from the cache while a change is processed. Hence it may happen that
reading from and writing to the cache happens concurrently. One solution may be
to completely synchronize the ItemStateCache in SharedItemStateManager. This
however reduces concurrency on the cache for reading threads. Another solution I
can think of is to allow the ISMLocking implementation to wrap the
ItemStateCache if necessary. DefaultISMLocking would simply return the cache as
is, while FineGrainedISMLocking would have to wrap the cache into a synchronized
variant.
comments are welcome.
regards
marcel
Re: synchronization issues
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On Dec 18, 2007 12:23 PM, Marcel Reutegger <ma...@gmx.net> wrote:
> there are a number of synchronization issues I would like to resolve for the 1.4
> release.
+1, I'll hold off branching 1.4 until we get these issues resolved.
> comments are welcome.
See comments on the individual issues.
BR,
Jukka Zitting
Re: synchronization issues
Posted by Thomas Mueller <th...@gmail.com>.
Hi,
Maybe the tool FindBugs can help find synchronization problem:
http://findbugs.sourceforge.net
Regards,
Thomas
Re: synchronization issues
Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Padraic,
Padraic Hannon wrote:
> in terms of where threads lock, and I have tons of
> thread dumps showing this under load
did you create jira issues for the deadlocks you encountered? There are a number
of issues we fixed in trunk and the 1.3 branch but if you still see deadlocks
please report them.
regards
marcel
Re: synchronization issues
Posted by Padraic Hannon <pi...@wasabicowboy.com>.
I think it may be best to take a long look at the various
*ItemStateManager classes in a holistic manner. It appears that these
classes introduce a lot of the locking and synchronization issues (as
would be expected from such a key group of classes). The movement
towards using more fine grained locking makes a lot of sense, but I
think we still have a mix of locking and explicit method level
synchronization. In addition, it seems that we do not really look at
transaction isolation levels to determine locking strategies. In some
instances dirty reads and writes may be acceptable and using
configurable tx isolations levels could allow the end consumer to
tweak the system for their application environment. I would love to
see us move towards having the cache and persistence layers separated
and management of the internal hidden from things such as shared item
state manager. In my experience most if not all the issues we have
seen in our production systems (in terms of where threads lock, and I
have tons of thread dumps showing this under load) occur within
SharedItemStateManager and ItemManager. As we see these issues pile up
I think it behooves us to take a long hard look at these core classes
and ensure that we are going down the right path.
-paddy
On Dec 18, 2007, at 2:23 AM, Marcel Reutegger wrote:
> hi all,
>
> there are a number of synchronization issues I would like to resolve
> for the 1.4 release. some of them are related to using the new
> FineGrainedISMLocking but most of them are general synchronization
> issues that may happen with both DefaultISMLocking and
> FineGrainedISMLocking, though more visible with the latter.
>
> JCR-1271 - this issue happens with both ISMLocking implementations.
> The cache in LocalItemStateManager is accessed at the same time by
> the thread using the session and by the thread that notifies
> ItemState changes. JCR-935 happens for the same reason.
>
> JCR-1272 - this issue happens with both ISMLocking implementations.
> instead of adding synchronization, I suggest to operate on possibly
> stale states. see patch.
>
> JCR-1274 - this is only an issue with the FineGrainedISMLocking.
> when using the DefaultISMLocking the exclusive write lock prevents
> any reading from the cache. this is different when using
> FineGrainedISMLocking. This locking strategy allows reading from the
> cache while a change is processed. Hence it may happen that reading
> from and writing to the cache happens concurrently. One solution may
> be to completely synchronize the ItemStateCache in
> SharedItemStateManager. This however reduces concurrency on the
> cache for reading threads. Another solution I can think of is to
> allow the ISMLocking implementation to wrap the ItemStateCache if
> necessary. DefaultISMLocking would simply return the cache as is,
> while FineGrainedISMLocking would have to wrap the cache into a
> synchronized variant.
>
> comments are welcome.
>
> regards
> marcel
Re: synchronization issues
Posted by Marcel Reutegger <ma...@gmx.net>.
I forgot one issue:
JCR-1148 - may happen with both ISMLocking implementations. the fix is IMO quite
easy and low risk: move synchronization of mod count into copy().
regards
marcel
Marcel Reutegger wrote:
> hi all,
>
> there are a number of synchronization issues I would like to resolve for
> the 1.4 release. some of them are related to using the new
> FineGrainedISMLocking but most of them are general synchronization
> issues that may happen with both DefaultISMLocking and
> FineGrainedISMLocking, though more visible with the latter.
>
> JCR-1271 - this issue happens with both ISMLocking implementations. The
> cache in LocalItemStateManager is accessed at the same time by the
> thread using the session and by the thread that notifies ItemState
> changes. JCR-935 happens for the same reason.
>
> JCR-1272 - this issue happens with both ISMLocking implementations.
> instead of adding synchronization, I suggest to operate on possibly
> stale states. see patch.
>
> JCR-1274 - this is only an issue with the FineGrainedISMLocking. when
> using the DefaultISMLocking the exclusive write lock prevents any
> reading from the cache. this is different when using
> FineGrainedISMLocking. This locking strategy allows reading from the
> cache while a change is processed. Hence it may happen that reading from
> and writing to the cache happens concurrently. One solution may be to
> completely synchronize the ItemStateCache in SharedItemStateManager.
> This however reduces concurrency on the cache for reading threads.
> Another solution I can think of is to allow the ISMLocking
> implementation to wrap the ItemStateCache if necessary.
> DefaultISMLocking would simply return the cache as is, while
> FineGrainedISMLocking would have to wrap the cache into a synchronized
> variant.
>
> comments are welcome.
>
> regards
> marcel
>