Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfaults in php agent module / elasticApmZendThrowExceptionHookImpl() #923

Closed
keeshoekzema opened this issue Apr 21, 2023 · 4 comments
Closed
Assignees
Labels
agent-php bug Something isn't working
Milestone

Comments

@keeshoekzema
Copy link

keeshoekzema commented Apr 21, 2023

Describe the bug
When using the apm-agent-php module on a busy server, the agent sometimes crashes with a segfault.

To Reproduce
(Un)fortunately, the error doesn't appear very often. But it seems to be a recursive loop. This one was caught twice in ~3 days
My relevant configuration:
elastic_apm.server_url="http://localhost:8200"
elastic_apm.transaction_ignore_urls=/healthcheck*
elastic_apm.transaction_sample_rate=0.1
elastic_apm.profiling_inferred_spans_enabled=true
elastic_apm.verify_server_cert = false

I'm using php8.1 and apm-agent-php 1.8.1

Expected behavior
No crash.

A gdb bt on the generated core shows:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f96236c8c0c in elasticApmZendThrowExceptionHookImpl () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
[Current thread is 1 (Thread 0x7f962b638c40 (LWP 1937845))]
#0  0x00007f96236c8c0c in elasticApmZendThrowExceptionHookImpl () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#1  0x00007f96236c91ec in elasticApmZendThrowExceptionHook () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#2  0x00007f96236c9208 in elasticApmZendThrowExceptionHook () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#3  0x00007f96236c9208 in elasticApmZendThrowExceptionHook () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#4  0x00007f96236c9208 in elasticApmZendThrowExceptionHook () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
[.. several minutes later..]
#261670 0x00007f96236c9208 in elasticApmZendThrowExceptionHook () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#261671 0x00007f96236c9208 in elasticApmZendThrowExceptionHook () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#261672 0x00007f962a5250f4 in zend_throw_exception_internal () from /usr/lib/apache2/modules/libphp8.1.so
#261673 0x00007f962a5251ff in ?? () from /usr/lib/apache2/modules/libphp8.1.so
#261674 0x00007f962a525297 in zend_throw_exception () from /usr/lib/apache2/modules/libphp8.1.so
#261675 0x00007f962a511922 in zend_value_error () from /usr/lib/apache2/modules/libphp8.1.so
#261676 0x00007f962a504b4e in ?? () from /usr/lib/apache2/modules/libphp8.1.so
#261677 0x00007f962a632418 in ?? () from /usr/lib/apache2/modules/libphp8.1.so
#261678 0x00007f962a759ae9 in execute_ex () from /usr/lib/apache2/modules/libphp8.1.so
#261679 0x00007f962a75cd8d in zend_execute () from /usr/lib/apache2/modules/libphp8.1.so
#261680 0x00007f962a6ec845 in zend_execute_scripts () from /usr/lib/apache2/modules/libphp8.1.so
#261681 0x00007f962a68968a in php_execute_script () from /usr/lib/apache2/modules/libphp8.1.so
#261682 0x00007f962a7d5690 in ?? () from /usr/lib/apache2/modules/libphp8.1.so
#261683 0x000055ecc2b17ae8 in ap_run_handler ()
#261684 0x000055ecc2b18096 in ap_invoke_handler ()
#261685 0x000055ecc2b30863 in ap_process_async_request ()
#261686 0x000055ecc2b30a32 in ap_process_request ()
#261687 0x000055ecc2b2cac6 in ?? ()
#261688 0x000055ecc2b21828 in ap_run_process_connection ()
#261689 0x00007f962b557997 in ?? () from /usr/lib/apache2/modules/mod_mpm_prefork.so
#261690 0x00007f962b557c9a in ?? () from /usr/lib/apache2/modules/mod_mpm_prefork.so
#261691 0x00007f962b558a18 in ?? () from /usr/lib/apache2/modules/mod_mpm_prefork.so
#261692 0x000055ecc2af9488 in ap_run_mpm ()
#261693 0x000055ecc2af1499 in main ()
@keeshoekzema keeshoekzema added the bug Something isn't working label Apr 21, 2023
@keeshoekzema keeshoekzema changed the title Segfaults in php agent module Segfaults in php agent module / elasticApmZendThrowExceptionHookImpl() Apr 21, 2023
@SergeyKleyman SergeyKleyman added this to the 8.9 milestone Apr 24, 2023
@intuibase
Copy link
Contributor

Hey @keeshoekzema

Could you please share a core dump file with us?

I implemented a script which will help to archive a core dump and all dependencies needed to analyze it on different machine that it crashed.

You can find a script crash_collector.sh here:
https://github.com/intuibase/core-dump-collector

Please remember that core dump file may contain a lot of sensitive data, like tokens, sessions data, passwords - please don't publish it to public but rather contact us how to deliver it.

Best regards,
Pawel

@keeshoekzema
Copy link
Author

Hello Pawel,

I have the files, where do you want them? You can contact me at kees at tweakers.net

@intuibase
Copy link
Contributor

Hey @keeshoekzema

Fix was included in new release, could you please update to 1.8.4 and verify if it solved issue for you?

Best regards,
Pawel

@intuibase
Copy link
Contributor

Hey @keeshoekzema
Issue was fixed with 1.8.4 release. Please update agent and verify if it solves issue for you.
Best regards,
Pawel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-php bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants