nats-server
nats-server copied to clipboard
Misleading error message: Unable to start NATS Server in Go Routine
- [ ] Defect
- [x] Feature Request or Change Proposal
Feature Requests
Note: for all details (including Code) see my StackOverflow question.
Use Case:
When testing I want a nats server instance per test. I started and stopped it per test so a fix port seemed fine at first.
Proposed Change:
I then got the error message "Unable to start NATS Server in Go Routine". The problem seemed to be that the port I gave to the NATS test server was already in use.
Who Benefits From The Change(s)?
Developers running into the same issue.
Alternative Approaches
What about an error message when starting the server if it was actually able to bind to the port?
You can start a server with -1 for the port and it will allocate the port dynamically. To connect in your test use s.ClientURL() to pass to nats.Connect()
@derekcollison: This is not about solving my issue. I've solved that a long time ago.
This is about a misleading error message (to put it nicely, because the error message is actually wrong!!).
Incorrect error message: "Unable to start NATS Server in Go Routine"
Why is this error message wrong? Firstly because the NATS server can actually be started in a Go routine without any problems. Secondly because the message is triggered by a port already taken, not because it was executed in a Go routine.
ok I guess we are all used to it from running so many tests. Will reopen and leave here. Feel free to submit a PR if its a high priority for you.
The solution for me was to add
GODEBUG=x509sha1=1 before command
P.S. go1.18.3
The solution for me was to add
GODEBUG=x509sha1=1before commandP.S. go1.18.3
That is not the solution, the solution is to upgrade your certificates, enabling sha1 certificates is a mistake. This environment variable is only going to be supported by go for a short while.
Closing for now, feel free to re-open if needed.