instana / nodejs

Node.js in-process collectors for Instana
MIT License
69 stars 36 forks source link

[Bug]: Cannot start an AWS SQS entry span when another span is already active #1179

Closed huseyinemreuslu closed 4 months ago

huseyinemreuslu commented 5 months ago

Problem Description

We got this issue from our worker service. This service is using aws sqs. This service is not working as expected

There is an error we got here: { "name": "@instana/collector", "thread": 0, "__in": 1, "hostname": "316d5df027df", "pid": 1, "module": "tracing/sqs", "level": 40, "msg": "Cannot start an AWS SQS entry span when another span is already active. Currently, the following span is active: {\"t\":\"3f784382b20ff83c\",\"s\":\"d482e31bc6bf939a\",\"n\":\"sqs\",\"k\":1,\"f\":{\"e\":\"2188334\",\"h\":\"EC2-i-0035a76556de3dbb9\"},\"ec\":0,\"ts\":1718126045253,\"d\":0,\"stack\":[{\"m\":\"Object.captureStackTrace\",\"c\":\"/usr/src/app/node_modules/@instana/core/src/util/stackTrace.js\",\"n\":38},{\"m\":\"Object.getStackTrace\",\"c\":\"/usr/src/app/node_modules/@instana/core/src/tracing/tracingUtil.js\",\"n\":31},{\"m\":\"anonymous>\",\"c\":\"/usr/src/app/node_modules/@instana/core/src/tracing/instrumentation/cloud/aws-sdk/v2/sqs.js\",\"n\":245},{\"m\":\"<anonymous\",\"c\":\"/usr/src/app/node_modules/@instana/core/src/tracing/clsHooked/context.js\",\"n\":124},{\"m\":\"Namespace.run\",\"c\":\"/usr/src/app/node_modules/@instana/core/src/tracing/clsHooked/context.js\",\"n\":108},{\"m\":\"Namespace.runAndReturn\",\"c\":\"/usr/src/app/node_modules/@instana/core/src/tracing/clsHooked/context.js\",\"n\":123},{\"m\":\"instrumentedReceiveMessage\",\"c\":\"/usr/src/app/node_modules/@instana/core/src/tracing/instrumentation/cloud/aws-sdk/v2/sqs.js\",\"n\":243},{\"m\":\"features.constructor.receiveMessage\",\"c\":\"/usr/src/app/node_modules/@instana/core/src/tracing/instrumentation/cloud/aws-sdk/v2/sqs.js\",\"n\":235},{\"m\":\"receiveMessage\",\"c\":\"/usr/src/app/node_modules/@fiyuu/common/src/hostlib/factories/worker.js\",\"n\":302},{\"m\":\"invoke\",\"c\":\"/usr/src/app/node_modules/@fiyuu/common/src/hostlib/factories/worker.js\",\"n\":769}],\"data\":{\"service\":\"KT-ORDER-WORKER\",\"sqs\":{\"sort\":\"entry\",\"queue\":\"https://sqs.eu-west-1.amazonaws.com/xyz/prod_kt_order_worker.fifo\",\"size\":1}}}", "time": "2024-06-11T17:14:05.253Z", "v": 0 }

Short, Self Contained Example

No response

Node.js Version

node:12.13.1-alpine

package.json

"dependencies": {
        "@fiyuu/common": "git+https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/common",
        "aws-sdk": "^2.1098.0",
        "axios": "0.27.2",
        "bluebird": "^3.7.2",
        "body-parser": "^1.19.0",
        "cors": "^2.8.5",
        "express": "^4.17.1",
        "externalApis": "git+https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/externalapis",
        "mssql": "^6.3.1",
        "next4biz": "git+https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/next4biz",
        "nodemailer": "^6.6.3",
        "pg": "^7.18.2",
        "redis": "^2.8.0",
        "request": "^2.88.2"
    }

package-lock.json

"dependencies": {
        "@fiyuu/common": "git+https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/common",
        "aws-sdk": "^2.1098.0",
        "axios": "0.27.2",
        "bluebird": "^3.7.2",
        "body-parser": "^1.19.0",
        "cors": "^2.8.5",
        "express": "^4.17.1",
        "externalApis": "git+https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/externalapis",
        "mssql": "^6.3.1",
        "next4biz": "git+https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/next4biz",
        "nodemailer": "^6.6.3",
        "pg": "^7.18.2",
        "redis": "^2.8.0",
        "request": "^2.88.2"
    }
aryamohanan commented 5 months ago

Thank you for the report. We will take a look asap. Additionally, could you please provide us with the version of the Instana collector you are using?

huseyinemreuslu commented 5 months ago

aw, of course I was trying something in package.json and I just removed. I used "@instana/collector": "^1.67.0",

aryamohanan commented 5 months ago

We have resolved this issue in our collector version 2.1.0. Could you please update to the latest v2 version of the collector? You can check the releases here.

Please note that our latest collector version v3 has dropped support for Node.js 12, so it is important to use collector v2 for your application which relies on Node.js 12.

aryamohanan commented 4 months ago

I believe that switching to the suggested version has resolved your issue. I am marking this issue as completed. Please feel free to reopen it if you continue to experience any problems. Thank you.