depstar

Discussion around https://github.com/seancorfield/depstar
kenny 2020-10-19T18:50:43.029300Z

Any idea why an uberjar build would get stuck on "Copying pom.xml to META-INF/maven/citadel/citadel/pom.xml"? It ran for 10 minutes before the CI killed the job. I can repro it locally too. Ran like this. v1.1.128

clojure -J-Dclojure.main.report=stderr -R:uberjar -m hf.depstar.uberjar citadel-standalone.jar -C --main cs.citadel --verbose

seancorfield 2020-10-19T18:56:39.030300Z

@kenny Since that's the last thing it does before exiting, I wonder if you have some top-level defs in your code that are kicking off execution of something that is preventing the process from terminating?

seancorfield 2020-10-19T18:58:28.030700Z

Is your project somewhere public, where I can take a look?

kenny 2020-10-19T19:00:27.032800Z

That does seem possible and definitely needs to be fixed. It's something new occurring in an absolutely massive PR. Unfortunately is proprietary code. Any thoughts on how to find something like that if that was the issue?

seancorfield 2020-10-19T19:02:18.034Z

If it is successfully building the JAR before that PR and "hanging" on building the JAR with that PR in place, that would clearly point at something in the PR. Beyond that, pretty much impossible to tell without access to the code.

kenny 2020-10-19T19:03:00.034400Z

Yep. Current PR changes: +8,643Β βˆ’5,343 πŸ˜…

kenny 2020-10-19T19:06:27.034900Z

Curious as to why that's the location of the pause in uberjar build though. I would've thought it'd occur during compilation.

seancorfield 2020-10-19T19:08:22.035600Z

Sounds like it is hanging at exit -- which is common if your code is starting up processes when namespaces are loaded (as in compilation).

seancorfield 2020-10-19T19:09:37.036900Z

Try removing the -C --main cs.citadel options and seeing if it'll complete in a timely manner -- that would just copy code without loading any namespaces, and that would confirm it is some top-level def in the PR.

kenny 2020-10-19T19:17:44.037400Z

Yep - no hang with that. Shoot, this will be quite the search...

seancorfield 2020-10-19T19:21:27.037900Z

At least you're only looking for top-level def forms that were added (or changed)... πŸ™‚

seancorfield 2020-10-19T19:21:40.038200Z

Or a top-level block of code I guess (even worse).

kenny 2020-10-19T19:29:52.038800Z

Comment stuff out until it works. Tried and true method πŸ™‚ Thankfully the feedback cycle is only 15-20s.

seancorfield 2020-10-19T19:46:45.040200Z

depstar doesn't (currently) call (shutdown-agents) which it probably should when AOT is requested, which might mitigate this problem in some situations -- but it's better not to have to do that 😐

kenny 2020-10-19T19:54:21.041Z

Worked it all the way back using the comment method. Adding uncomplicate.neanderthal.native to my require hangs the jvm. Commenting it out succeeds with no hang.

kenny 2020-10-19T19:55:17.041500Z

No clue why. We did bump the neanderthal version in this PR so that must be it.

seancorfield 2020-10-19T19:59:05.042400Z

If you want to try a quick tweak I committed: seancorfield/depstar {:git/url "<https://github.com/seancorfield/depstar>" :sha "2a5b903fa249ac42ace66a875b6eba1b29fe1519"} -- that calls (shutdown-agents) at the end.

kenny 2020-10-19T20:00:08.042700Z

That'd only cause a hang for 30 or 60s right?

seancorfield 2020-10-19T20:00:24.043100Z

Yeah, up to 60 seconds, but I figured it might be worth a try.

kenny 2020-10-19T20:03:09.043700Z

Worked it back to the neanderthal version now. 0.35.0 works and 0.36.0 and later hang.

kenny 2020-10-19T20:06:18.044700Z

^ diff between 0.35.0 and 0.36.0. Will try your tweak real quick.

kenny 2020-10-19T20:09:38.045100Z

Ha! That was it! Using the depstar with shutdown-agents doesn't cause any hang.

seancorfield 2020-10-19T20:12:34.046700Z

Naughty code in Neanderthal there but glad to hear the depstar tweak fixed it. I'll cut 1.1.132 later today I expect with that fix in it (and then I'll update clj-new to use that updated version πŸ™‚ )

kenny 2020-10-19T20:15:03.047500Z

That is quite odd. That lib does some crazy stuff so I'll give him the benefit of the doubt πŸ™‚

kenny 2020-10-19T20:27:17.047800Z

Anyway, thanks for the help Sean πŸ™‚

cch1 2020-10-19T21:26:34.050500Z

I’m new to depstar and I’m having trouble understanding how transitive dependencies are packaged into a jar file. I’m building a library that depends on ring/ring-codec (a maven dependency), but the generated jar file does not include the transitive dependency. Is this by design? If so, are consumers of my lib required to add a dependency on ring-codec themselves? Here’s how I invoke depstar: clojure -M:depstar -m hf.depstar.jar janus.jar. My lib’s deps.edn has a :deps section that mentions ring-codec. The alias for depstar itself is straight from the github README.

seancorfield 2020-10-19T22:40:33.051800Z

Uberjars get transitive dependencies. Thin jars get just the project source code.

seancorfield 2020-10-19T22:41:39.053200Z

This is the exact same behavior as Leiningen and Boot, which also both produce thin jars and uberjars.

seancorfield 2020-10-19T22:42:29.053600Z

@cch1 does that help?