Log cleanup fails before succeeding

Please describe what you are doing to trigger the bug:
Scheduled backups run via duplicacy-web. The internal log rotation attempts to delete logs, but the file handle is still open.

Please describe what you expect to happen (but doesn’t):
The log file should be deleted properly on first attempt.

Please describe what actually happens (the wrong behaviour):
I think there’s a possible race condition occurring. See the following snippet from duplicacy_web.log:

2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 Failed to delete the log file : remove /logs: device or resource busy
2019/07/31 23:31:16 The log file backup-20190720-185548.log has been deleted
2019/07/31 23:31:16 The log file backup-20190723-141849.log has been deleted

This is caused by attempting to delete a log file with an empty file name. I’ll fix it in the next update.

1 Like