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

ZIO logging finalizer runs in incompatible classpath #2333

Closed
deusaquilus opened this issue Dec 5, 2021 · 0 comments · Fixed by #2923
Closed

ZIO logging finalizer runs in incompatible classpath #2333

deusaquilus opened this issue Dec 5, 2021 · 0 comments · Fixed by #2923

Comments

@deusaquilus
Copy link
Collaborator

deusaquilus commented Dec 5, 2021

Version: (e.g. 3.11.0)
Module: (e.g. all)
Database: (e.g. all)

ZIO logging infrastructure introduced in #2292 to solve #1715 introduces an issue when existing SBT. Since during compilation, the zio-logging infrastructure is started, it is then finalized when SBT is existed. However, because the SBT finalization is done in a classpath in which ZIO libraries to not exist, ClassNotFound exceptions are thrown. It looks like this:

sbt:quill-example> exit
[info] shutting down sbt server
Exception in thread "Thread-22" java.lang.NoClassDefFoundError: zio/ZIO$Fail
	at zio.ZIO$.haltWith(ZIO.scala:3457)
	at zio.ZIO$.die(ZIO.scala:2647)
	at zio.internal.FiberContext.evaluateNow(FiberContext.scala:659)
	at zio.Runtime.unsafeRunWith(Runtime.scala:214)
	at zio.Runtime.unsafeRunSync(Runtime.scala:83)
	at zio.Runtime.unsafeRunSync$(Runtime.scala:80)
	at zio.Runtime$$anon$3.unsafeRunSync(Runtime.scala:280)
	at zio.Runtime.unsafeRun(Runtime.scala:58)
	at zio.Runtime.unsafeRun$(Runtime.scala:57)
	at zio.Runtime$$anon$3.unsafeRun(Runtime.scala:280)
	at zio.Runtime$.$anonfun$unsafeFromLayer$4(Runtime.scala:308)
	at zio.internal.PlatformSpecific$$anon$1.run(PlatformSpecific.scala:37)
Caused by: java.lang.ClassNotFoundException: zio.ZIO$Fail
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 12 more

This was identified in #2325.
A similar SBT issue was found with airframe here: sbt/sbt#4794

I am not sure what the long-term solution is but for now, we can mitigate by make the compile-time query-logging system as opt-in (this mitigation is #2332).

@getquill/maintainers

guizmaii added a commit that referenced this issue Oct 19, 2023
guizmaii added a commit that referenced this issue Oct 19, 2023
guizmaii added a commit that referenced this issue Oct 20, 2023
juliano pushed a commit that referenced this issue Oct 20, 2023
guizmaii added a commit that referenced this issue Oct 20, 2023
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

Successfully merging a pull request may close this issue.

1 participant