opentracing/opentracing-javascript

After latest release we have blocker issue

cristiboariu opened this issue · 11 comments

After your latest release (v0.14.6) we encounter:

Error encountered when starting the app: TypeError: Cannot use 'in' operator to search for 'context' in null
/opt/app/node_modules/opentracing/lib/reference.js:14
    if (contextOrSpan instanceof span_1.default || 'context' in contextOrSpan) {
                                                             ^

TypeError: Cannot use 'in' operator to search for 'context' in null
    at toContext (/opt/app/node_modules/opentracing/lib/reference.js:14:62)
    at new Reference (/opt/app/node_modules/opentracing/lib/reference.js:37:35)
    at Object.requestTrace [as request] (/opt/app/node_modules/dd-trace/packages/datadog-plugin-http/src/client.js:57:11)
    at retriableRequest (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/request.js:13:22)
    at request (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/request.js:53:24)
    at makeRequest (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/writer.js:127:3)
    at Writer._sendPayload (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/writer.js:31:5)
    at Writer.flush (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/writer.js:80:12)
    at Timeout._onTimeout (/opt/app/node_modules/dd-trace/packages/dd-trace/src/exporters/agent/index.js:14:58)

@yurishkuro can you please help? Our PROD build is no longer working :(

Bug seems to be introduced here: 1380d0f#diff-d0d962ccc0784d6699fb4dcfc79d3acd8cff4d081f77e13a164510c48459d35fR14

we are experiencing the same issue. non-stop uncaught exceptions in some of our services (opentracing is pulled in by those services' dd-trace dependency)

Seeing this as well

@yurishkuro Just want to make sure you are aware. We are currently trying to force a rollback to v0.14.5 in our systems as we currently can't deploy any new code.

dd-trace datadogs agent uses this dependency and we can not deploy any code now. this is a major issue.

apologies, everyone, I am reverting the change in a new patch

opentracing@0.14.7 published that is equal to opentracing@0.14.5

btw, I think the original null-ptr issue is here: https://github.com/DataDog/dd-trace-js/blob/21179be27f7f9487e8287056fa08e404f5e6ef14/packages/datadog-plugin-http/src/client.js#L54

This code is calling new Reference(type, parentCtx) constructor with parentCtx=null, which is invalid per constructor signature:

constructor(type: string, referencedContext: SpanContext | Span) {

While not ideal, #174 adds support for previous "illegal" usage of the constructor.

dhay commented

I was facing this issue as well and can confirm that the 0.14.7 build fixes the problem. I was about to post this exact issue with the suggestion that the line in question add a null/undefined check...but, without digging further, that may just kick the problem further downstream

@cristiboariu @lmuench @jneal-afs @amopportunities @dhay can you test your code with PR #174 (it's on a public branch) to confirm if it resolves the issue?