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 / sleepResumingAfterInterruption() #924

Closed
keeshoekzema opened this issue Apr 21, 2023 · 2 comments · Fixed by #1038
Closed

Segfaults in php agent module / sleepResumingAfterInterruption() #924

keeshoekzema opened this issue Apr 21, 2023 · 2 comments · Fixed by #1038
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 modphp8.1.17 and apm-agent-php 1.8.1

Expected behavior
No segfaults

A gdb bt from the core:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f962369c6cf in time_nanosleep_resuming_after_interruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
[Current thread is 1 (Thread 0x7f962b638c40 (LWP 3480716))]
#0  0x00007f962369c6cf in time_nanosleep_resuming_after_interruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#1  0x00007f962369c116 in sleepResumingAfterInterruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#2  0x00007f962369cab5 in time_nanosleep_resuming_after_interruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#3  0x00007f962369c116 in sleepResumingAfterInterruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#4  0x00007f962369cab5 in time_nanosleep_resuming_after_interruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#5  0x00007f962369c116 in sleepResumingAfterInterruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#6  0x00007f962369cab5 in time_nanosleep_resuming_after_interruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
[ .. some time later .. ]
#45510 0x00007f962369cab5 in time_nanosleep_resuming_after_interruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#45511 0x00007f962369c116 in sleepResumingAfterInterruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#45512 0x00007f962369cab5 in time_nanosleep_resuming_after_interruption () from /opt/elastic/apm-agent-php/extensions/elastic_apm-20210902.so
#45513 0x00007f962a759ae9 in execute_ex () from /usr/lib/apache2/modules/libphp8.1.so
#45514 0x00007f962a75cd8d in zend_execute () from /usr/lib/apache2/modules/libphp8.1.so
#45515 0x00007f962a6ec845 in zend_execute_scripts () from /usr/lib/apache2/modules/libphp8.1.so
#45516 0x00007f962a68968a in php_execute_script () from /usr/lib/apache2/modules/libphp8.1.so
#45517 0x00007f962a7d5690 in ?? () from /usr/lib/apache2/modules/libphp8.1.so
#45518 0x000055ecc2b17ae8 in ap_run_handler ()
#45519 0x000055ecc2b18096 in ap_invoke_handler ()
#45520 0x000055ecc2b2fb7e in ap_internal_redirect ()
#45521 0x00007f962b017bfc in ?? () from /usr/lib/apache2/modules/mod_rewrite.so
#45522 0x000055ecc2b17ae8 in ap_run_handler ()
#45523 0x000055ecc2b18096 in ap_invoke_handler ()
#45524 0x000055ecc2b30863 in ap_process_async_request ()
#45525 0x000055ecc2b30a32 in ap_process_request ()
#45526 0x000055ecc2b2cac6 in ?? ()
#45527 0x000055ecc2b21828 in ap_run_process_connection ()
#45528 0x00007f962b557997 in ?? () from /usr/lib/apache2/modules/mod_mpm_prefork.so
#45529 0x00007f962b557c9a in ?? () from /usr/lib/apache2/modules/mod_mpm_prefork.so
#45530 0x00007f962b558a18 in ?? () from /usr/lib/apache2/modules/mod_mpm_prefork.so
#45531 0x000055ecc2af9488 in ap_run_mpm ()
#45532 0x000055ecc2af1499 in main ()
@keeshoekzema keeshoekzema added the bug Something isn't working label Apr 21, 2023
@intuibase intuibase self-assigned this Apr 21, 2023
@intuibase
Copy link
Contributor

Hey @keeshoekzema

Thank you for reporting issue.
Is it possible to deliver us reproduction environment like docker image, virtual machine, etc?

Regards,
Pawel

@keeshoekzema
Copy link
Author

Unfortunately i'm not able to reproduce it in a test environment as this server is doing ~150 requests per second and i only saw this segfault a few times in the span of 3 days.

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

Successfully merging a pull request may close this issue.

3 participants