cats-effect icon indicating copy to clipboard operation
cats-effect copied to clipboard

Over-aggressive Stack Trace Enhancement

Open djspiewak opened this issue 4 years ago • 6 comments

Original:

java.lang.ClassCastException: interface akka.event.LoggingFilter is not assignable from class akka.event.DefaultLoggingFilter
	at akka.actor.ReflectiveDynamicAccess.$anonfun$getClassFor$1(ReflectiveDynamicAccess.scala:31)
	at scala.util.Try$.apply(Try.scala:210)
	at akka.actor.ReflectiveDynamicAccess.getClassFor(ReflectiveDynamicAccess.scala:28)
	at akka.actor.ReflectiveDynamicAccess.createInstanceFor(ReflectiveDynamicAccess.scala:47)
	at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:926)
	at akka.actor.ActorSystem$.apply(ActorSystem.scala:282)
	at akka.actor.ActorSystem$.apply(ActorSystem.scala:326)
	at akka.actor.ActorSystem$.apply(ActorSystem.scala:308)
	at example.PlayWSResource$.$anonfun$res$1(PlayWSResource.scala:20)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:104)
	at cats.effect.internals.IORunLoop$.restartCancelable(IORunLoop.scala:51)
	at cats.effect.internals.IOBracket$BracketStart.run(IOBracket.scala:100)
	at cats.effect.internals.Trampoline.cats$effect$internals$Trampoline$$immediateLoop(Trampoline.scala:67)
	at cats.effect.internals.Trampoline.startLoop(Trampoline.scala:35)
	at cats.effect.internals.TrampolineEC$JVMTrampoline.super$startLoop(TrampolineEC.scala:90)
	at cats.effect.internals.TrampolineEC$JVMTrampoline.$anonfun$startLoop$1(TrampolineEC.scala:90)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
	at cats.effect.internals.TrampolineEC$JVMTrampoline.startLoop(TrampolineEC.scala:90)
	at cats.effect.internals.Trampoline.execute(Trampoline.scala:43)
	at cats.effect.internals.TrampolineEC.execute(TrampolineEC.scala:42)
	at cats.effect.internals.IOBracket$BracketStart.apply(IOBracket.scala:80)
	at cats.effect.internals.IOBracket$BracketStart.apply(IOBracket.scala:58)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:183)
	at cats.effect.internals.IORunLoop$.restart(IORunLoop.scala:41)
	at cats.effect.internals.IOBracket$.$anonfun$apply$1(IOBracket.scala:48)
	at cats.effect.internals.IOBracket$.$anonfun$apply$1$adapted(IOBracket.scala:34)
	at cats.effect.internals.IOAsync$.$anonfun$apply$1(IOAsync.scala:37)
	at cats.effect.internals.IOAsync$.$anonfun$apply$1$adapted(IOAsync.scala:37)
	at cats.effect.internals.IORunLoop$RestartCallback.start(IORunLoop.scala:447)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:156)
	at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:463)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:484)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:422)
	at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:183)
	at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:463)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:484)
	at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:422)
	at cats.effect.internals.IOShift$Tick.run(IOShift.scala:36)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)

Enhanced:

java.lang.ClassCastException: interface akka.event.LoggingFilter is not assignable from class akka.event.DefaultLoggingFilter
	at akka.actor.ReflectiveDynamicAccess.$anonfun$getClassFor$1(ReflectiveDynamicAccess.scala:31)
	at make @ example.PlayWSResource$.res(PlayWSResource.scala:42)
	at make @ example.PlayWSResource$.res(PlayWSResource.scala:42)
	at flatMap @ fs2.internal.CompileScope.acquireResource(CompileScope.scala:180)
	at flatMap @ fs2.internal.FreeC$.$anonfun$compile$12(Algebra.scala:511)
	at flatMap @ fs2.internal.FreeC$.interruptGuard$1(Algebra.scala:436)
	at flatMap @ fs2.internal.FreeC$.$anonfun$compile$7(Algebra.scala:463)
	at flatMap @ fs2.internal.FreeC$.go$1(Algebra.scala:460)
	at flatMap @ fs2.internal.CompileScope.$anonfun$open$2(CompileScope.scala:146)
	at flatMap @ fs2.internal.CompileScope.open(CompileScope.scala:141)
	at flatMap @ fs2.internal.FreeC$.$anonfun$compile$15(Algebra.scala:533)
	at flatMap @ fs2.internal.FreeC$.$anonfun$compile$14(Algebra.scala:531)
	at flatMap @ fs2.internal.FreeC$.interruptGuard$1(Algebra.scala:436)
	at flatMap @ fs2.internal.FreeC$.$anonfun$compile$7(Algebra.scala:463)
	at flatMap @ fs2.internal.FreeC$.go$1(Algebra.scala:460)
	at flatMap @ fs2.internal.FreeC$.$anonfun$compile$7(Algebra.scala:463)
	at flatMap @ fs2.internal.FreeC$.go$1(Algebra.scala:460)

Origin: https://github.com/keynmol/weaver-classloader-repro/tree/237e3bcdfb190b49b8360ea8b68ba6f5a15b24e2

Seems a bit aggressive

djspiewak avatar Dec 17 '20 20:12 djspiewak

I'd go as far as to say we should be able to skip fs2 internals too ;D

kubukoz avatar Jan 08 '21 15:01 kubukoz

Yes please!

mpilquist avatar Jan 08 '21 16:01 mpilquist

Because tracing is coming to CE3, as much as I love fs2, I don't feel that special casing fs2 internals inside cats-effect is the way to go. Ideally, we would have a JVM configuration parameter or something similar to IORuntimeConfig that can influence the suppressed packages. That way, fs2 can be in charge of its own configuration (as well as other projects) and it guards against this configuration becoming stale and therefore useless (if the internal packages change over time, or new are added).

vasilmkd avatar Apr 02 '21 00:04 vasilmkd

Yeah, that's what I meant. I'd likely do the same for cats.free to get doobie's stuff out of the way, etc.... but it should definitely not be baked in.

What would be nice is if libraries could expose, like, a list of internal packages, so that the users could reuse lists from multiple libraries in their configs.

kubukoz avatar Apr 02 '21 01:04 kubukoz

Extensibility of semantic tracing is definitely something I want to think about. It's tricky from a number of standpoints, but either way, the first step is to get tracing reinstated within the runtime.

djspiewak avatar Apr 02 '21 15:04 djspiewak

We should check to see if this is still an issue on CE3.

djspiewak avatar Aug 30 '21 20:08 djspiewak