HughP / simal

Automatically exported from code.google.com/p/simal
0 stars 0 forks source link

Changed project data not persisted #344

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I change data on the project detail page, for example adding a website or 
editing a description (new from issue 335), this data is not persisted.
When I kill and relaunch the application the new data has gone.

Original issue reported on code.google.com by sander.v...@oucs.ox.ac.uk on 31 Aug 2010 at 4:39

GoogleCodeExporter commented 9 years ago
It seems there are different patterns.
Some changes are not added to the model, eg. Project.addCategory(IDoapCategory 
category) only saves the new category to the transient JenaResource.

It looks like statements are persisted when added like this: 

getJenaResource().getModel().createStatement(getJenaResource(), Doap.OS, os);

All changes are however added to the simal:Project not to one of the 
doap:Project s.
This needs to be solved by issue 289.

Original comment by sander.v...@oucs.ox.ac.uk on 31 Aug 2010 at 4:49

GoogleCodeExporter commented 9 years ago

Original comment by sander.v...@oucs.ox.ac.uk on 31 Aug 2010 at 4:49

GoogleCodeExporter commented 9 years ago

Original comment by sander.v...@oucs.ox.ac.uk on 31 Aug 2010 at 4:49

GoogleCodeExporter commented 9 years ago
Model was not flushed to disk when the application shut down, which is done 
using model.close() [1].

Now (r2022) Wicket's hook is used to gracefully shut down the application 
making sure the data is persisted.

Note that some debug configurations do not shut down properly but force-kill 
the JVM hence not calling the Servlet.destroy() method.
In my case, when running 'mvn jetty:run' from Eclipse using the debug 
configuration in Eclipse 3.4, the hook is thus not called. It does work fine if 
running with Maven2 from the command line. There's a debug message printed on 
INFO level to tell you the hook is called. 

[1] http://openjena.org/wiki/TDB/JavaAPI#Caching_and_synchronization 

Original comment by sander.v...@oucs.ox.ac.uk on 2 Sep 2010 at 3:01

GoogleCodeExporter commented 9 years ago
More info on Eclipse debug configuration not calling JVM shutdown hooks: 

https://bugs.eclipse.org/bugs/show_bug.cgi?id=38016

It's a feature, not a bug.. :)

Original comment by sander.v...@oucs.ox.ac.uk on 2 Sep 2010 at 3:08

GoogleCodeExporter commented 9 years ago
Is there any workaround for this? My db keeps losing all its data, and that's 
about to get problematic. Even a hack URL like "/flushdb" would be handy.

Original comment by Stevage on 7 Mar 2011 at 5:12

GoogleCodeExporter commented 9 years ago
If your issue also relates to running from within Eclipse, then the workaround 
is to run from the command line. When running with 'mvn jetty:run' from the 
command line I'm not experiencing this issue; in that case the db is persisted 
when the application shuts down. If your issue also occurs when running from 
the command line I'd suggest filing a new bug report.

According to the doc the TDB db is flushed to disk periodically, but it seems 
that it is not the case in our configuration (or the interval is extremely 
large of course). I always thought this could be an issue local to my machine 
but apparently it's not. 

Fixing this could be as simple as a config issue but I haven't dug in that deep 
yet, unfortunately.  

Original comment by sander.v...@gmail.com on 7 Mar 2011 at 5:43

GoogleCodeExporter commented 9 years ago
Ok, running from command line does avoid the issue - thanks. And I can switch 
to running from Eclipse if I need to specifically debug something.

Original comment by Stevage on 10 Mar 2011 at 2:42