> On 29 Oct 2015, at 18:11, Vivian Steller <vivian.stel...@lemonize.de> wrote: > > Hi Richard, > thanks for your response. > > Unfortunately the suggested solution didn’t help. I did session.unwrap() in > the method invoking session.save(). But the error persists (see the altered > stack trace [1]). > > Just for the records: I’m saving multiple workspaces right one after the > other. I guess that each call to save *asynchronously* triggers the cache > flush and updating of the lastUpdateTimeStamp property (see the > info.magnolia.cms.util.DelayedExecutor$RunnableWrapper.run(DelayedExecutor.java:103) > frame in the stack trace, that it’s called asynchronously). > > Somehow access to that lastUpdateTimeStamp property should be synchronized > accross multiple threads invoking > info.magnolia.module.advancedcache.NotifyFlushListeningPolicy_Patched$InitOrUpdateTimeStampOp.exec. > Unfortunately I do not know how to implement this kind of synchronization? > Should simple thread sync using a monitor object help in this case? Do you > have any idea?
across multiple threads? JCR Session is not thread safe and should not be accessed via multiple threads … ever. What seems to be (IMO) happening here is that instance of policy has session or node open while some other class elsewhere updates the node that has the “cache last update timestamp” … then when attempting to update the value that was modified already after retrieval of the node, failure below occurs.so, I don’t think the unwrap can/will help here. What you would need to do (if error happens in your code) is to call session.refresh() prior saving (or catch the failure, call the refresh and then save again) … try to call it w/ “true” to preserve the change, if that doesn’t work, refresh(false) should help, but you would need to set the timestamp property again. You might also want to submit official bug report for it ;) Cheers, Jan > > Thanks for any further assistance. > > Cheers, > Vivian > > > > [1] Full stack trace > > 2015-10-29 17:53:53,938 WARN org.apache.jackrabbit.core.ItemSaveOperation > : > /modules/advanced-cache/config/notifyFlushListeningPolicy/lastUpdateTimeStamp: > failed to restore transient state > 2015-10-29 17:53:53,942 ERROR > e.advancedcache.NotifyFlushListeningPolicy_Patched: Failed to store cache > last update timestamp. All entries will be flushed from cache on restart. > javax.jcr.InvalidItemStateException: property > /modules/advanced-cache/config/notifyFlushListeningPolicy/lastUpdateTimeStamp: > the property cannot be saved because it has been modified externally. > at > org.apache.jackrabbit.core.PropertyImpl.makePersistent(PropertyImpl.java:161) > at > org.apache.jackrabbit.core.ItemSaveOperation.persistTransientItems(ItemSaveOperation.java:849) > at > org.apache.jackrabbit.core.ItemSaveOperation.perform(ItemSaveOperation.java:243) > at > org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216) > at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91) > at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:329) > at > org.apache.jackrabbit.core.session.SessionSaveOperation.perform(SessionSaveOperation.java:65) > at > org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216) > at org.apache.jackrabbit.core.SessionImpl.perform(SessionImpl.java:361) > at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:812) > at > info.magnolia.module.advancedcache.NotifyFlushListeningPolicy_Patched$InitOrUpdateTimeStampOp.exec(NotifyFlushListeningPolicy_Patched.java:92) > at > info.magnolia.module.advancedcache.NotifyFlushListeningPolicy_Patched$InitOrUpdateTimeStampOp.exec(NotifyFlushListeningPolicy_Patched.java:56) > at info.magnolia.cms.security.JCRSessionOp.exec(JCRSessionOp.java:67) > at > info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:385) > at > info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:371) > at > info.magnolia.module.advancedcache.NotifyFlushListeningPolicy_Patched.updateLastUpdateTimestamp(NotifyFlushListeningPolicy_Patched.java:36) > at > info.magnolia.module.advancedcache.NotifyFlushListeningPolicy.preHandleEvents(NotifyFlushListeningPolicy.java:46) > at > info.magnolia.module.cache.AbstractListeningFlushPolicy$CacheCleaner.onEvent(AbstractListeningFlushPolicy.java:193) > at > info.magnolia.cms.util.ObservationUtil$ObservationBasedDelayedExecutor$1.run(ObservationUtil.java:253) > at > info.magnolia.cms.util.DelayedExecutor$RunnableWrapper.run(DelayedExecutor.java:103) > at EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(Unknown > Source) > at java.lang.Thread.run(Thread.java:745) > > >> On 29.10.2015, at 16:02, Unger, Richard <richard.un...@lfrz.at> wrote: >> >> Hi Vivian, >> >> Whenever the "MgnlPropertySettingContentDecorator" stuff gives me trouble, I >> unwrap the Nodes/Sessions all the way before using them. Is this what is >> causing the trouble in your case, or is it another interaction? >> >> Regards from Vienna, >> >> Richard >> >> >> >>> -----Ursprüngliche Nachricht----- >>> Von: user-list-ow...@magnolia-cms.com >>> [mailto:user-list-owner@magnolia- cms.com] Im Auftrag von Vivian >>> Steller >>> Gesendet: Donnerstag, 29. Oktober 2015 14:48 >>> An: user-list@magnolia-cms.com >>> Betreff: [magnolia-user] javax.jcr.InvalidItemStateException: property >>> /modules/advanced- >>> cache/config/notifyFlushListeningPolicy/lastUpdateTimeStamp >>> >>> Hi Folks, >>> technical question: can anyone suggest on how to avoid / recover from >>> InvalidItemStateExceptions? >>> >>> Here’s the use case/problem: >>> * we’re using advanced cache / notifyFlushListeningPolicy >>> * we’re bulk creating tons of nodes in various workspaces using a bulk >>> action; the action is performed in system context >>> * nodes are created just fine, this is all right, however… >>> * PROBLEM: updating the lastUpdateTimeStamp property fails with the >>> exception below [1]… >>> * interesting: the exception does not appear if I perform the >>> operation for the first time after starting Magnolia.. it seems that >>> somehow the state is not written back correctly in the >>> NotifyFlushListeningPolicy? >>> >>> Here some concrete questions? >>> * did anyone experience the same issues with the >>> NotifyFlushListeningPolicy? >>> * since we know we’re doing lots of stuff in the workspaces: is there >>> a way to temporarily turn off updating this property and just writing it >>> once? >>> * is there a way to recover from an InvalidItemState in some way? >>> * any other idea to avoid this exception? >>> >>> Thanks in advance, >>> cheers, >>> Vivian >>> >>> >>> [1] Full Exception Stack trace: >>> 2015-10-29 14:29:15,933 WARN >>> org.apache.jackrabbit.core.ItemSaveOperation : /modules/advanced- >>> cache/config/notifyFlushListeningPolicy/lastUpdateTimeStamp: failed to >>> restore transient state >>> 2015-10-29 14:29:15,934 ERROR >>> ia.jcr.wrapper.MgnlPropertySettingContentDecorator: Failed to update >>> LUD for session: session-admin-318::config >>> javax.jcr.InvalidItemStateException: property /modules/advanced- >>> cache/config/notifyFlushListeningPolicy/lastUpdateTimeStamp: the >>> property cannot be saved because it has been modified externally. >>> at >>> org.apache.jackrabbit.core.PropertyImpl.makePersistent(PropertyImpl.java: >>> 161) >>> at >>> org.apache.jackrabbit.core.ItemSaveOperation.persistTransientItems(Ite >>> mS >>> aveOperation.java:849) >>> at >>> org.apache.jackrabbit.core.ItemSaveOperation.perform(ItemSaveOperation >>> .java:243) >>> at >>> org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java: >>> 216) >>> at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91) >>> at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:329) >>> at >>> org.apache.jackrabbit.core.session.SessionSaveOperation.perform(Sessio >>> nS >>> aveOperation.java:65) >>> at >>> org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java: >>> 216) >>> at >>> org.apache.jackrabbit.core.SessionImpl.perform(SessionImpl.java:361) >>> at >>> org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:812) >>> at >>> info.magnolia.jcr.wrapper.DelegateSessionWrapper.save(DelegateSessionW >>> rapper.java:297) >>> at >>> info.magnolia.jcr.wrapper.DelegateSessionWrapper.save(DelegateSessionW >>> rapper.java:297) >>> at >>> info.magnolia.jcr.wrapper.DelegateSessionWrapper.save(DelegateSessionW >>> rapper.java:297) >>> at >>> info.magnolia.jcr.wrapper.MgnlPropertySettingContentDecorator$MgnlProp >>> ertySettingSessionWrapper.save(MgnlPropertySettingContentDecorator.jav >>> a:492) >>> at >>> info.magnolia.jcr.wrapper.DelegateSessionWrapper.save(DelegateSessionW >>> rapper.java:297) >>> at >>> info.magnolia.audit.MgnlAuditLoggingContentDecoratorSessionWrapper.sav >>> e(MgnlAuditLoggingContentDecoratorSessionWrapper.java:82) >>> at >>> info.magnolia.module.advancedcache.NotifyFlushListeningPolicy$InitOrUp >>> da >>> teTimeStampOp.exec(NotifyFlushListeningPolicy.java:127) >>> at >>> info.magnolia.module.advancedcache.NotifyFlushListeningPolicy$InitOrUp >>> da >>> teTimeStampOp.exec(NotifyFlushListeningPolicy.java:98) >>> at >>> info.magnolia.cms.security.JCRSessionOp.exec(JCRSessionOp.java:67) >>> at >>> info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:3 >>> 85) >>> at >>> info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:3 >>> 71) >>> at >>> info.magnolia.module.advancedcache.NotifyFlushListeningPolicy.updateLa >>> st >>> UpdateTimestamp(NotifyFlushListeningPolicy.java:61) >>> at >>> info.magnolia.module.advancedcache.NotifyFlushListeningPolicy.preHandl >>> eE >>> vents(NotifyFlushListeningPolicy.java:46) >>> at >>> info.magnolia.module.cache.AbstractListeningFlushPolicy$CacheCleaner.o >>> nE >>> vent(AbstractListeningFlushPolicy.java:193) >>> at >>> info.magnolia.cms.util.ObservationUtil$ObservationBasedDelayedExecutor >>> $ >>> 1.run(ObservationUtil.java:253) >>> at >>> info.magnolia.cms.util.DelayedExecutor$RunnableWrapper.run(DelayedExec >>> utor.java:103) >>> at >>> EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(Unknown >>> Source) >>> at java.lang.Thread.run(Thread.java:745) >>> 2015-10-29 14:29:15,935 ERROR >>> ia.module.advancedcache.NotifyFlushListeningPolicy: Failed to store >>> cache last update timestamp. All entries will be flushed from cache on >>> restart. >>> javax.jcr.InvalidItemStateException: property /modules/advanced- >>> cache/config/notifyFlushListeningPolicy/lastUpdateTimeStamp: the >>> property cannot be saved because it has been modified externally. >>> at >>> org.apache.jackrabbit.core.PropertyImpl.makePersistent(PropertyImpl.java: >>> 161) >>> at >>> org.apache.jackrabbit.core.ItemSaveOperation.persistTransientItems(Ite >>> mS >>> aveOperation.java:849) >>> at >>> org.apache.jackrabbit.core.ItemSaveOperation.perform(ItemSaveOperation >>> .java:243) >>> at >>> org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java: >>> 216) >>> at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91) >>> at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:329) >>> at >>> org.apache.jackrabbit.core.session.SessionSaveOperation.perform(Sessio >>> nS >>> aveOperation.java:65) >>> at >>> org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java: >>> 216) >>> at >>> org.apache.jackrabbit.core.SessionImpl.perform(SessionImpl.java:361) >>> at >>> org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:812) >>> at >>> info.magnolia.jcr.wrapper.DelegateSessionWrapper.save(DelegateSessionW >>> rapper.java:297) >>> at >>> info.magnolia.jcr.wrapper.DelegateSessionWrapper.save(DelegateSessionW >>> rapper.java:297) >>> at >>> info.magnolia.jcr.wrapper.DelegateSessionWrapper.save(DelegateSessionW >>> rapper.java:297) >>> at >>> info.magnolia.jcr.wrapper.MgnlPropertySettingContentDecorator$MgnlProp >>> ertySettingSessionWrapper.save(MgnlPropertySettingContentDecorator.jav >>> a:492) >>> at >>> info.magnolia.jcr.wrapper.DelegateSessionWrapper.save(DelegateSessionW >>> rapper.java:297) >>> at >>> info.magnolia.audit.MgnlAuditLoggingContentDecoratorSessionWrapper.sav >>> e(MgnlAuditLoggingContentDecoratorSessionWrapper.java:82) >>> at >>> info.magnolia.module.advancedcache.NotifyFlushListeningPolicy$InitOrUp >>> da >>> teTimeStampOp.exec(NotifyFlushListeningPolicy.java:127) >>> at >>> info.magnolia.module.advancedcache.NotifyFlushListeningPolicy$InitOrUp >>> da >>> teTimeStampOp.exec(NotifyFlushListeningPolicy.java:98) >>> at >>> info.magnolia.cms.security.JCRSessionOp.exec(JCRSessionOp.java:67) >>> at >>> info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:3 >>> 85) >>> at >>> info.magnolia.context.MgnlContext.doInSystemContext(MgnlContext.java:3 >>> 71) >>> at >>> info.magnolia.module.advancedcache.NotifyFlushListeningPolicy.updateLa >>> st >>> UpdateTimestamp(NotifyFlushListeningPolicy.java:61) >>> at >>> info.magnolia.module.advancedcache.NotifyFlushListeningPolicy.preHandl >>> eE >>> vents(NotifyFlushListeningPolicy.java:46) >>> at >>> info.magnolia.module.cache.AbstractListeningFlushPolicy$CacheCleaner.o >>> nE >>> vent(AbstractListeningFlushPolicy.java:193) >>> at >>> info.magnolia.cms.util.ObservationUtil$ObservationBasedDelayedExecutor >>> $ >>> 1.run(ObservationUtil.java:253) >>> at >>> info.magnolia.cms.util.DelayedExecutor$RunnableWrapper.run(DelayedExec >>> utor.java:103) >>> at >>> EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(Unknown >>> Source) >>> at java.lang.Thread.run(Thread.java:745) >>> >>> ---------------------------------------------------------------- >>> For list details, see http://www.magnolia-cms.com/community/mailing- >>> lists.html >>> Alternatively, use our forums: http://forum.magnolia-cms.com/ To >>> unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com> >>> ---------------------------------------------------------------- >> >> >> >> ---------------------------------------------------------------- >> For list details, see >> http://www.magnolia-cms.com/community/mailing-lists.html >> Alternatively, use our forums: http://forum.magnolia-cms.com/ >> To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com> >> ---------------------------------------------------------------- >> > > > > ---------------------------------------------------------------- > For list details, see http://www.magnolia-cms.com/community/mailing-lists.html > Alternatively, use our forums: http://forum.magnolia-cms.com/ > To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com> > ----------------------------------------------------------------
signature.asc
Description: Message signed with OpenPGP using GPGMail