cats icon indicating copy to clipboard operation
cats copied to clipboard

FreeT is stack-unsafe

Open djspiewak opened this issue 5 years ago • 2 comments

...somehow.

	at cats.free.FreeT.$anonfun$step$1(FreeT.scala:163)
	at scala.Function1.$anonfun$andThen$1(Function1.scala:85)
	at cats.free.FreeT.$anonfun$step$1(FreeT.scala:163)
	at scala.Function1.$anonfun$andThen$1(Function1.scala:85)
	at cats.free.FreeT.$anonfun$step$1(FreeT.scala:163)
	at scala.Function1.$anonfun$andThen$1(Function1.scala:85)
	at cats.free.FreeT.$anonfun$step$1(FreeT.scala:163)
	at scala.Function1.$anonfun$andThen$1(Function1.scala:85)
	at cats.free.FreeT.$anonfun$step$1(FreeT.scala:163)
	at scala.Function1.$anonfun$andThen$1(Function1.scala:85)
	at cats.free.FreeT.$anonfun$step$1(FreeT.scala:163)
	at scala.Function1.$anonfun$andThen$1(Function1.scala:85)

That goes on for a while and turns into an SOE. Staring at the source code, it looks like a recursive flatMap is causing it, but it's hard to say exactly.

djspiewak avatar Aug 04 '20 16:08 djspiewak

Exciting! Do you have a reproduction?

alissapajer avatar Aug 11 '20 18:08 alissapajer

Nothing minimized! I did discover it was a straight-up recursive definition though. I'm guessing that it's a left-associated bind where the recursion is on the left side. That's something that FreeT should still be fine with, but apparently it isn't handling that case (or something like it) very well.

djspiewak avatar Aug 11 '20 22:08 djspiewak