nats-server icon indicating copy to clipboard operation
nats-server copied to clipboard

Misleading error message: Unable to start NATS Server in Go Routine

Open tehsphinx opened this issue 5 years ago • 5 comments

  • [ ] 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?

tehsphinx avatar Aug 15 '19 09:08 tehsphinx

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 avatar Jun 02 '20 02:06 derekcollison

@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.

tehsphinx avatar Jun 02 '20 12:06 tehsphinx

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.

derekcollison avatar Jun 02 '20 13:06 derekcollison

The solution for me was to add GODEBUG=x509sha1=1 before command

P.S. go1.18.3

ilyadt avatar Jul 06 '22 15:07 ilyadt

The solution for me was to add GODEBUG=x509sha1=1 before command

P.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.

ripienaar avatar Jul 06 '22 15:07 ripienaar

Closing for now, feel free to re-open if needed.

derekcollison avatar Jun 11 '23 15:06 derekcollison