Use of closed network connection errors for tcp extension

I’m trying to benchmark simple “echo servers” written in node and go. Just the basic stuff so I won’t post it here, but they work with netcat and multiple connections.

I’m using the tcp extension listed here

Specific extension here

The extension is so basic (like the servers its testing) I’m not really suspecting it of causing the error.

I get no errors if I run

./k6 run -i 1 ./index.js

This gets me an error

./k6 run -i 2 ./index.js
ERRO[0000] GoError: write tcp 127.0.0.1:64595->127.0.0.1:7005: use of closed network connection
	at reflect.methodValueCall (native)
	at file:///Users/kevin/Dev%EF%BC%BF/Go/k6-tcp/index.js:9:20(10)
	at native  executor=shared-iterations scenario=default source=stacktrace

No error here

./k6 run -i 2 -u 2 ./index.js

But this has the error

./k6 run -i 3 -u 2 ./index.js

You can see the pattern. Apparently connections are trying to be reused in some way. But I have no idea how a TCP connection is “reused” (http connection makes more sense)

I tried this but same problem

./k6 run -i 2 -u 1 --no-connection-reuse --no-vu-connection-reuse ./index.js

Sorry, xk6-tcp is not an extension that is developed by any of the k6 developers, so we can’t help you with it. And the author of the extension is unlikely to see your problem here, unless they are also a member of the forum and following posts regularly. I suggest opening an issue in the repo itself.

For what it’s worth, the --no-connection-reuse --no-vu-connection-reuse options shouldn’t affect anything that uses the Go standard library’s net package, as this extension seems to do.