-
Notifications
You must be signed in to change notification settings - Fork 155
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
[BUG] Constant HTTP 500 with preloading enabled on version 0.48.3 #1042
Comments
Hi @Majkl578, thanks for reporting this and I am sorry you experienced this issue. Looking into it right now. I have a few questions, though, in case I'll not be able to recreate it immediately:
|
The most imporant bits are IMO Symfony 4.4.15, Doctrine ORM 2.7, Doctrine DBAL 2.11, Guzzle 6.5, Sentry 2.5. Our app on top of Symfony 5.1 seems to be working.
We use a combo of
This was happening with 0.45.2 too. I also tried turning verbose opcache logging on and found nothing useful either. 😕 |
@labbati Are there any debug builds available that I could try if they produce anything? I can probably also try to compile PHP with debug mode and assertions enabled (we use PHP from deb.sury.org). |
@Majkl578 thanks for the info.
I have a question for you as well. If you are on a testing machine, can you confirm that removing the Also, so far I was not able to reproduce. Will keep you posted. |
Also, I have a favor to ask that might help us moving in the right direction: again if and only if you are able to reproduce in any environment other than production. Attached there is the setup I am using. Inside the zip there is a |
Yes when I remove This is what I got with
NOTICE: PHP message: DATADOG TRACER DIAGNOSTICS - agent_error: Failed to connect to localhost port 8126: Connection refused
NOTICE: PHP message: DATADOG TRACER DIAGNOSTICS - opcache_file_cache_set: The opcache.file_cache INI setting is set. This setting can cause unexpected behavior with the PHP tracer due to a bug in OPcache: https://bugs.php.net/bug.php?id=79825
NOTICE: PHP message: DATADOG TRACER CONFIGURATION - {"agent_error":"Failed to connect to localhost port 8126: Connection refused","opcache_file_cache_set":"The opcache.file_cache INI setting is set. This setting can cause unexpected behavior with the PHP tracer due to a bug in OPcache: https://bugs.php.net/bug.php?id=79825","date":"2020-10-09T11:42:19Z","os_name":"Linux 3a0d39c9918d 5.9.0-rc8-amd64 #1 SMP Debian 5.9~rc8-1~exp1 (2020-10-05) x86_64","os_version":"5.9.0-rc8-amd64","version":"0.48.3","lang":"php","lang_version":"7.4.2","env":null,"enabled":true,"service":null,"enabled_cli":false,"agent_url":"http://localhost:8126","debug":true,"analytics_enabled":false,"sample_rate":1.000000,"sampling_rules":null,"tags":null,"service_mapping":null,"distributed_tracing_enabled":true,"priority_sampling_enabled":true,"dd_version":null,"architecture":"x86_64","sapi":"fpm-fcgi","ddtrace.request_init_hook":"/opt/datadog-php/dd-trace-sources/bridge/dd_wrap_autoloader.php","open_basedir_configured":false,"uri_fragment_regex":null,"uri_mapping_incoming":null,"uri_mapping_outgoing":null,"auto_flush_enabled":false,"generate_root_span":true,"http_client_split_by_domain":false,"measure_compile_time":true,"report_hostname_on_root_span":false,"traced_internal_functions":null,"auto_prepend_file_configured":false,"integrations_disabled":null,"enabled_from_env":true,"opcache.file_cache":"/app/xxx/var/opcache"}
NOTICE: PHP message: For additional diagnostic checks such as Agent connectivity, see the 'ddtrace' section of a phpinfo() page. Alternatively set DD_TRACE_DEBUG=1 to add diagnostic checks to the error logs on the first request of a new PHP process. Set DD_TRACE_STARTUP_LOGS=0 to disable this tracer configuration message.
Also no luck after disabling
I tried locally, |
Hi @Majkl578 just a quick update to let you know that we were not able to recreate this so far and we are still looking into it.
Please let me know if you have updates on this side. |
Just an update on this. We tried hard to replicate the issue, both on symfony apps and a app that we use to perform some fuzz testing and we were not able to replicate, in some cases after hours under heavy load. Any chance that you @Majkl578 (or anyone else that upvoted the issue) can provide a sample app or snippet (and at this point I assume also method of installation for PHP) that recreates the issue? |
Hello @Majkl578, we are still not able to recreate this issue. I am open to join on a pair programming session with you, if you are available, so I can look at your configuration/application and I can try to see if anything stands out that we can use. If you are open to that, please reach out on our public slack datadoghq.slack.com. My handle is @luca.abbati. |
Hi @Majkl578, not sure if you had a chance to read my last message. Just checking in to see if we can meet somehow to investigate the issue more. |
Hi @Majkl578. Unfortunately this issue went stale and we were not able to recreate your problem. My offer to schedule a pair programming session when we can start disabling features/integrations and enabling them one by one so we can at least isolate the offending is still valid. Otherwise I don't see many options we can attempt. |
Hi @labbati. Sorry for no response recently, I was quite busy before christmas and didn't have time for anything here. Interesting obesrvation: Setting I tried disabling integrations and keeping the tracer itself enabled, unfortunately did not help:
I'll ping you on Slack and we can brainstorm how to debug this. Thank you! 👍 |
+1 |
Hello @fhferreira, we tried with several combinations but we were not able previously to recreate this error. Are you able to share a minimal reproduction case? It must be a non obvious combination of preload + various php/libs versions + configurations. |
Hi @labbati after many tries we got it to works, it is inside a Bitbucket pipeline and when we start the docker containers they didn't get the real AWS IP to go through the agent port :8126 and connect the agent. Using it inside the Dockerfile
./scripts/entrypoint.sh
It works |
@fhferreira I think that your problem was with the datadog agent not being reachable, rather than Good you got it to work, though |
@labbati it appears to work with opcache preload here |
I am closing this issue since without a core dump and/or a minimal reproduction case we are not able to proceed with investigation. In case we are able to get a core dump or need assistance to configure your system to generate one please reach our to our support team https://www.datadoghq.com/support/ or feel free to slack me as you were suggesting #1042 (comment) |
Hi @labbati, I was debugging the same codebase (as the author of this thread) after some time once again with preloading enabled (and ddtrace 0.62.1) and although I was not able to extract any specific error logs, I found out that the issue happens only when any of the DDTrace classes (DDTrace\GlobalTracer, DDTrace\NoopTracer) is listed in the preload.php file. We have Everything seems working fine if DDTrace namespace is used only inside method bodies (eg retriving tracer via GlobalTracer::get()). Do you have any idea what might be happening? We'll get rid of the service definition in favour of the static calls GlobalTracer::get everywhere but I'd still like to know what is the root cause. |
From what I see in the I don't see much into the PHP module internals though, can you validate it please? @labbati If that's the case, I can see two options:
|
Thank you @olsavmic for the additional information. I am reopening the issue since this is now actionable. We will look into this as soon as possible. |
Just a quick heads up. The issue is clear now and I was able to recreate. While in the long term we are working to remove the root cause of this (all the PHP code in Problem The problem was hard to find because it is caused by the combination of 3 factors and your message #1042 (comment) hints in the right direction:
When our module is loaded, we hard load Long term This issue will go entirely away once we will be able to get rid of Short term
Loading each class separately clashes with the original reason why we moved to
This is an interesting idea, but I'd rather prefer to solve the root cause, so if another framework decides to follow a similar approach then users don't see their apps failing in production. One possibility I see, but I want to discuss it internally with the team and get their feedback/preference before I commit to any solution, is to divide There might be other options, though, that I am not thinking about. We will get back to you soon. |
@labbati Thanks a lot! |
@olsavmic we are considering all possible use cases and I have one final question. Some context first, there are two topics here: (1) our tracing library MUST NEVER break your application even if manual tracing does not work, and (2) you should be able to do manual tracing in any scenario. I think we have a good solution for (1) in preloaded scenarios. About (2):
|
Thanks @labbati.
|
0.64.0 that fixes this issue. Please let us know if you still experience problems and I will reopen it. Thanks for the patience and the excellent investigation. |
@labbati I'm currently experiencing an issue that seems very similar to this. When deployed with opcache & preload disabled, everything works and traces end up in DD. Enable it, and the entire FPM process fails to start. I'm just about to start debugging this but thought it worth sharing already. |
It seems that this particular line is what's causing issues for us:
I'd guess that it's because of how the DD extension wraps the autoloader. The reason we require the autoloader in our preload script as that we rely on autoloading to load a full dependency tree, to load as much of our application as possible, but just providing the top-level dependencies. |
Bug description
We're seeing obscure but constant HTTP 500 with PHP preloading enabled and Datadog extension loaded. Once the extension is removed (
rm /etc/php/7.4/fpm/conf.d/98-ddtrace.ini /etc/php/7.4/fpm/conf.d/99-ddtrace-custom.ini
) everything works fine.PHP version
7.4.11 NTS
Installed extensions
OS info
Debian slim (Docker)
Diagnostics and configuration
Output of phpinfo() (ddtrace >= 0.47.0)
Output from
php -i
(same configuration as FPM):The text was updated successfully, but these errors were encountered: