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

lein deps hangs and exits due to StackOverflowError #2798

Closed
2 of 4 tasks
liamchzh opened this issue Jun 10, 2022 · 2 comments
Closed
2 of 4 tasks

lein deps hangs and exits due to StackOverflowError #2798

liamchzh opened this issue Jun 10, 2022 · 2 comments
Labels

Comments

@liamchzh
Copy link

Initial debugging steps
Before creating a report, especially around exceptions being thrown when running Leiningen, please check if the error still occurs after:

  • Updating to using the latest released version of Leiningen (lein upgrade).
  • Moving your ~/.lein/profiles.clj (if present) out of the way. This contains third-party dependencies and plugins that can cause problems inside Leiningen.
  • Updating any old versions of plugins in your project.clj, especially if the problem is with a plugin not working. Old versions of plugins like nREPL and CIDER (as well as others) can cause problems with newer versions of Leiningen.
  • (If you are using Java 9 or newer), updating your dependencies to their most recent versions. Recent JDK's have introduced changes which can break some Clojure libraries.

Describe the bug
lein deps would hang after bumping Netty TomcatNative BoringSSL Static to 2.0.50.Final. CPU load increases in the meantime.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project: lein new my-project
  2. Add the netty-tcnative-boringssl-static version 2.0.50.Final to the dependencies: :dependencies [[io.netty/netty-tcnative-boringssl-static "2.0.50.Final"]]
  3. Run lein deps

Actual behavior
lein deps hangs and exits due to StackOverflowError on my machine.

Expected behavior
Successfully install the netty-tcnative-boringssl-static dep.

Environment

  • Leiningen Version: 2.9.8
  • Leiningen installation method: manual
  • JDK Version: openjdk version "1.8.0_282"
  • OS: macOS 12.4
  • Anything else that might be relevant to your problem?

Additional context
2.0.50.Final is the first version that causes the problem and it introduced circular dependency since this version.
See related issues of netty-tcnative-boringssl-static on GitHub:

@technomancy
Copy link
Owner

Thanks for reporting this. Will see what we can do.

In the mean time, you can work around it by putting :pedantic? false in your project.clj.

@technomancy
Copy link
Owner

This was tricky to debug, but I think it has to do with an assumption in the cycle detection of the pedantic implementation. We have code that does (some #{node} parents) where node and parents are DefaultDependencyNode objects from Aether, so that code assumes that they hash consistently, but the boringssl ones do not.

The fix is quite simple; turn everything into a string before doing cycle detection.

technomancy added a commit that referenced this issue Jul 24, 2022
Fixes #2798

This is caused by what seems like a bug in Aether's DependencyNode
implementation; most nodes will hash correctly such that

    (some #{node} parents)

works to do cycle detection, but certain ones in Netty's boringssl do
not hash correctly, so we have to convert them to strings before using
them for cycle detection purposes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants