[appengine-java] Should JDO use be synchronized in threadsafe=true application?
Aaron (or others), Do you have any updates from your experiences using JDO with threadsafe enabled? Has your synchronization changes eliminated these errors? Is it necessary to synchronize reads such as query.execute and pm.detachCopyAll in additional to the write operations such as pm.deletePersistent and pm.makePersistent? Thank you, David On May 17, 4:51 pm, Aaron Shepherd wrote: > Ok. My change to PMF.java to synchronize the get of the > PersistenceManager did NOT correct the problem. > > Going to fallback to synchronizing every usage of the > PersistenceManager (reads and writes). > > Will update this issue with any further results. > > On May 17, 1:54 am, Stephen Johnson wrote: > > > Ah, I missed the point about it being tasks and didn't realize the > > threadsafe only applied to user requests and not tasks. If indeed that was > > the case. > > > On Mon, May 16, 2011 at 10:44 PM, Juha K wrote: > > > The datanucleus issue has a comment "Then, when my tasks run in parallel, > > > initialisation has already been done and the problem doesn't appear any > > > more.", so before the threadsafe property, only tasks were run in > > > parallel. > > > Probably that's why I didn't see this error before, I didn't have tasks > > > doing db access. > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Google App Engine for Java" group. > > > To post to this group, send email to > > > google-appengine-java@googlegroups.com. > > > To unsubscribe from this group, send email to > > > google-appengine-java+unsubscr...@googlegroups.com. > > > For more options, visit this group at > > >http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: Vs: Re: Vs: Re: Vs: Re: [appengine-java] Should JDO use be synchronized in threadsafe=true application?
Ok. My change to PMF.java to synchronize the get of the PersistenceManager did NOT correct the problem. Going to fallback to synchronizing every usage of the PersistenceManager (reads and writes). Will update this issue with any further results. On May 17, 1:54 am, Stephen Johnson wrote: > Ah, I missed the point about it being tasks and didn't realize the > threadsafe only applied to user requests and not tasks. If indeed that was > the case. > > > > On Mon, May 16, 2011 at 10:44 PM, Juha K wrote: > > The datanucleus issue has a comment "Then, when my tasks run in parallel, > > initialisation has already been done and the problem doesn't appear any > > more.", so before the threadsafe property, only tasks were run in parallel. > > Probably that's why I didn't see this error before, I didn't have tasks > > doing db access. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google App Engine for Java" group. > > To post to this group, send email to > > google-appengine-java@googlegroups.com. > > To unsubscribe from this group, send email to > > google-appengine-java+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: Vs: Re: Vs: Re: Vs: Re: [appengine-java] Should JDO use be synchronized in threadsafe=true application?
Ah, I missed the point about it being tasks and didn't realize the threadsafe only applied to user requests and not tasks. If indeed that was the case. On Mon, May 16, 2011 at 10:44 PM, Juha K wrote: > The datanucleus issue has a comment "Then, when my tasks run in parallel, > initialisation has already been done and the problem doesn't appear any > more.", so before the threadsafe property, only tasks were run in parallel. > Probably that's why I didn't see this error before, I didn't have tasks > doing db access. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-java@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Vs: Re: Vs: Re: Vs: Re: [appengine-java] Should JDO use be synchronized in threadsafe=true application?
The datanucleus issue has a comment "Then, when my tasks run in parallel, initialisation has already been done and the problem doesn't appear any more.", so before the threadsafe property, only tasks were run in parallel. Probably that's why I didn't see this error before, I didn't have tasks doing db access. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: Vs: Re: Vs: Re: [appengine-java] Should JDO use be synchronized in threadsafe=true application?
Thinking out loud...What's strange about that issue (not this current one but the one from the past) and the supposed solution is that until just recently with the introduction of the threadsafe property supposedly only one request could executing at a time and you can't create your own additional threads, so how could there have been a race condition before?? On Mon, May 16, 2011 at 10:16 PM, Juha K wrote: > Based on your experience it seems to be that the problem is in the access > to PersistenceManagerFactory.getPersistenceManager()? If your PMF-class > fixes the problem, then it seems that call to getPersistenceManager() should > be synchronized in multithreaded apps. > Can anyone confirm this? > > I found this issue: > http://code.google.com/p/datanucleus-appengine/issues/detail?id=203(Unexpected > UnsupportedOperationException when calling getObjectById()) and > used the workaround proposed there (doing a query in the start up). So far > it seems to be working ok. > > > > > lauantaina 14. toukokuuta 2011 8.26.02 UTC+3 Aaron Shepherd kirjoitti: >> >> I'm using this modified PMF class now and it seems to fix this >> problem, with the caveat that I haven't done any heavy load testing >> yet. >> >> public final class PMF >> { >> private static final PersistenceManagerFactory pmfInstance = >> JDOHelper.getPersistenceManagerFactory("transactions- >> optional"); >> >> private PMF() >> { >> } >> >> public synchronized static PersistenceManagerFactory get() >> { >> return pmfInstance; >> } >> >> public synchronized static PersistenceManager >> getPersistenceManagerInstance() >> { >> return pmfInstance.getPersistenceManager(); >> } >> } >> >> Aaron Shepherd >> OnFast.com >> >> -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-java@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Vs: Re: Vs: Re: [appengine-java] Should JDO use be synchronized in threadsafe=true application?
Based on your experience it seems to be that the problem is in the access to PersistenceManagerFactory.getPersistenceManager()? If your PMF-class fixes the problem, then it seems that call to getPersistenceManager() should be synchronized in multithreaded apps. Can anyone confirm this? I found this issue: http://code.google.com/p/datanucleus-appengine/issues/detail?id=203 (Unexpected UnsupportedOperationException when calling getObjectById()) and used the workaround proposed there (doing a query in the start up). So far it seems to be working ok. lauantaina 14. toukokuuta 2011 8.26.02 UTC+3 Aaron Shepherd kirjoitti: > > I'm using this modified PMF class now and it seems to fix this > problem, with the caveat that I haven't done any heavy load testing > yet. > > public final class PMF > { > private static final PersistenceManagerFactory pmfInstance = > JDOHelper.getPersistenceManagerFactory("transactions- > optional"); > > private PMF() > { > } > > public synchronized static PersistenceManagerFactory get() > { > return pmfInstance; > } > > public synchronized static PersistenceManager > getPersistenceManagerInstance() > { > return pmfInstance.getPersistenceManager(); > } > } > > Aaron Shepherd > OnFast.com > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: Vs: Re: [appengine-java] Should JDO use be synchronized in threadsafe=true application?
I'm using this modified PMF class now and it seems to fix this problem, with the caveat that I haven't done any heavy load testing yet. public final class PMF { private static final PersistenceManagerFactory pmfInstance = JDOHelper.getPersistenceManagerFactory("transactions- optional"); private PMF() { } public synchronized static PersistenceManagerFactory get() { return pmfInstance; } public synchronized static PersistenceManager getPersistenceManagerInstance() { return pmfInstance.getPersistenceManager(); } } Aaron Shepherd OnFast.com On May 13, 11:13 am, Juha K wrote: > No, but I have single global instance of PersistenceManagerFactory, and from > it I call getPersistenceManager() every time I need it. > > perjantaina 13. toukokuuta 2011 18.07.22 UTC+3 Ikai L (Google) kirjoitti: > > > > > > > Do you just have a single global instance of persistence manager, or do you > > use the factory method? > > > Ikai Lan > > Developer Programs Engineer, Google App Engine > > Blog:http://googleappengine.blogspot.com > > Twitter:http://twitter.com/app_engine > > Reddit:http://www.reddit.com/r/appengine > > > On Thu, May 12, 2011 at 1:47 AM, Juha K wrote: > > >> I've been running an application successfully for some time on the app > >> engine. During last week I've couple of times tried enabling threadsafe in > >> my app. It seems to randomly cause issues with retrieving or storing data > >> with JDO. What I see when I start to get these issues is this (I've > >> replaced > >> my apps class names with ---): > >> java.lang.UnsupportedOperationException > >> at > >> org.datanucleus.store.appengine.EntityUtils.getPropertyName(EntityUtils.jav > >> a:62) > >> at > >> org.datanucleus.store.appengine.DatastoreFieldManager.storeObjectField(Data > >> storeFieldManager.java:839) > >> at > >> org.datanucleus.store.appengine.DatastoreFieldManager.storeStringField(Data > >> storeFieldManager.java:474) > >> at > >> org.datanucleus.state.AbstractStateManager.providedStringField(AbstractStat > >> eManager.java:1023) > >> at ---.jdoProvideField(VAJDO.java) > >> at ---.jdoProvideFields(VAJDO.java) > >> at > >> org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl > >> .java:2715) > >> at > >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProces > >> s(DatastorePersistenceHandler.java:341) > >> at > >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(D > >> atastorePersistenceHandler.java:251) > >> at > >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject(Da > >> tastorePersistenceHandler.java:240) > >> at > >> org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent(JDOStateMa > >> nagerImpl.java:3185) > >> at > >> org.datanucleus.state.JDOStateManagerImpl.makePersistent(JDOStateManagerImp > >> l.java:3161) > >> at > >> org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.j > >> ava:1298) > >> at > >> org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1175 > >> ) > >> at > >> org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceM > >> anager.java:669) > >> at > >> org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceMana > >> ger.java:694) > > >> I've seen the same exception also when calling > >> PersistenceManager.getObjectById(). The call to these methods comes > >> directly > >> from servlet requests. > > >> The error doesn't always happen, sometimes (especially for writes) when it > >> starts to happen, it seems to happen to all writes. I've set threadsafe to > >> false in my appengine-web.xml and the error goes away. But especially now > >> knowing the upcoming change in the pricing, I'd like to be able to run my > >> app multithreaded. My question is that is this a bug in the app engine, or > >> should I be synchronizing JDO use in my app in order to run it with > >> threadsafe=true? > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Google App Engine for Java" group. > >> To post to this group, send email to google-app...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> google-appengine...@googlegroups.com. > >> For more options, visit this group at > >>http://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Vs: Re: [appengine-java] Should JDO use be synchronized in threadsafe=true application?
No, but I have single global instance of PersistenceManagerFactory, and from it I call getPersistenceManager() every time I need it. perjantaina 13. toukokuuta 2011 18.07.22 UTC+3 Ikai L (Google) kirjoitti: > > Do you just have a single global instance of persistence manager, or do you > use the factory method? > > Ikai Lan > Developer Programs Engineer, Google App Engine > Blog: http://googleappengine.blogspot.com > Twitter: http://twitter.com/app_engine > Reddit: http://www.reddit.com/r/appengine > > > > On Thu, May 12, 2011 at 1:47 AM, Juha K wrote: > >> I've been running an application successfully for some time on the app >> engine. During last week I've couple of times tried enabling threadsafe in >> my app. It seems to randomly cause issues with retrieving or storing data >> with JDO. What I see when I start to get these issues is this (I've replaced >> my apps class names with ---): >> java.lang.UnsupportedOperationException >> at >> org.datanucleus.store.appengine.EntityUtils.getPropertyName(EntityUtils.java:62) >> at >> org.datanucleus.store.appengine.DatastoreFieldManager.storeObjectField(DatastoreFieldManager.java:839) >> at >> org.datanucleus.store.appengine.DatastoreFieldManager.storeStringField(DatastoreFieldManager.java:474) >> at >> org.datanucleus.state.AbstractStateManager.providedStringField(AbstractStateManager.java:1023) >> at ---.jdoProvideField(VAJDO.java) >> at ---.jdoProvideFields(VAJDO.java) >> at >> org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl.java:2715) >> at >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProcess(DatastorePersistenceHandler.java:341) >> at >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(DatastorePersistenceHandler.java:251) >> at >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:240) >> at >> org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent(JDOStateManagerImpl.java:3185) >> at >> org.datanucleus.state.JDOStateManagerImpl.makePersistent(JDOStateManagerImpl.java:3161) >> at >> org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1298) >> at >> org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1175) >> at >> org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:669) >> at >> org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:694) >> >> I've seen the same exception also when calling >> PersistenceManager.getObjectById(). The call to these methods comes directly >> from servlet requests. >> >> The error doesn't always happen, sometimes (especially for writes) when it >> starts to happen, it seems to happen to all writes. I've set threadsafe to >> false in my appengine-web.xml and the error goes away. But especially now >> knowing the upcoming change in the pricing, I'd like to be able to run my >> app multithreaded. My question is that is this a bug in the app engine, or >> should I be synchronizing JDO use in my app in order to run it with >> threadsafe=true? >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine for Java" group. >> To post to this group, send email to google-app...@googlegroups.com. >> To unsubscribe from this group, send email to >> google-appengine...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/google-appengine-java?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Should JDO use be synchronized in threadsafe=true application?
Do you just have a single global instance of persistence manager, or do you use the factory method? Ikai Lan Developer Programs Engineer, Google App Engine Blog: http://googleappengine.blogspot.com Twitter: http://twitter.com/app_engine Reddit: http://www.reddit.com/r/appengine On Thu, May 12, 2011 at 1:47 AM, Juha K wrote: > I've been running an application successfully for some time on the app > engine. During last week I've couple of times tried enabling threadsafe in > my app. It seems to randomly cause issues with retrieving or storing data > with JDO. What I see when I start to get these issues is this (I've replaced > my apps class names with ---): > java.lang.UnsupportedOperationException > at > org.datanucleus.store.appengine.EntityUtils.getPropertyName(EntityUtils.java:62) > at > org.datanucleus.store.appengine.DatastoreFieldManager.storeObjectField(DatastoreFieldManager.java:839) > at > org.datanucleus.store.appengine.DatastoreFieldManager.storeStringField(DatastoreFieldManager.java:474) > at > org.datanucleus.state.AbstractStateManager.providedStringField(AbstractStateManager.java:1023) > at ---.jdoProvideField(VAJDO.java) > at ---.jdoProvideFields(VAJDO.java) > at > org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl.java:2715) > at > org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProcess(DatastorePersistenceHandler.java:341) > at > org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(DatastorePersistenceHandler.java:251) > at > org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:240) > at > org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent(JDOStateManagerImpl.java:3185) > at > org.datanucleus.state.JDOStateManagerImpl.makePersistent(JDOStateManagerImpl.java:3161) > at > org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1298) > at > org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1175) > at > org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:669) > at > org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:694) > > I've seen the same exception also when calling > PersistenceManager.getObjectById(). The call to these methods comes directly > from servlet requests. > > The error doesn't always happen, sometimes (especially for writes) when it > starts to happen, it seems to happen to all writes. I've set threadsafe to > false in my appengine-web.xml and the error goes away. But especially now > knowing the upcoming change in the pricing, I'd like to be able to run my > app multithreaded. My question is that is this a bug in the app engine, or > should I be synchronizing JDO use in my app in order to run it with > threadsafe=true? > > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > google-appengine-java@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Should JDO use be synchronized in threadsafe=true application?
I've been running an application successfully for some time on the app engine. During last week I've couple of times tried enabling threadsafe in my app. It seems to randomly cause issues with retrieving or storing data with JDO. What I see when I start to get these issues is this (I've replaced my apps class names with ---): java.lang.UnsupportedOperationException at org.datanucleus.store.appengine.EntityUtils.getPropertyName(EntityUtils.java:62) at org.datanucleus.store.appengine.DatastoreFieldManager.storeObjectField(DatastoreFieldManager.java:839) at org.datanucleus.store.appengine.DatastoreFieldManager.storeStringField(DatastoreFieldManager.java:474) at org.datanucleus.state.AbstractStateManager.providedStringField(AbstractStateManager.java:1023) at ---.jdoProvideField(VAJDO.java) at ---.jdoProvideFields(VAJDO.java) at org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl.java:2715) at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProcess(DatastorePersistenceHandler.java:341) at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(DatastorePersistenceHandler.java:251) at org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:240) at org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent(JDOStateManagerImpl.java:3185) at org.datanucleus.state.JDOStateManagerImpl.makePersistent(JDOStateManagerImpl.java:3161) at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1298) at org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1175) at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:669) at org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:694) I've seen the same exception also when calling PersistenceManager.getObjectById(). The call to these methods comes directly from servlet requests. The error doesn't always happen, sometimes (especially for writes) when it starts to happen, it seems to happen to all writes. I've set threadsafe to false in my appengine-web.xml and the error goes away. But especially now knowing the upcoming change in the pricing, I'd like to be able to run my app multithreaded. My question is that is this a bug in the app engine, or should I be synchronizing JDO use in my app in order to run it with threadsafe=true? -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.