Skip to content
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

"Cannot call write after a stream was destroyed" on ECS #120

Closed
PascalPflaum opened this issue May 27, 2022 · 9 comments · Fixed by #126
Closed

"Cannot call write after a stream was destroyed" on ECS #120

PascalPflaum opened this issue May 27, 2022 · 9 comments · Fixed by #126
Assignees
Labels
bug Something isn't working

Comments

@PascalPflaum
Copy link

I noticed many messages like the following on a production ECS system, after Upgrading from node 14 to node 16.15.0
Roundabout 1/3 of all writes fail with this message.

{ "message": "Cannot call write after a stream was destroyed", "name": "Error", "stack": "Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed\n at new NodeError (node:internal/errors:372:5)\n at _write (node:internal/streams/writable:321:11)\n at Socket.Writable.write (node:internal/streams/writable:334:10)\n at /thingregistry/node_modules/aws-embedded-metrics/lib/sinks/connections/TcpClient.js:58:56\n at new Promise (<anonymous>)\n at TcpClient.<anonymous> (/thingregistry/node_modules/aws-embedded-metrics/lib/sinks/connections/TcpClient.js:53:19)\n at Generator.next (<anonymous>)\n at fulfilled (/thingregistry/node_modules/aws-embedded-metrics/lib/sinks/connections/TcpClient.js:19:58)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)", "code": "ERR_STREAM_DESTROYED" }

I could not find any obvious issue in the code.

@tetrasmolyn
Copy link

+1
I am also seeing this behaviour

@danielrhodes
Copy link

danielrhodes commented Jun 30, 2022

+1
Also seeing this.

@macwatrousdd
Copy link

You can work around this by setting the agent endpoint to use UDP instead of TCP.

Example env variable

AWS_EMF_AGENT_ENDPOINT = "udp://127.0.0.1:25888"

@lexedwards
Copy link

+1 also seeing this occure

@markkuhn markkuhn added the bug Something isn't working label Jul 18, 2022
@davidweimapbox
Copy link

+1 same here

@davidweimapbox
Copy link

Awesome! Thanks for the quick fix! @markkuhn Can we expect a new release v2.0.6 soon as this is a blocking issue in our team after we upgraded to node 16.

@markkuhn
Copy link
Contributor

Hi @davidweimapbox . We will be releasing v2.0.6 in a day or two!

@davidweimapbox
Copy link

@markkuhn Cool! thanks for confirm!

@markkuhn
Copy link
Contributor

Package has been published. Thank you for the report @PascalPflaum !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants