benini / scid

Other
44 stars 14 forks source link

Tiny database got corrupted #140

Closed gdinit closed 1 year ago

gdinit commented 1 year ago

Hi benini,

You may remember that I logged a separate issue earlier; that matter was later traced down to sort of user error. A stray Stockfish engine process was holding a file lock and was preventing the compact operation from completing successfully. ref: https://github.com/benini/scid/issues/135

Now, I have another database issue. This time, during annotation, SCID crashed and after re-opening SCID, I was unable to open the database again. This is a new and tiny database with less than 20 games.

I can still open it as a "tree" but cannot open it as a normal database. After opening it as a tree, attempting to open a Game List window leads to SCID crash.

I have uploaded the database here: https://we.tl/t-6ofLGi9eH1

Could you please kindly take a look, and if it is possible to fix it, could you please teach me how to fix it? If there is an in-house utility you use to fix corrupt files, can I have access please? (I ask for the procedure/potential utility, so that I can self service any future similar databases that may end up not openable due to application crash without bothering you again every time).

Thank you

benini commented 1 year ago

Thanks for reporting, there are two different issues: 1) why SCID crashed? Do you think the system may have run out of memory? 2) it was impossible to save all the data of the last game. Issue nr. 2 is related to a feature not yet implemented (https://github.com/benini/scid/issues/103) and in the future it should be able to open the corrupted database automatically. In the meanwhile it is possible to recover the database with the command: printf "0??????0??????1??????2??????3??????" >> games_i_studied.sn5 that adds ?????? names to the database.

Here the fixed database: fixed.zip

rolandlo commented 1 year ago

Just to report: I had the same problem with one of my databases. SCID crashed after Gnome shell somehow decided to close all apps and through me back to the login screen after I plugged in a cable for the external monitor. I also had to fix the name database by adding some entries (and did it via hexedit). So everything is working again.

gdinit commented 1 year ago
  1. why SCID crashed? Do you think the system may have run out of memory? I do not know why it crashed.

OOM is very unlikely as this is a Windows 10 system with 32 GB memory and the system was not doing much at the time of SCID crash (SCID was the only active & heavy application; it also had a few other applications such as text editor but nothing major).

On the same night I was working on the home network and at some point due to TCP/IP readdressing, computer lost network connectivity - it has network mounted volumes which could be like pulling the rug from under however with a quick check now, it appears all SCID binaries and files are located on the O/S volume (C:) and nothing is on a network-mounted volume.

On the same system, there is also an encrypted USB volume via VeraCrypt which hosts the massive 'Syzygy End Game Table Bases for the Stockfish engine (which is what was doing the annotation at the time of crash) but again neither the VeraCrypt application crashed nor the USB volume got pulled out.

Overall I am not sure why it crashed. I will keep an investigative eye out and at the time of next crash will document the state of things & jump to the Event Viewer and look around. If I find anything useful I will report back in this (by then closed) issue.

  1. it was impossible to save all the data of the last game. Issue nr. 2 is related to a feature not yet implemented (Use a jthread to check SCID5 index integrity #103) and in the future it should be able to open the corrupted database automatically.

Cool, great to hear that this issue will go away in the future.

In the meanwhile it is possible to recover the database with the command: printf "0??????0??????1??????2??????3??????" >> games_i_studied.sn5 that adds ?????? names to the database.

Fantastic, thank you for showing the procedure. I tried this on my PC and I was able to fix it as well, good to have that in the toolbox.

Here the fixed database: fixed.zip

Awesome, thank you very much!

@benini, I am happy to close this issue now however there is one more comment and I was not sure if you would like it closed now ?