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

AOT issues with clj_http.headers.HeaderMap #638

Open
pesterhazy opened this issue Oct 16, 2023 · 4 comments
Open

AOT issues with clj_http.headers.HeaderMap #638

pesterhazy opened this issue Oct 16, 2023 · 4 comments

Comments

@pesterhazy
Copy link

I'm following the guide for using AOT. This works ... except for clj-http.

The error I'm getting is not when compiling but when loading the compiled classes (rather than clj files):

Execution error (ClassNotFoundException) at jdk.internal.loader.BuiltinClassLoader/loadClass (BuiltinClassLoader.java:641).
clj_http.headers.HeaderMap

When I rm -rf classes/clj_http, it works again.

Unfortunately I couldn't come up with a simple repro case - when I tried it outside of the main app, it worked. Not sure why - race condition?

I suspect (but cannot prove) that the AOT incompatibility is due to the use of potemkin.

There's an earlier report from 2016, but I'm not using Leiningen https://clojurians.slack.com/archives/C0AB48493/p1469153573000034

clj-http/clj-http 3.12.3
potemkin/potemkin 0.4.5
@pesterhazy
Copy link
Author

BTW uberjars work fine - the issue happens only when AOT-compiling for development

@pesterhazy
Copy link
Author

After some investigations, here's what I learned:

• Part of the problem seems to be loading namespaces in user.clj. After stopping to load stuff in user.clj, the problem went away for me (this explains why lein uberjar etc doesn't have the problem)

• Generally what seems to be happening is this: I'm loading clj-http and then compiling it. "Something is loading clj-http before you do the aot compilation, and on the second loading (for aot) potemkins type definition stuff no-ops, so the class doesn't get written to disk"

More discussion here: https://clojurians.slack.com/archives/C03S1KBA2/p1697468125926469

This still seems like a wrinkle in clj-http, though maybe not a bug (maybe in potemkin?)

@dakrone
Copy link
Owner

dakrone commented Oct 23, 2023

Something is loading clj-http before you do the aot compilation

Could this be something internal to leiningen itself that's loading clj-http?

@pesterhazy
Copy link
Author

pesterhazy commented Oct 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants