Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Segfault in thread-safe PHP with parallel module #249

Open
garbetjie opened this issue Nov 21, 2019 · 0 comments
Open

Segfault in thread-safe PHP with parallel module #249

garbetjie opened this issue Nov 21, 2019 · 0 comments

Comments

@garbetjie
Copy link

garbetjie commented Nov 21, 2019

Hi there. I'm raising this as an issue here because it appears as if it is originating from the opencensus module. If this isn't the right place, I'm happy to close it and raise it where it should be raised.

It appears as if the parallel and opencensus modules don't play very well together. When I have both modules enabled, any attempts to create a new runtime from the parallel module yields a segfault. When the opencensus module is disabled, the runtime executes just fine without a segfault.

I have almost zero knowledge when it comes to PHP modules and source code, so please excuse any inconsistencies.

It appears as if the segfault is occurring in opencensus_trace_generate_class_name (ext/opencensus_trace.c:392). I have an example Docker image that replicates this behaviour:

  • Run the working example:
    docker run --rm garbetjie/opencensus-segfault ./run.sh oc-disabled.
    You should receive output of string(30) "got return value: return value".

  • Run the segfaulting example:
    docker run --rm -v $PWD:/app/mnt garbetjie/opencensus-segfault ./run.sh oc-enabled
    This will segfault, and will copy the core dump from the container to your current working directory on your Docker host.

PHP version is 7.3.11. GDB backtrace is below:

(gdb) backtrace 10
#0  0x00007f02a7fb348e in opencensus_trace_execute_internal (execute_data=0x7f02a7c1d190, return_value=0x7f02a7c1d120) at /tmp/opencensus-php-d1512abf456761165419a7b236e046a38b61219e/ext/opencensus_trace.c:623
#1  0x00007f02a7fb361b in opencensus_trace_execute_internal (execute_data=0x7f02a7c1d190, return_value=0x7f02a7c1d120) at /tmp/opencensus-php-d1512abf456761165419a7b236e046a38b61219e/ext/opencensus_trace.c:641
#2  0x00007f02a7fb361b in opencensus_trace_execute_internal (execute_data=0x7f02a7c1d190, return_value=0x7f02a7c1d120) at /tmp/opencensus-php-d1512abf456761165419a7b236e046a38b61219e/ext/opencensus_trace.c:641
#3  0x00007f02a7fb361b in opencensus_trace_execute_internal (execute_data=0x7f02a7c1d190, return_value=0x7f02a7c1d120) at /tmp/opencensus-php-d1512abf456761165419a7b236e046a38b61219e/ext/opencensus_trace.c:641
#4  0x00007f02a7fb361b in opencensus_trace_execute_internal (execute_data=0x7f02a7c1d190, return_value=0x7f02a7c1d120) at /tmp/opencensus-php-d1512abf456761165419a7b236e046a38b61219e/ext/opencensus_trace.c:641
#5  0x00007f02a7fb361b in opencensus_trace_execute_internal (execute_data=0x7f02a7c1d190, return_value=0x7f02a7c1d120) at /tmp/opencensus-php-d1512abf456761165419a7b236e046a38b61219e/ext/opencensus_trace.c:641
#6  0x00007f02a7fb361b in opencensus_trace_execute_internal (execute_data=0x7f02a7c1d190, return_value=0x7f02a7c1d120) at /tmp/opencensus-php-d1512abf456761165419a7b236e046a38b61219e/ext/opencensus_trace.c:641
#7  0x00007f02a7fb361b in opencensus_trace_execute_internal (execute_data=0x7f02a7c1d190, return_value=0x7f02a7c1d120) at /tmp/opencensus-php-d1512abf456761165419a7b236e046a38b61219e/ext/opencensus_trace.c:641
#8  0x00007f02a7fb361b in opencensus_trace_execute_internal (execute_data=0x7f02a7c1d190, return_value=0x7f02a7c1d120) at /tmp/opencensus-php-d1512abf456761165419a7b236e046a38b61219e/ext/opencensus_trace.c:641
#9  0x00007f02a7fb361b in opencensus_trace_execute_internal (execute_data=0x7f02a7c1d190, return_value=0x7f02a7c1d120) at /tmp/opencensus-php-d1512abf456761165419a7b236e046a38b61219e/ext/opencensus_trace.c:641

I'm not sure how much more information I can supply. However, if any more information is required, I'd be happy to try provide it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant