fdm icon indicating copy to clipboard operation
fdm copied to clipboard

fdm fails to delete lock file on error

Open zoomosis opened this issue 5 months ago • 3 comments

fdm refuses to restart after an error due to the previous instance failing to delete its lock file:

version is: fdm 2.2, started at: Sat Oct 11 19:57:00 2025
pmail: got message 1 of 1: size 1869, body 1825
pmail: message 1, running action INBOX:0 (maildir) as user morgan
pmail: io: poll: Operation timed out
pmail: fetching error. aborted
pmail: 0 messages processed in 35.306 seconds
fatal: main: privsep_recv error
version is: fdm 2.2, started at: Sat Oct 11 20:00:00 2025
already running (/home/morgan/.fdm.lock exists)
version is: fdm 2.2, started at: Sat Oct 11 20:03:00 2025
already running (/home/morgan/.fdm.lock exists)
version is: fdm 2.2, started at: Sat Oct 11 20:06:00 2025
already running (/home/morgan/.fdm.lock exists)

...

I believe the fix here is to call unlink(conf.lock_file) before exit(1) in log_vfatal().

Though I suspect it would be more reliable to use atexit() to call unlink().

zoomosis avatar Oct 12 '25 05:10 zoomosis

I think this is intentional, it is a fatal error not a normal exit.

nicm avatar Oct 12 '25 06:10 nicm

I think this is intentional, it is a fatal error not a normal exit.

The current behaviour is not documented anywhere and violates POLA.

zoomosis avatar Oct 12 '25 08:10 zoomosis

Probably the main process should not be calling fatal when a child times out.

nicm avatar Oct 12 '25 08:10 nicm