I want to get closer to the point of segmentation fault.
First let me share the ineffective approaches and then share the effective approaches.
Ineffective approaches:
- Logged lots of printfs to some text file, to trace the flow of execution.
- Attached the debugger to 'apache listen process'
- set follow-fork-mode child
Effective approach:
Configured my apache to have only one child(worker process) at any time.
StartServers 1
MinSpareServers 1
MaxSpareServers 0
MaxClients 150
MaxRequestsPerChild 0
With this configuration you will see only 2 apache processes at any time.
One process owned by 'root', a listener process(which we do not care), another by apache user(which we care).
- Attach a debugger to process owned by 'apache'
- set a relevant breakpoints, watchpoints etc.
- Allow the process to continue
- Make a http request
- You will get a control in your debugger.
Apache process which remains alive across requests is not a worker apache.