-
Notifications
You must be signed in to change notification settings - Fork 152
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
Internal function tracing with callbacks failing due to private function #149
Comments
@pawelchcki any thoughts on this? |
Hey @NickStallman sorry for late response. Were you by any chance able to reproduce it in minimal setup? Is the problem showing it the same PHP version (7.1.24) and modules set as described in #113 ? |
Yep exactly the same configuration with tracer datadog-php-tracer_0.4.2-beta_amd64. Here is a short test script that reliably produces the error.
<?php
class a
{
function __construct()
{
$ch = curl_init('https://www.datadog.com/');
curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, 'headers'));
$data = curl_exec($ch);
}
private function headers($ch, $headers)
{
var_dump($headers);
return strlen($headers);
}
}
dd_trace('curl_exec', function ($ch) {
echo "Called curl_exec\n";
curl_exec($ch);
echo "Finished curl_exec\n";
});
new a(); |
Thanks @NickStallman - this is very helpful! I'll post an update here once we have a fix for this/know more! |
Has there been any progress on this issue? I notice #224 has the same issue repeated in an independent example. This is a blocker for us to instrument one of our primary performance critical applications. |
Hi @NickStallman, so far no progress on this topic and it revealed to be harder than expected! |
I just ran into this issue as well using a library called the phpCAS.
Adding |
Thanks for reporting this. This is related to how we pass context to our wrapper. We are actively working on this and his sibling (calls to |
Hey @NickStallman & @Omicron7! Thanks again for reporting this issue and sorry for the wait for a fix. PR's #284 & #303 should get rolled out into a release next week which should fix this issue. We'll let you know when the release is available! :) |
@SammyK That's great to hear. This is also affecting an internal library we use so we've disabled curl integration for now. Error file: /opt/datadog-php/dd-trace-sources/src/DDTrace/Integrations/Curl/CurlIntegration.php |
Hey @NickStallman, @Omicron7, @ctrlrsf, et al! We just released |
Thanks, @SammyK. Testing now and will let you know if we have any issues. |
This is slightly related to issue #113
It looks like there is a problem with tracing a function that uses callbacks, if that callback is private.
Specifically I am using a PHP S3 class "tpyo/amazon-s3-php-class" which is using the CURLOPT_HEADERFUNCTION feature.
curl_exec will execute the HEADERFUNCTION callback during data transmission.
As the callback is a private function of the S3 class, adding dd_trace to curl_exec throws these errors:
Message: Invalid callback S3Request::__responseHeaderCallback, cannot access private method S3Request::__responseHeaderCallback()
Message: curl_exec(): Could not call the CURLOPT_HEADERFUNCTION
So dd_trace is changing the scope and function visibility when curl_exec is run.
Curiously it doesn't appear to be all callbacks. I tried creating the below test script but it seems to function correctly.
The text was updated successfully, but these errors were encountered: