ozoneplatform / owf-framework

OZONE Widget Framework
http://ozoneplatform.org
Apache License 2.0
329 stars 143 forks source link

OWF7 dashboard corrupted layout_config column, presents Black screen to user #25

Open kirse opened 11 years ago

kirse commented 11 years ago

I don't have the exact root cause on this, but here's as much info as I can provide:

  1. At some point while using OWF the user's custom Dashboard config settings are saved (JSON string containing widget size/position etc).
  2. This Dashboard save sometimes triggers a StaleObjectStateException (see Java stack trace below)
  3. When this exception is thrown, garbage data [1] gets written into the layout_config column for that user in the Dashboard SQL table
  4. Once the user tries to login again, that garbage data obviously isn't parseable JSON, so the user is permanently stuck and unable to login. If just one of the user's dashboards have this garbage layout_config data, OWF will fail to load.
  5. End result is that OWF7 presents a "black screen" and nothing else to the end user. See more info in note [2]

Extra Notes: [1] This garbage data tends to look similar to this: [Ljava.lang.String;@6661b6c [2] To an informed dev, this will show a "Trying to decode an invalid JSON string" error in Console

Java Stack trace:

2013-07-29 16:45:58,182 ERROR [org.codehaus.groovy.grails.orm.hibernate.events.PatchedDefaultFlushEventListener] Could not synchronize database state with session org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [ozone.owf.grails.person.Person#8]
  at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1792)
  at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2435)
  at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
  at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
2013-07-29 16:45:58,346 ERROR [grails.app.filters.ozone.owf.grails.filters.SecurityFilters] Object of class [ozone.owf.grails.domain.Person] with identifier [8]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [ozone.owf.grails.domain.Person#8
ncastine commented 10 years ago

Issue has shown up on the Google Groups a few times. Have not been able to replicate the situation. When you do encounter it though an admittedly less-than-optimal work-around is to delete the corrupted dashboard as noted here: delete from dashboard where layout_config like '%[Ljava.lang.String%';

aliasmrchips commented 10 years ago

Perhaps "pessimistic locking" is required?

http://grails.org/doc/latest/guide/GORM.html#locking

kennywk commented 8 years ago

We have noticed this will often occur when there are multiple logins both modifying and saving the layout. Removing the dashboard associated with the user typically fixes the issue. Inside the table, it looks like a bad serialization from JSON as the value in the table relates to java.