-
Notifications
You must be signed in to change notification settings - Fork 143
Object encapsulation sometimes required in order for the script to execute without blocking/Timeout #532
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
Comments
(scala-cli 0.1.12 - scala 3.1.3 - ZIO 2.0.0)
(See zio/zio#7301 which is going to be closed) The first one is stucked for ever, and if we take a look to a thread dump :
we are stuck on a
|
With latest release of scala-cli (0.12.1), the behavior is different, it didn't hang anymore but instead it raises an exception :
same result using scala 3.2.2 or 3.1.1 And of course if I uses the REPL, no issue it runs fine :
|
As soon as a script have to deal with an execution context, or asynchronous processing such as scala Future, ZIO, cats, ...) it is needed to encapsulate the code within an object in order for the script to execute properly, if not it blocks/timeouts without giving any results.
Ammonite has the same issue, see : com-lihaoyi/Ammonite#802 and I was able in some cases to mitigate the issue by adding an ammonite startup option :
amm --class-based ...
.I think this is an important issue, as it makes our scripts more verbose by systematically having to encapsulate part of the code within objects, and requiring us then to call a function within that object to start the execution.
See next examples, but if required I can provide more examples as the issue is quite easy to reproduce as soon as you use libraries such as AKKA, ZIO, CATS, DOODLE, ...
I was using scala-cli 0.0.9 in this test and scala3, but it is reproductible with any other scala releases.
KO example : (https://gist.github.com/dacr/47ca242e6d672e0154c5816a0330eea7)
OK example : (https://gist.github.com/dacr/13ff195adf279798ed5dcc16da2a33ba)
Executions results :
The text was updated successfully, but these errors were encountered: