Error
I just hit that issue: I was uploading a 100 GB file to the intranet and the app crashed. When I restarted the app (4.4.4 alpha), the transfer was then removed by Engine.remove_staled_tansfers() because the transfer was still ongoing as the app did not have time to change its state before correctly quitting.
Here is the only information available before the crash:
(process:30472): GLib-ERROR **: 11:46:00.155: Creating pipes for GWakeup: Trop de fichiers ouverts 30472 Trappe pour point d'arrêt et de trace
Fix
First, we need to have a way to know if the app has crashed.
Then, at startup, if the app did not crash, then we can remove staled transfers.
Knowing When the Application Crashed
Idea 1: store a value in the database of the Manager, something like has_crashed:
- At startup:
- If the value is True, it will mean the app crashed.
- If the value does not exist, or is set to False, it will mean the app did not crash.
- When the startup is completely done, set the value to True.
- At exit, the value is set to False.
Idea 2: create a "crash" file in the NXDRIVE_HOME folder:
- At startup:
- If the file exists, it will mean the app crashed.
- If the files does not exist, it will mean the app did not crash.
- When the startup is completely done, create the file.
- At exit, delete the file.
For both ideas, on crash, the "at exit" step will not be done, so at the next start we will know that the app crashed.
The second idea may be better as it does not rely on the database, which can be altered or part of the crash source.
Implementation Details
Using the idea 2, a new global option will be added: Options.has_crashed (boolean).
- is caused by
-
NXDRIVE-1919 Remove staled transfers at startup
- Resolved
- is duplicated by
-
NXDRIVE-2214 Drive doesn't resume the transfer properly after closing the laptop for the night.
- Resolved
- Is referenced in