Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stats don't get cleared after shutting down the systemd service #14

Closed
glitsj16 opened this issue Dec 30, 2019 · 4 comments
Closed

stats don't get cleared after shutting down the systemd service #14

glitsj16 opened this issue Dec 30, 2019 · 4 comments
Labels
porting Needs to be ported to a different branch or project

Comments

@glitsj16
Copy link
Collaborator

glitsj16 commented Dec 30, 2019

Fdns stats in /dev/shm/fdns-stats stay lingering on the system after stopping the systemd service. I suspect this also affects users who don't use the systemd unit. This has two side-effects that I find confusing:

  • when fdns --monitor is running, stopping the fdns systemd service doesn't terminate fdns --monitor output (nor is there any indication the service is in fact dead);
  • when the fdns systemd service is stopped, it is still possible to run fdns --monitor, which happily reports all the earlier stats.

Perhaps this could be improved upon. For now I added an ExecPostStop command to clean it up, but that's not a full alternative. IMHO this should be done by fdns itself.

Side-note: I realize the decision to put the stats into /dev/shm probably has to do with the original plan to integrate fdns into firejail, but rkhunter and the likes frown upon finding files in /dev/shm. Perhaps a small note is welcome that informs the user of what's going on exactly...

@netblue30 netblue30 added the bug Something isn't working label Dec 30, 2019
@startx2017 startx2017 reopened this Jan 5, 2020
@startx2017 startx2017 added porting Needs to be ported to a different branch or project and removed bug Something isn't working labels Jan 5, 2020
@startx2017
Copy link
Collaborator

Fixed in fdns, need to port it to firetools. There is an up to 10s delay until the monitor detects fdns went down.

@glitsj16
Copy link
Collaborator Author

glitsj16 commented Jan 5, 2020

@startx2017 Thanks for the work on this. The monitor now makes much more sense. But /dev/shm/fdns.stats still stays present after fdns stop (at least on Arch Linux, haven't tested Ubuntu yet). Maybe that's the 'new' intended behaviour? As stated above it can be easily cleaned up in the systemd service via a simple ExecStopPost command. But users that don't use the systemd service will have to take some other action.

@netblue30
Copy link
Owner

But /dev/shm/fdns.stats still stays present after fdns stop

If the user does a "sudo pkill fdns" we get a chance to remove the file by intercepting the signal before the process gets killed. However if the kernel decides to kill the process (equivelent to kill -9), the process will just be killed without receiving a signal first.

I'll bring in the signal part, but let's put in ExecStopPost also, is like a best effort.

glitsj16 added a commit that referenced this issue Jan 5, 2020
@glitsj16
Copy link
Collaborator Author

glitsj16 commented Jan 5, 2020

... let's put in ExecStopPost also, is like a best effort

Done in bd89850. We can adjust the ExecStopPost command later when the signal part is implemented. Although 'rm -f /dev/shm/fdns-stats' does the job for now, it would be cleaner to have something like '/usr/bin/fdns --clear-stats'. Just a thought...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
porting Needs to be ported to a different branch or project
Projects
None yet
Development

No branches or pull requests

3 participants