From 9da8d01f24ff2d2985ac9fef6145ce7f8943abbb Mon Sep 17 00:00:00 2001 From: Venkatesh Dayananda Date: Mon, 27 Feb 2023 13:28:51 +0530 Subject: [PATCH 1/2] remove corrupted pidfile --- src/Dex.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Dex.jl b/src/Dex.jl index 8a3dc20..c2271d2 100644 --- a/src/Dex.jl +++ b/src/Dex.jl @@ -14,8 +14,15 @@ mutable struct DexCtx ctx = new(workdir, nothing, nothing) pfile = pidfile(ctx) if isfile(pfile) - ctx.pid = parse(Int, read(pidfile(ctx), String)) - isrunning(ctx) + ctx.pid = try + parse(Int, read(pidfile(ctx), String)) + catch ex + rm(pidfile) + rethrow(ex) + end + if !isrunning(ctx) + ctx.pid = nothing + end end ctx end From 4dd8520e3e24910d667b729bdbc253c8b6a3a199 Mon Sep 17 00:00:00 2001 From: Venkatesh Dayananda Date: Mon, 27 Feb 2023 13:30:56 +0530 Subject: [PATCH 2/2] add log info on removing pidfile --- src/Dex.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Dex.jl b/src/Dex.jl index c2271d2..c78935d 100644 --- a/src/Dex.jl +++ b/src/Dex.jl @@ -17,6 +17,7 @@ mutable struct DexCtx ctx.pid = try parse(Int, read(pidfile(ctx), String)) catch ex + @info "removing corrupted pid file" rm(pidfile) rethrow(ex) end