Bug 104107

Summary: EDITING - opening any previous Base file in LO5233 corrupts the file forever.
Product: LibreOffice Reporter: Alex Thurgood <iplaw67>
Component: BaseAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WORKSFORME    
Severity: critical CC: lionel, robert, sberg.fun, serval2412
Priority: highest Keywords: haveBacktrace, regression
Version: 5.2.3.3 release   
Hardware: All   
OS: macOS (All)   
Whiteboard:
Crash report or crash signature: Regression By:
Attachments: backtrace from lldb debugging session
Corrupted test file

Description Alex Thurgood 2016-11-22 11:52:18 UTC
Description:
Opening any Base file in LO5233 previously created with an older version of LibreOffice, i.e. before 5233, causes that file to become corrupted on closing and shutting down of LibreOffice, even if no changes have occurred in the database file. Even LO5233 can no longer display any of the objects within the file if is subsequently re-opened in LO5233. An error message is displayed.

Steps to Reproduce:
1. Open an ODB file created with a previous version of Base in LO5233
2. Click on Tables
3. Make no changes, close the file.
4. Close LibreOffice
5. Re-start LibreOffice
6. Load the same ODB file
7. Try clicking on the Tables icon - an error message is displayed, but no table list
8. Try any other db object that was previously available in the file (queries, reports, etc) - the same error message is displayed.


Actual Results:  
The ODB file has been corrupted and will not open in any other version of LibreOffice.

Expected Results:
The file should open in any other version of LibreOffice without incident.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0
Comment 1 Alex Thurgood 2016-11-22 11:54:34 UTC
Seeing this in lldb :

Process 877 launched: '/Applications/LibreOffice.app/Contents/MacOS/soffice' (x86_64)
2016-11-22T12:43:27.530+0100  SEVERE  DataFileCache.reset commit
java.io.IOException: No OutputStream
	at com.sun.star.sdbcx.comp.hsqldb.NativeStorageAccess.write(Native Method)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.write(StorageAccess.java:86)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.writeLong(StorageAccess.java:124)
	at org.hsqldb.persist.RAStorageWrapper.writeLong(Unknown Source)
	at org.hsqldb.persist.DataFileCache.reset(Unknown Source)
	at org.hsqldb.persist.Log.checkpointClose(Unknown Source)
	at org.hsqldb.persist.Log.checkpoint(Unknown Source)
	at org.hsqldb.persist.Log.checkpoint(Unknown Source)
	at org.hsqldb.persist.Logger.checkpointInternal(Unknown Source)
	at org.hsqldb.persist.Logger.checkpoint(Unknown Source)
	at org.hsqldb.persist.Logger.open(Unknown Source)
	at org.hsqldb.Database.reopen(Unknown Source)
	at org.hsqldb.Database.open(Unknown Source)
	at org.hsqldb.DatabaseManager.getDatabase(Unknown Source)
	at org.hsqldb.DatabaseManager.newSession(Unknown Source)
	at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source)
	at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
	at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)

2016-11-22T12:43:27.559+0100  SEVERE  checkpoint failed - recovered
org.hsqldb.HsqlException: file input/output errorerror java.io.IOException: No OutputStream closing file - file /Users/alex/Downloads/Bug93391 copie.odb.data
	at org.hsqldb.error.Error.error(Unknown Source)
	at org.hsqldb.persist.DataFileCache.reset(Unknown Source)
	at org.hsqldb.persist.Log.checkpointClose(Unknown Source)
	at org.hsqldb.persist.Log.checkpoint(Unknown Source)
	at org.hsqldb.persist.Log.checkpoint(Unknown Source)
	at org.hsqldb.persist.Logger.checkpointInternal(Unknown Source)
	at org.hsqldb.persist.Logger.checkpoint(Unknown Source)
	at org.hsqldb.persist.Logger.open(Unknown Source)
	at org.hsqldb.Database.reopen(Unknown Source)
	at org.hsqldb.Database.open(Unknown Source)
	at org.hsqldb.DatabaseManager.getDatabase(Unknown Source)
	at org.hsqldb.DatabaseManager.newSession(Unknown Source)
	at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source)
	at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
	at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source)
Caused by: java.io.IOException: No OutputStream
	at com.sun.star.sdbcx.comp.hsqldb.NativeStorageAccess.write(Native Method)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.write(StorageAccess.java:86)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.writeLong(StorageAccess.java:124)
	at org.hsqldb.persist.RAStorageWrapper.writeLong(Unknown Source)
	... 14 more

2016-11-22T12:43:27.561+0100  SEVERE  checkpoint failed - see previous error
2016-11-22T12:44:19.578+0100  SEVERE  DataFileCache.reset commit
java.io.IOException: No OutputStream
	at com.sun.star.sdbcx.comp.hsqldb.NativeStorageAccess.write(Native Method)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.write(StorageAccess.java:86)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.writeLong(StorageAccess.java:124)
	at org.hsqldb.persist.RAStorageWrapper.writeLong(Unknown Source)
	at org.hsqldb.persist.DataFileCache.reset(Unknown Source)
	at org.hsqldb.persist.DataFileCache.close(Unknown Source)
	at org.hsqldb.persist.DataFileCache.defrag(Unknown Source)
	at org.hsqldb.persist.Log.defrag(Unknown Source)
	at org.hsqldb.persist.Log.checkpoint(Unknown Source)
	at org.hsqldb.persist.Logger.checkpointInternal(Unknown Source)
	at org.hsqldb.persist.Logger.checkpoint(Unknown Source)
	at org.hsqldb.StatementCommand.getResult(Unknown Source)
	at org.hsqldb.StatementCommand.execute(Unknown Source)
	at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
	at org.hsqldb.Session.executeDirectStatement(Unknown Source)
	at org.hsqldb.Session.execute(Unknown Source)
	at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
	at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)

2016-11-22T12:44:19.751+0100  SEVERE  DataFileCache.reset commit
java.io.IOException: No OutputStream
	at com.sun.star.sdbcx.comp.hsqldb.NativeStorageAccess.write(Native Method)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.write(StorageAccess.java:86)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.writeLong(StorageAccess.java:124)
	at org.hsqldb.persist.RAStorageWrapper.writeLong(Unknown Source)
	at org.hsqldb.persist.DataFileCache.reset(Unknown Source)
	at org.hsqldb.persist.DataFileCache.close(Unknown Source)
	at org.hsqldb.persist.DataFileCache.defrag(Unknown Source)
	at org.hsqldb.persist.Log.defrag(Unknown Source)
	at org.hsqldb.persist.Log.checkpoint(Unknown Source)
	at org.hsqldb.persist.Logger.checkpointInternal(Unknown Source)
	at org.hsqldb.persist.Logger.checkpoint(Unknown Source)
	at org.hsqldb.StatementCommand.getResult(Unknown Source)
	at org.hsqldb.StatementCommand.execute(Unknown Source)
	at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
	at org.hsqldb.Session.executeDirectStatement(Unknown Source)
	at org.hsqldb.Session.execute(Unknown Source)
	at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
	at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)

2016-11-22T12:44:19.824+0100  SEVERE  DataFileCache.reset commit
java.io.IOException: No OutputStream
	at com.sun.star.sdbcx.comp.hsqldb.NativeStorageAccess.write(Native Method)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.write(StorageAccess.java:86)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.writeLong(StorageAccess.java:124)
	at org.hsqldb.persist.RAStorageWrapper.writeLong(Unknown Source)
	at org.hsqldb.persist.DataFileCache.reset(Unknown Source)
	at org.hsqldb.persist.DataFileCache.close(Unknown Source)
	at org.hsqldb.persist.Log.close(Unknown Source)
	at org.hsqldb.persist.Logger.close(Unknown Source)
	at org.hsqldb.Database.close(Unknown Source)
	at org.hsqldb.StatementCommand.getResult(Unknown Source)
	at org.hsqldb.StatementCommand.execute(Unknown Source)
	at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
	at org.hsqldb.Session.executeDirectStatement(Unknown Source)
	at org.hsqldb.Session.execute(Unknown Source)
	at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
	at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)

2016-11-22T12:44:19.825+0100  SEVERE  error closing log
org.hsqldb.HsqlException: file input/output errorerror java.io.IOException: No OutputStream closing file - file /Users/alex/Downloads/Bug93391 copie.odb.data
	at org.hsqldb.error.Error.error(Unknown Source)
	at org.hsqldb.persist.DataFileCache.reset(Unknown Source)
	at org.hsqldb.persist.DataFileCache.close(Unknown Source)
	at org.hsqldb.persist.Log.close(Unknown Source)
	at org.hsqldb.persist.Logger.close(Unknown Source)
	at org.hsqldb.Database.close(Unknown Source)
	at org.hsqldb.StatementCommand.getResult(Unknown Source)
	at org.hsqldb.StatementCommand.execute(Unknown Source)
	at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
	at org.hsqldb.Session.executeDirectStatement(Unknown Source)
	at org.hsqldb.Session.execute(Unknown Source)
	at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
	at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)
