ho-dev / HattrickOrganizer

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

[BUG] Fatal database error #584

Closed Dillotu closed 4 years ago

Dillotu commented 4 years ago

Hi guys

HO does not start anymomre.

Error message Fatal database error You should restore the db-folder from backup or delete that folder.

If I click OK I have the option to set the last 3 db in the list

14/06 15/06 17/06

No one works.

I also tried to replace the db manually in the folder from the zip file with no luck unfortunately.

Can you please let me know how can I recover the DB?

Thanks

Platform information:

akasolace commented 4 years ago

@tychobrailleur might be a good test for your new db tool?

tychobrailleur commented 4 years ago

In the first of the three DBs:

sql> select * from userconfiguration where config_key = 'DBVersion';
CONFIG_KEY  CONFIG_VALUE
----------  ------------

Fetched 0 rows.
sql> select * from userconfiguration ;
CONFIG_KEY                  CONFIG_VALUE
--------------------------  ------------
transferTypePane_splitPane  302
updateCheck                 true
waehrungsID                 3
xmlDownload                 true
zahlenFuerSkill             true
zellenbreitenFaktor         1.0

which is quite weird. Same with the last. Without DBVersion in userconfiguration, the app will not start.

akasolace commented 4 years ago

how on earth could that be missing ?

tychobrailleur commented 4 years ago

how on earth could that be missing ?

No idea, also odd is that transferTypePane_splitPane is 302, like the version – maybe a coincidence...

I have changed the repair tool to add the DBVersion, the app now starts, but then goes into loop:

URL: https://chpp.hattrick.org/chppxml.ashx?file=matchorders&matchID=662815588&sourceSystem=hattrick&version=3.0&teamId=281586
 [Info]    HOMainFrame: This is HO! version 0.0, have fun!
 [Info]    HOMainFrame: Operating system found: Mac OS X on x86_64 (10.14.6)
 [Info]    HOMainFrame: Using java: 1.8.0_77 (Oracle Corporation)
URL: https://chpp.hattrick.org/chppxml.ashx?file=matchorders&matchID=662815588&sourceSystem=hattrick&version=3.0&teamId=281586
 [Info]    HOMainFrame: This is HO! version 0.0, have fun!
 [Info]    HOMainFrame: Operating system found: Mac OS X on x86_64 (10.14.6)
 [Info]    HOMainFrame: Using java: 1.8.0_77 (Oracle Corporation)
URL: https://chpp.hattrick.org/chppxml.ashx?file=matchorders&matchID=662815588&sourceSystem=hattrick&version=3.0&teamId=281586
 [Info]    HOMainFrame: This is HO! version 0.0, have fun!
 [Info]    HOMainFrame: Operating system found: Mac OS X on x86_64 (10.14.6)
 [Info]    HOMainFrame: Using java: 1.8.0_77 (Oracle Corporation)
URL: https://chpp.hattrick.org/chppxml.ashx?file=matchorders&matchID=662815588&sourceSystem=hattrick&version=3.0&teamId=281586
 [Info]    HOMainFrame: This is HO! version 0.0, have fun!
 [Info]    HOMainFrame: Operating system found: Mac OS X on x86_64 (10.14.6)
 [Info]    HOMainFrame: Using java: 1.8.0_77 (Oracle Corporation)

Cause by MyConnector:

                    System.out.println("URL: " + surl);
                    if (authDialog == null) {
                        // disable WaitCursor to unblock GUI
                        CursorToolkit.stopWaitCursor(HOMainFrame.instance().getRootPane());
                        authDialog = new OAuthDialog(HOMainFrame.instance(), m_OAService, "");
                    }

it looks the HOMainFrame instance method calls itself before the constructor completes, which means the null check is always false in the instance() method. Another weird one, not sure why we never came across this before.

It happens when HOMainFrame loads the tabs, the DB is missing some match info that's already in the db, and tries to download that info, but the user configuration doesn't contain any oauth token. It therefore tries to create an OAuth dialog with HOMainFrame as a parent, but that goes into that loop again.

A user would think the app is hanging, and would kill the process, therefore potentially causing the db to go corrupt.
I'll create a PR for the release branch 3.x.

tychobrailleur commented 4 years ago

I have created a PR for 3.x to address the infinite loop in the constructor, but that still doesn't explain how the USERCONFIGURATION table got into that state where virtually all rows disappeared. Did something happen to HO on 14th June, @Dillotu ? Did you upgrade version or something?

In the meantime, here is a link to a fixed db: https://send.firefox.com/download/fd55f03eb4ddedd2/#lfjYDhr_Xj6o1_RtZi54bA

Dillotu commented 4 years ago

I have created a PR for 3.x to address the infinite loop in the constructor, but that still doesn't explain how the USERCONFIGURATION table got into that state where virtually all rows disappeared. Did something happen to HO on 14th June, @Dillotu ? Did you upgrade version or something?

In the meantime, here is a link to a fixed db: https://send.firefox.com/download/fd55f03eb4ddedd2/#lfjYDhr_Xj6o1_RtZi54bA

Hi Thank you very much The DB works properly it's amazing !!!

To be honest I don't remember what happened with the 14/06 DB maybe, but I'm not sure, the system restarted when HO was open

Cheers

akasolace commented 4 years ago

@tychobrailleur I let you close the issue if you think it is all done ....