Database error takes down UI!

After a reboot of one of my machines running Syncthing I was observing strange behaviour in the web UI with the folders seemingly randomly changing state between “Unknown”, “Waiting to Scan” and “Scanning”. That was interspersed with connection errors.

After observing this for a couple of hours I decided to poke around in the filesystem to see if something was awry. It turned out that loads of “panic-YYYYMMDD-HHMMSS.reported.log” files were getting created in ~/.config/syncthing, so presumably the entire server was crashing and restarting over and over. The error in these files is “device present in global list but missing as device/fileinfo entry”. There’s also an “index-v0.14.0.db.needsrepair” file in there.

It seems strange to me that a database error should take out the entire server, including the UI part. Surely the UI should keep running even if the worker part encounters an error? Then the UI could report the error. Having to watch the UI for a while and infer from its erratic behaviour that there’s a deeper problem, then go poking around log files to find the actual error isn’t a great user experience.

There’s clearly a bad bug here, which prevents db self-healing on startup, which is investigated in your other thread: How do I repair the index database?. That’s why the following doesn’t work for you, but it still applies:

When detecting a fatal error, meaning Syncthing cannot work any more, it shuts down. The web UI is part of the Syncthing service, it’s not a separate thing, thus shuts down too. Then the service manager you use or Syncthing’s monitor process restarts Syncthing. In case of a db error, a check and repair process will happen on startup. In other cases or if that fails and Syncthing crashes again, the service manager/monitor should eventually stop trying to restart Syncthing. Then there’s no web UI available at all, and the user will check the logs and sees the problem there.

What would definitely be an improvement in UX is adding a panic notification to the UI: Have a notification at the top saying that Syncthing panicked, with an option to display a list of panics and potentially even allowing to open those panics, getting the logs and backtraces.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.