Change 32904

tom_tyler (C. Thomas Tyler)
C. Thomas Tyler committed this change into //guest/perforce_software/sdp/dev under Review 32858
View Review
Download .zip
strace support for p4d, p4broker, and p4p SDP init scripts

Added diagnostic strace feature to p4d_base, p4broker_base, and p4p_base.
When a file $LOGS/.strace.<ServiceName> exists at start time, strace is
enabled using one of two modes selected automatically:

  - Wrap mode (systemd): strace runs the service binary as its child
    process, capturing every syscall from the very first instruction.
    Ideal for diagnosing startup-phase issues (e.g. replica startup threads).

  - Attach mode (non-systemd): strace attaches to the already-running
    service after startup using strace -p <pid>. Best effort -- early
    startup syscalls may be missed.

Strace output goes to $LOGS/strace.<ServiceName>.<YYYYMMDD_HHMMSS>.log;
in attach mode the strace PID is also recorded in
$LOGS/.strace.<ServiceName>.pid.

Shared functions live in a new library: /p4/common/lib/strace.lib

Also added startup/shutdown logging to p4broker_base and p4p_base, which
previously had no init logging.

Added documentation: doc/Using_strace_for_SDP_Services.md

Fixes SDP-1365 (Feature): Add strace support to p4*_base init scripts, with docs.
#review-32858 @tom_tyler @robert_cowham
  • Files 5
  • Comments 0
3 edited 2 added 0 deleted
Server/Unix/p4/common/bin/p4broker_base#23
Loading...
Server/Unix/p4/common/bin/p4d_base#53
Loading...
Server/Unix/p4/common/bin/p4p_base#28
Loading...
Server/Unix/p4/common/lib/strace.lib#1
Loading...
doc/Using_strace_for_SDP_Services.md#1
Loading...
Tip: Use n and p to cycle through the changes.