Open Jonaythaz opened 3 months ago
Welcome to the Jolie community! Thank you for taking your time to contribute to the project, we really appreciate it. :tada: A member of the Jolie team will look at this as soon as possible. You can also reach us directly via chat or e-mail, see https://github.com/jolie/jolie#get-in-touch.
Services with
single
as the execution modality shut down before one-way operations finish executing.I initially encountered this problem while testing making calls to the embedder from a Java service, but I was also able to reproduce the problem with the following Jolie code (running in a devcontainer with the
jolielang/jolie:1.12.0-dev
image):Running the
Main
service of this program is supposed to print "Hello World!" to the console, and does in fact do so when the linesleep@Time(3000)()
isn't included, but when the execution time of the one-way operation is too long the program seemingly just stops before it finishes executing.From looking into the problem it seems that the cause is that, when the execution modality of a service is
single
, theexit
method of theInterpreter
class is called once all request-response operations finish executing. The reason this is a problem is because theexit
method causes all the executors to shut down, meaning that when the one-way operation tries to have some work executed, in this case theprintln
operation, the executor it is trying to have execute the operation is shutting down, or already terminated, and therefore refuses the work.I did also try to see if there was a simple way to solve the problem, but the furthest I got was that the problem seems to have something to do with how the
SessionThread
, or perhaps evenExecutionThread
, class is implemented, since, best I can tell, theexit
method is called once itsjoin
method returns in therunCode
method of theInterpreter
class.