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

Dependency loop with nats-server #1145

Closed
2 tasks done
gibmat opened this issue Nov 26, 2022 · 6 comments
Closed
2 tasks done

Dependency loop with nats-server #1145

gibmat opened this issue Nov 26, 2022 · 6 comments
Assignees
Labels
bug Confirmed reproducible bug

Comments

@gibmat
Copy link

gibmat commented Nov 26, 2022

Defect

Make sure that these boxes are checked before submitting your issue -- thank you!

Versions of nats.go and the nats-server if one was involved:

nats.go version: 1.20.0
nats-server version: 2.9.8

OS/Container environment:

Debian sid

Steps or code to reproduce the issue:

I am working on updating some of the various nats-io packages in Debian, and observed that there is a dependency loop between nats.go and nats-server. While the nats-server dependency is only needed by tests in nats.go (see the go_test.mod file), that still forms a dependency loop. For the time being to break the loop, the nats.go tests are disabled in the Debian package, but that's clearly not an optimal solution.

@gibmat gibmat added the bug Confirmed reproducible bug label Nov 26, 2022
@wallyqs
Copy link
Member

wallyqs commented Nov 26, 2022

Hi @gibmat, how are the tests that were disabled run? Is it by doing:

go test github.com/nats-io/nats.go

or a different command? Go modules works mostly fine with circular dependencies in the server, but one way to improve this is by moving all tests that depend on the server package to be under the tests folder of the client.

@gibmat
Copy link
Author

gibmat commented Dec 15, 2022

Currently none of the tests are being run when the nats.go package is built, because they depend on code in the nats-server library/program. But yes, that is the basic form of how tests are run with Debian's packaging framework, dh_golang.

Debian policy requires that all packages build without accessing the Internet, so for golang libraries there's a bit of glue in place to modify the GOPATH and then fulfill all the build dependencies via other Debian packages that contain the dependencies listed in go.mod. Because of how package dependencies are resolved, it's an all-or-nothing sort of situation, and dependency loops are something we need to avoid to guarantee the ability to rebuild packages at any time and for any architecture supported by Debian.

At the moment this isn't blocking the use of these packages in Debian, but if non-test code ever started depending on nats-server, that would be a bigger concern.

@wallyqs
Copy link
Member

wallyqs commented Dec 15, 2022

thank you @gibmat for the response, that is very helpful

@gibmat
Copy link
Author

gibmat commented Dec 15, 2022

Sorry for the delayed reply -- this finally got back to the top of my priority queue. 😁

@wallyqs
Copy link
Member

wallyqs commented Dec 16, 2022

Basically we need to revisit a handful of tests to decouple this (TestConnAsyncCBDeadlock, TestRequestInit, TestPingTimerLeakedOnClose, plus some other new websocket + js tests, a wip branch from some time ago can be found here: wallyqs@032f496). For now at least we can guarantee that the client won't ever depend on the server other than for the tests and it won't be present as a dependency in go.mod.

@wallyqs
Copy link
Member

wallyqs commented Oct 16, 2023

Fixed via #1441

@wallyqs wallyqs closed this as completed Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed reproducible bug
Projects
None yet
Development

No branches or pull requests

3 participants