Closed mgr32 closed 1 year ago
Description
When using SQSRestServerBuilder directly, stopAndWait method does not shutdown the Actor System, resulting in main process hanging indefinitely.
SQSRestServerBuilder
stopAndWait
The following code hangs indefinitely since 1.0.0 (finishing correctly in 0.15.8):
public static void main(String[] args) { var sqsRestServer = SQSRestServerBuilder.withDynamicPort().start(); sqsRestServer.waitUntilStarted(); sqsRestServer.stopAndWait(); }
Minimal reproducible example (Java): https://github.com/mgr32/elasticmq-stopandwait-issue
Expected results
The above code should finish, in the same way as it worked in 0.15.8.
Details
Last version working ok: 0.15.8 First version where the issue occurs: 1.0.0 Last version checked where the issue occurs: 1.4.2
Commit that probably introduced the issue: https://github.com/softwaremill/elasticmq/commit/e49a1d2408f47cff7c1f6543659a0b92372756fb
Workaround
To workaround the issue, you can create and terminate ActorSystem manually:
ActorSystem
public static void main(String[] args) throws Exception { var actorSystem = ActorSystem.apply("elasticmq"); var sqsRestServer = SQSRestServerBuilder.withActorSystem(actorSystem).withDynamicPort().start(); sqsRestServer.waitUntilStarted(); sqsRestServer.stopAndWait(); Await.result(actorSystem.terminate(), FiniteDuration.apply(1, TimeUnit.MINUTES)); }
Thanks for reporting the issue! It should be fixed in https://github.com/softwaremill/elasticmq/releases/tag/v1.4.3
Thank you @micossow for such a quick fix, it helped :+1:
Description
When using
SQSRestServerBuilder
directly,stopAndWait
method does not shutdown the Actor System, resulting in main process hanging indefinitely.The following code hangs indefinitely since 1.0.0 (finishing correctly in 0.15.8):
Minimal reproducible example (Java): https://github.com/mgr32/elasticmq-stopandwait-issue
Expected results
The above code should finish, in the same way as it worked in 0.15.8.
Details
Last version working ok: 0.15.8 First version where the issue occurs: 1.0.0 Last version checked where the issue occurs: 1.4.2
Commit that probably introduced the issue: https://github.com/softwaremill/elasticmq/commit/e49a1d2408f47cff7c1f6543659a0b92372756fb
Workaround
To workaround the issue, you can create and terminate
ActorSystem
manually: