-
Notifications
You must be signed in to change notification settings - Fork 147
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] Undefined property: DDTrace\\SpanData::$id when combining accessing active span from user-land after calling \DDTrace\hook_method on dd-trace-php 0.70+ #1544
Comments
I'm not able to reproduce this specific behaviour, while I can reproduce behaviour that looks like it. I wonder if you might be able to reduce the problem to its simplest form and provide a complete reproducing test case (of the kind we might be able to add to our test suites) ? |
@krakjoe Thanks for quick response! I created a repository demonstrating the issue (https://github.com/olsavmic/dd-trace-bug-1544). After further investigation, I was able to replicate the issue only in combination with SymfonyIntegration. I found out that when we're trying to hook onto The issue is not present in case Also, as reported, commenting out the line Debugging question I therefore used your PHP image from https://github.com/DataDog/dd-trace-php/blob/master/CONTRIBUTING.md with which I had no issues. I also found out that installing completely unrelated blackfire extension fixes this behaviour - all messages from trace callbacks were visible. All default PHP settings including opcache were matching. Could you please explain to me what has to be changed in order to print messages from these "sandboxed" functions? I'm really curious as it took me quite some time to find out that my code is fine, it's just some PHP configuration. Does it have something to do with DEBUG build of PHP? Thank you! |
Hey there, we have identified a minor behaviour change in PHP 8.1.4 which is incompatible with dd-trace-php. There is a fix in #1550, but until it is released dd-trace-php does not work properly with PHP 8.1.4. Especially considering this:
This strongly indicates that your encountered bug is related to that. Downgrading to PHP 8.1.3 for now also should fix it then. Can you also confirm whether your reported memory leak in #1545 is related to that issue? I.e. disappears with PHP 8.1.3? Or whether that's an actually separate issue. |
Regarding your debugging question: using |
@bwoebi Thank you for the hint! Unfortunately while downgrading to PHP 8.1.3 fixes the issue with debugging messages not showing up while trying to reproduce the error, it does not fix the main problem mentioned in this issue. We are still seeing the same We actually tried the upgrade the other way around back then - we first deployed dd-trace-php 0.71.0 on PHP 8.1.3 and seeing that it does not work, we tried it one more time after 8.1.4 was released. :/ |
@olsavmic can you explain what you are trying to achieve. We want to investigate the bug that you found, but we might also recommend the best way to achieve what you want to achieve. For example the root span can be retrieved via Let me drop here a sort of API documentation that you might find useful, as we are revamping our docs with it.
The returned span objects, have the following properties that can be written.
|
@labbati We have several different custom instrumentation layers in our application:
$this->tracingService->traceCallback('initializeNextStops', function () use ($conveyor, $transaction): void {
$this->initializeNextStops($conveyor, $transaction);
}); $this->tracingService->traceConsumer(static::getConsumerName(), function () use ($msg): void {
$parsedMessage = $this->messageParser->parseMessage($msg, static::getExpectedMessageClass());
$this->processMessage($parsedMessage);
}); 1, 2, 3 can be easily rewritten to the modern API. I'm not sure about the 4th case though where we handle the full lifecycle of a span (start, finish, flush). |
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
The fix for this is included in the now released 0.72.0. |
Bug description
Hi, after upgrading to DDTrace 0.70+ (0.71 behaves similarly), we're having issues with following setup:
We have a custom pre-hook registered that accesses the root span. The span is a regular
Span
instance, not aNoopSpan
.This hook works perfectly when it's not combined with user-land spans.
The issue occurs when calling
GlobalTracer::get()->getActiveSpan()
from the app itself. We do not manipulate with the retrieved span any further in any of the methods.The code fails during
ScopeManager::reconcileInternalAndUserland()
on following lines:(
$span->parent->id
is uninitialized on line 866)When dumping
$span->parent
, we can see that$span->parent
is instance ofSpanData
but all fields are uninitialised.Calling
GlobalTracer::get()->getActiveSpan()
alone without registering the hook works fine.We see same behaviour both with and without DD_TRACE_GENERATE_ROOT_SPAN option.
PHP version
Tracer version
0.71.0
Installed extensions
OS info
Diagnostics and configuration
Output of phpinfo() (ddtrace >= 0.47.0)
Diagnostic checks | passed
Upgrading info
DDTrace 0.69.0 -> DDTrace 0.70.0, DDTrace 0.71.0 (both versions do not work)
The text was updated successfully, but these errors were encountered: