ho-dev / HattrickOrganizer

Assistant for Hattrick online football manager
https://ho-dev.github.io/HattrickOrganizer/
GNU Lesser General Public License v3.0
194 stars 79 forks source link

Startup Error #1345

Closed Chilimonster closed 2 years ago

Chilimonster commented 2 years ago

I upgraded to HO 5.1 on 20 Dec following the previous issued experienced in https://github.com/akasolace/HO/issues/1295. All has been good until this evening.

I have three teams, I get s Startup Error message only when opening HO for one team, the same team as for the previous issue in 1295 above.

The message is:

java.lang.NullPointerException: Cannot invoke "core.file.hrf.HRF.getHrfId()" because the return value of "core.db.HRFTable.getLatestHrf()" is null at core.db.DBManager.getLatestHrfId(DBManager.java:928) at core.model.HOVerwaltung.loadLatestHoModel(HOVerwaltung.java:120) at core.HO.main(HO.java:183) at core.HOLauncher.main(HOLauncher.java:75) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:84) at com.exe4j.runtime.WinLauncher.main(WinLauncher.java:94) at com.install4j.runtime.launcher.WinLauncher.main(WinLauncher.java:25)

Platform information:

The last good backup is attached.

Thanks,

Kevster db_user-2022-01-14.zip

github-actions[bot] commented 2 years ago

Hey, thanks for opening your first issue! 🙂 Be sure to check out the wiki and the HT forum for support.

wsbrenk commented 2 years ago

[Error] UserConfigurationTable: parameter lineupIncludeHTO is not stored in UserConfigurationTable [Error] UserConfigurationTable: parameter lineupIncludeTemplates is not stored in UserConfigurationTable [Info] HOVerwaltung: language used for interface is: English [Error] JDBCAdapter: JDBCAdapter.executeQuery : java.sql.SQLException: java.lang.OutOfMemoryError: Java heap space Statement: SELECT * FROM FAKTOREN java.sql.SQLException: java.lang.OutOfMemoryError: Java heap space at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.executeQuery(Unknown Source) at core.db.JDBCAdapter.executeQuery(JDBCAdapter.java:58) at core.db.FaktorenTable.getFaktorenFromDB(FaktorenTable.java:72) at core.db.DBManager.getFaktorenFromDB(DBManager.java:800) at core.model.HOVerwaltung.instance(HOVerwaltung.java:88) at core.HO.main(HO.java:172) Caused by: org.hsqldb.HsqlException: java.lang.OutOfMemoryError: Java heap space at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.result.Result.newErrorResult(Unknown Source) at org.hsqldb.result.Result.newErrorResult(Unknown Source) at org.hsqldb.StatementDMQL.execute(Unknown Source) at org.hsqldb.Session.executeCompiledStatement(Unknown Source) at org.hsqldb.Session.executeDirectStatement(Unknown Source) at org.hsqldb.Session.execute(Unknown Source) ... 7 more Caused by: java.lang.OutOfMemoryError: Java heap space at org.hsqldb.navigator.RowSetNavigatorData.ensureCapacity(Unknown Source) at org.hsqldb.navigator.RowSetNavigatorData.add(Unknown Source) at org.hsqldb.QuerySpecification.buildResult(Unknown Source) at org.hsqldb.QuerySpecification.getResult(Unknown Source) at org.hsqldb.StatementQuery.getResult(Unknown Source) ... 11 more

2022-01-15T10:48:13.995+0100 SEVERE db-user/database.data getFromFile failed 1059702 org.hsqldb.HsqlException: IO error: RowInputBinary 1059702 at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.rowio.RowInputBinary.readString(Unknown Source) at org.hsqldb.rowio.RowInputBinary.readChar(Unknown Source) at org.hsqldb.rowio.RowInputBase.readData(Unknown Source) at org.hsqldb.rowio.RowInputBinary.readData(Unknown Source) at org.hsqldb.rowio.RowInputBase.readData(Unknown Source) at org.hsqldb.rowio.RowInputBinary.readData(Unknown Source) at org.hsqldb.rowio.RowInputBinaryDecode.readData(Unknown Source) at org.hsqldb.RowAVLDisk.(Unknown Source) at org.hsqldb.persist.RowStoreAVLDisk.get(Unknown Source) at org.hsqldb.persist.DataFileCache.getFromFile(Unknown Source) at org.hsqldb.persist.DataFileCache.get(Unknown Source) at org.hsqldb.persist.RowStoreAVLDisk.get(Unknown Source) at org.hsqldb.index.NodeAVLDisk.findNode(Unknown Source) at org.hsqldb.index.NodeAVLDisk.getRight(Unknown Source) at org.hsqldb.index.IndexAVL.findNode(Unknown Source) at org.hsqldb.index.IndexAVL.findFirstRow(Unknown Source) at org.hsqldb.RangeVariable$RangeIteratorMain.getFirstRow(Unknown Source) at org.hsqldb.RangeVariable$RangeIteratorMain.initialiseIterator(Unknown Source) at org.hsqldb.RangeVariable$RangeIteratorMain.next(Unknown Source) at org.hsqldb.QuerySpecification.buildResult(Unknown Source) at org.hsqldb.QuerySpecification.getResult(Unknown Source) at org.hsqldb.StatementQuery.getResult(Unknown Source) at org.hsqldb.StatementDMQL.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.executeQuery(Unknown Source) at core.db.JDBCAdapter.executeQuery(JDBCAdapter.java:58) at core.db.AbstractTable.getSelectByHrfID(AbstractTable.java:110) at core.db.HRFTable.getHRF(HRFTable.java:212) at core.db.HRFTable.loadLatestHrf(HRFTable.java:65) at core.db.HRFTable.getLatestHrf(HRFTable.java:42) at core.db.DBManager.getLatestHrfId(DBManager.java:894) at core.model.HOVerwaltung.loadLatestHoModel(HOVerwaltung.java:120) at core.HO.main(HO.java:183) Caused by: java.io.UTFDataFormatException at org.hsqldb.lib.StringConverter.readUTF(Unknown Source) at org.hsqldb.lib.StringConverter.readUTF(Unknown Source) ... 36 more

[Error] JDBCAdapter: JDBCAdapter.executeQuery : java.sql.SQLException: IO error: RowInputBinary 1059702 Statement: SELECT * FROM HRF WHERE HRF_ID = 458 java.sql.SQLException: IO error: RowInputBinary 1059702 at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.executeQuery(Unknown Source) at core.db.JDBCAdapter.executeQuery(JDBCAdapter.java:58) at core.db.AbstractTable.getSelectByHrfID(AbstractTable.java:110) at core.db.HRFTable.getHRF(HRFTable.java:212) at core.db.HRFTable.loadLatestHrf(HRFTable.java:65) at core.db.HRFTable.getLatestHrf(HRFTable.java:42) at core.db.DBManager.getLatestHrfId(DBManager.java:894) at core.model.HOVerwaltung.loadLatestHoModel(HOVerwaltung.java:120) at core.HO.main(HO.java:183) Caused by: org.hsqldb.HsqlException: IO error: RowInputBinary 1059702 at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.rowio.RowInputBinary.readString(Unknown Source) at org.hsqldb.rowio.RowInputBinary.readChar(Unknown Source) at org.hsqldb.rowio.RowInputBase.readData(Unknown Source) at org.hsqldb.rowio.RowInputBinary.readData(Unknown Source) at org.hsqldb.rowio.RowInputBase.readData(Unknown Source) at org.hsqldb.rowio.RowInputBinary.readData(Unknown Source) at org.hsqldb.rowio.RowInputBinaryDecode.readData(Unknown Source) at org.hsqldb.RowAVLDisk.(Unknown Source) at org.hsqldb.persist.RowStoreAVLDisk.get(Unknown Source) at org.hsqldb.persist.DataFileCache.getFromFile(Unknown Source) at org.hsqldb.persist.DataFileCache.get(Unknown Source) at org.hsqldb.persist.RowStoreAVLDisk.get(Unknown Source) at org.hsqldb.index.NodeAVLDisk.findNode(Unknown Source) at org.hsqldb.index.NodeAVLDisk.getRight(Unknown Source) at org.hsqldb.index.IndexAVL.findNode(Unknown Source) at org.hsqldb.index.IndexAVL.findFirstRow(Unknown Source) at org.hsqldb.RangeVariable$RangeIteratorMain.getFirstRow(Unknown Source) at org.hsqldb.RangeVariable$RangeIteratorMain.initialiseIterator(Unknown Source) at org.hsqldb.RangeVariable$RangeIteratorMain.next(Unknown Source) at org.hsqldb.QuerySpecification.buildResult(Unknown Source) at org.hsqldb.QuerySpecification.getResult(Unknown Source) at org.hsqldb.StatementQuery.getResult(Unknown Source) at org.hsqldb.StatementDMQL.execute(Unknown Source) at org.hsqldb.Session.executeCompiledStatement(Unknown Source) at org.hsqldb.Session.executeDirectStatement(Unknown Source) at org.hsqldb.Session.execute(Unknown Source) ... 10 more Caused by: java.io.UTFDataFormatException at org.hsqldb.lib.StringConverter.readUTF(Unknown Source) at org.hsqldb.lib.StringConverter.readUTF(Unknown Source) ... 36 more

