pi-hole / FTL

The Pi-hole FTL engine
https://pi-hole.net
Other
1.39k stars 196 forks source link

Enable debug mode when debugger is detected #2120

Closed DL6ER closed 19 hours ago

DL6ER commented 4 days ago

What does this implement/fix?

During #2112, it became an issue that gdb is only able to follow one process at a time. This can either be (a) the main process, causing any forks to run unsupervised, or (b) following the new fork, either (b.1) detaching from the main process or (b.2) freezing the main process while the fork is being traced. (a) is the default behavior.

All three possibilities are not really what we want. This PR adds a mechanism to detect if the debugger is being attached and - if so - stops forking temporarily until the debugger is again detached. Even when this has a possible performance impact on TCP connections, it allows gdb to follow the program closely and will help us to debug crashes only becoming visible in TCP forks.


Related issue or feature (if applicable): #2112

Pull request in docs with documentation (if applicable): N/A


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

Checklist:

DL6ER commented 4 days ago

vforks are special and are probably unrelated to "real" TCP forks. They may be the consequence of pihole-FTL calling arp or any other CLI process - did you observe actual forks (can be seen in the log as 1234/F678)?

Even with this PR, it is expected that other processes we are calling are considered forks - we don't want to debug, e.g., ip address show

yubiuser commented 3 days ago

did you observe actual forks

Not within the last 10 hours.