Caused by: java.io.IOException: No OutputStream
	at com.sun.star.sdbcx.comp.hsqldb.NativeStorageAccess.write(Native Method)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.write(StorageAccess.java:86)
	at com.sun.star.sdbcx.comp.hsqldb.StorageAccess.writeLong(StorageAccess.java:124)
	at org.hsqldb.persist.RAStorageWrapper.writeLong(Unknown Source)
	... 12 more


I suspect that the issue is Java-related.

FWIW, I'm using JDK 1.8.0-112
Comment 2 Alex Thurgood 2016-11-22 11:55:20 UTC
This is also almost certainly only a MacOS problem, hence the addition of Stephan to CC.
Comment 3 Alex Thurgood 2016-11-22 11:56:42 UTC
Created attachment 128940 [details]
backtrace from lldb debugging session
Comment 4 Alex Thurgood 2016-11-22 11:57:29 UTC
Created attachment 128941 [details]
Corrupted test file
Comment 5 Stephan Bergmann 2016-11-22 14:51:09 UTC
Cannot reproduce with a local build of recent master on macOS 10.12 with JDK 1.8.0_112:  Downloaded Bug93391.odb from bug 93391 attachment 127257 [details] and followed the steps from comment 0; both DEMOTABLE in the Tables and in the Forms sections opens fine.  (Can reproduce the error "The connection to the data source 'Bug93391 copie' could not be established. The connection could not be established. The database was created by a newer version of LibreOffice." when using this bug's attachment 128941 [details], though.)
Comment 6 Robert Großkopf 2016-11-22 17:08:16 UTC
Seems to be this in the properties-file:

--------------------
#HSQL Database Engine 2.3.2
#Tue Nov 22 12:43:27 CET 2016
version=2.3.2
modified=yes
--------------------

Must be this:
--------------------
#HSQL Database Engine 1.8.0.10
#Fri Oct 07 18:57:44 CEST 2016
...
version=1.8.0
...
modified=yes
...
--------------------

Could it be you have installed a newer version of HSQLDB? Then see bug 34411. It's an old problem, has been gone sometimes and turned up again.
Comment 7 frofa 2016-11-23 01:19:55 UTC
On my setup (Mac OSX 11.6 LibreOffice Base v 5.2.3.3 and Oracle Java JDE 1.8.0_111) I can open your demo file in SPLIT MODE showing a single table DEMOTABLE (in the table list) with 4 records. No problems closing and reopening the file in this manner.
Comment 8 Alex Thurgood 2016-11-23 08:35:29 UTC
(In reply to robert from comment #6)


> 
> Could it be you have installed a newer version of HSQLDB? Then see bug
> 34411. It's an old problem, has been gone sometimes and turned up again.


Don't think I've configured my user profile to include the extra jar path, but I will check.
Comment 9 Alex Thurgood 2016-11-23 17:41:43 UTC
(In reply to robert from comment #6)


> Could it be you have installed a newer version of HSQLDB? Then see bug
> 34411. It's an old problem, has been gone sometimes and turned up again.

No, I just checked, I don't have any other hsqldb.jar in my LO config.
Comment 10 Alex Thurgood 2016-11-23 17:43:51 UTC
(In reply to Stephan Bergmann from comment #5)
> Cannot reproduce with a local build of recent master on macOS 10.12 with JDK
> 1.8.0_112:  Downloaded Bug93391.odb from bug 93391 attachment 127257 [details]
> [details] and followed the steps from comment 0; both DEMOTABLE in the
> Tables and in the Forms sections opens fine.  (Can reproduce the error "The
> connection to the data source 'Bug93391 copie' could not be established. The
> connection could not be established. The database was created by a newer
> version of LibreOffice." when using this bug's attachment 128941 [details],
> though.)

Hi Stepha, yes, I can open the original file Bug93391.odb too. However, when you close that file, shut down LO, restart LO and try to open the file again, it is then that I get the error messages.
Comment 11 Stephan Bergmann 2016-11-23 17:47:43 UTC
(In reply to Alex Thurgood from comment #10)
> Hi Stepha, yes, I can open the original file Bug93391.odb too. However, when
> you close that file, shut down LO, restart LO and try to open the file
> again, it is then that I get the error messages.

I did follow all the steps 1--8 from comment 0 when trying to reproduce the problem.
Comment 12 Alex Thurgood 2016-11-23 17:53:49 UTC
Arrghh, OK, forget all of this, I thought I couldn't find a second hsqldb JAR in my LO config, but I was wrong, so this is just a re-confirmation of bug 34411. When I removed the offending path and restarted LO5233 I could open, close and re-open old ODB files normally.

Sorry for all the noise.