[Error] ExceptionHandler: java.lang.NullPointerException: Cannot invoke "core.file.hrf.HRF.getHrfId()" because the return value of "core.db.HRFTable.getLatestHrf()" is null [Error] ExceptionHandler: core.db.DBManager.getLatestHrfId(DBManager.java:894) [Error] ExceptionHandler: core.model.HOVerwaltung.loadLatestHoModel(HOVerwaltung.java:120) [Error] ExceptionHandler: core.HO.main(HO.java:183)

wsbrenk commented 2 years ago

contents of database.properties:

HSQL Database Engine 2.4.1

Fri Jan 14 01:35:08 GMT 2022

tx_timestamp=0 modified=yes version=2.4.1

from hsql-docs:

If it is an existing database, check in the test.properties file if 'modified=yes'. This would mean last time it was not closed correctly, and thus the test.data file may be corrupted or incomplete. In this case the 'REPAIR' algorithm is executed (see below), before the database is opened normally.

Repair The current test.data file is corrupt, but with the old test.data (from the test.backup file and test.script) and the current test.log, the database is made up-to-date. The database engine takes these steps:

Procedure C.3. Database Repair

  1. Restore the old test.data file from the backup (uncompress the test.backup and overwrite test.data).

  2. Execute all commands in the test.script file.

  3. Execute all commands in the test.log file. If due to corruption, an exception is thrown, the rest of the lines of command in the test.log file are ignored.

  4. Close the database correctly (including a backup).

wsbrenk commented 2 years ago

i see two options concerning HO's backup strategy:

wsbrenk commented 2 years ago
private static File[] getFilesToBackup(File dbDirectory) {
    return dbDirectory.listFiles(file -> {
        String name = file.getName();
        return (name.endsWith(".script") || name.endsWith(".data")
                || name.endsWith(".backup") || name.endsWith(".properties"));
    });
}

only .log is missing!?

Chilimonster commented 2 years ago

Hi, thanks for looking at this, I'm not a tech wizard, so am struggling to understand what you are asking me to do.

In the first repose today, you mention test.back, test.script and test.data files. I cannot see these. Can you explain simply what I need to do?

Alternatively, there is a mention in the second response today talking about repair of backuped files. Is this sometging you are offering to do? What do I need to provide?

Alternatively, I have backup files saved from 10th, 12th and 13th December 2021. Could these be used a simple fix?

Please advise what I should do.

Thanks

wsbrenk commented 2 years ago

@Chilimonster your ho database in uploaded zip is corrupted. if you have older ones, please try them. maybe one of them is OK.

simply replace files in db folder by the content of zip files.

akasolace commented 2 years ago

@wsbrenk this could indeed be a solution. If .backup exist db zip is not created .... At launch, if .backup exist HO offers a recovery solution ... offers to restore to last zip file (not containing .backup and that should not be corrupted). what do you think ?

Chilimonster commented 2 years ago

@wsbrenk I used the backup files from last month and I no longer get the Startup error. I have downloaded recent data, shutdown and restarted - all seems good so far.

Thanks

wsbrenk commented 2 years ago

@akasolace we should investigate the mentioned procedure c3: Database repair. if we could control it then

backups should include .backup AND .log files to enable repair procedure even on restored backups

akasolace commented 2 years ago

@wsbrenk for me if a .backup file remains it means the automatic repair failed, no?

if it is an existing database, check in the test.properties file if 'modified=yes'. This would mean last time it was not closed correctly, and thus the test.data file may be corrupted or incomplete. In this case the 'REPAIR' algorithm is executed (see below), before the database is opened normally

wsbrenk commented 2 years ago

@akasolace i don't think so.

backup and log files remains if shutdown doesn't work correctly - power down, job was killed or...

on next startup opening the database will start the repair process, which works with those files as descriped above. but before the database is opened, the zip-backup will be created. if it don't saves the log and the backup, those backups are useless like the zip from @Chilimonster.

akasolace commented 2 years ago

If I understand correctly, zip of database is done at launch before accessing the db. Hence : At start .zip is created (but log file not included). Do even if repair works zip file will be useless, correct?

wsbrenk commented 2 years ago

@akasolace right - that is the current situation. if we would include the .log, and if the repair would work perfectly and the user again kills the HO process givin a situation that could not be repaired than the zip could be used to redo the repairation again!?

akasolace commented 2 years ago

@wsbrenk I just tested it and I can confirm the workflow

akasolace commented 2 years ago

However, I have no database.backup but a database.tmp