Project

General

Profile

Feature #2460

Why is charon.pid deleted before SA teardown is performed?

Added by c c over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
charon
Target version:
Start date:
Due date:
Estimated time:
Resolution:
Fixed

Description

In the main function of charon:

    /* normal termination, cleanup and exit */
    unlink_pidfile();
    status = 0;

deinit:
    libcharon_deinit();
    library_deinit();
    return status;


When charon tries to exit, it deletes charon.pid file and then do some cleanup.

It seems to make more sense to delete charon.pid afterwards, so that the existence of charon.pid better indicates whenter charon is still alive. Or else there seems no convenient to check the liveness of charon if not wanting to use ps or top.

Associated revisions

Revision 1b4d97db (diff)
Added by Tobias Brunner over 2 years ago

charon: Unlink PID file after daemon deinit (i.e. after unloading plugins etc.)

Make sure, though, that we only remove the file if we actually
created it (e.g. not for --help or --version). And do so before
deinitializing libstrongswan due to leak detective.

Fixes #2460.

Revision 291b0226 (diff)
Added by Tobias Brunner over 2 years ago

charon-tkm: Unlink PID file after deinit

Same change as for charon in the previous commit.

References #2460.

History

#1 Updated by Tobias Brunner over 2 years ago

  • Status changed from New to Feedback

I guess we could do that later, but must ensure we don't delete the PID file if we didn't actually create it (e.g. if we abort due to an already existing PID file, or when called with --help). I pushed a commit to the 2460-pidfile-unlink branch.

#2 Updated by c c over 2 years ago

Why "abort due to an already existing PID file"?
To ensure that there is only one charon instance running? What if charon gets killed and the pid file remains?

#3 Updated by Tobias Brunner over 2 years ago

To ensure that there is only one charon instance running?

Yes.

What if charon gets killed and the pid file remains?

source:src/charon/charon.c#L193

#4 Updated by Tobias Brunner over 2 years ago

  • Tracker changed from Issue to Feature
  • Category set to charon
  • Status changed from Feedback to Closed
  • Assignee set to Tobias Brunner
  • Target version set to 5.6.1
  • Resolution set to Fixed

Also available in: Atom PDF