[lttng-dev] Problem using UST with PHP

Ettore Del Negro ettore at ettoredelnegro.me
Sat Mar 31 14:41:29 EDT 2012


Hello,
i missed that part of the README, thanks for let me know.
Summing up, i have to link PHP with -llttng-ust and preload the fork
library using something like:

env LD_PRELOAD="/usr/lib64/liblttng-ust-fork.so" /usr/sbin/php-fpm
--fpm-config /etc/php5/fpm/php-fpm.conf

Is that right?

Before your reply i ran PHP without LD_PRELOAD'ing and apparently all
went fine. Is that a normal behavior? What should i expect to happen if
i don't preload it? Is it possible i get misleading results (timestamps)?
Maybe it's worth to note i run FPM with only one child, so it forks only
once.

Thanks,
Ettore

On 13/3/2012 11:42 PM, Mathieu Desnoyers wrote:
> * Ettore Del Negro (ettore at ettoredelnegro.me) wrote:
>> Hello,
>> thanks for reply, anyway i already found what was missing: #define
>> TRACEPOINT_CREATE_PROBES
>> I looked at lttng-ust-2.0.0-rc2/tests/fork/fork.c and saw it, since
>> i'm using a fork-based SAPI (PHP-FPM) i gave it a try and worked.
> FYI, if your application forks without issuing execs afterward, you'll
> need to LD_PRELOAD liblttng-ust-fork.so. Quoting the README:
>
>   - liblttng-ust-fork
>     A library that is LD_PRELOAD'ed, and that hijacks calls to several system
>     calls in order to trace across these calls. It _has_ to be LD_PRELOAD'ed
>     in order to hijack calls. In contrast, libust may be linked at build time.
>
>
>> Maybe is it worth to add a a note in the README?
>>
>> The relevant diff applied to PHP is this: https://github.com/ettoredn/php-debug/commit/f1f6c6f23c1ea6c82b9ff9d5a1b46565f1c36b0e
>> (note: see next commit for zend_trace_provider.h, i forgot it in this one).
>>
>> Now my question becomes: why TRANCEPOINT_CREATE_PROBES is needed with fork?
> TRACEPOINT_CREATE_PROBE is needed with each instrumentation style, it
> should appear at least once in the program (even for the hello test
> program).
>
> Thanks,
>
> Mathieu
>




More information about the lttng-dev mailing list