aionnetwork / AVM

Enabling Java code to run in a blockchain environment
https://theoan.com/
MIT License
49 stars 25 forks source link

AVM must not call System.exit #342

Closed jeff-aion closed 5 years ago

jeff-aion commented 5 years ago

There are a few "ultra-fatal" scenarios, in DAppCreator and DAppExecutor, where the AVM directly issues calls to System.exit(-1). This made sense in the very earliest points of the development but doesn't fit within the AVM's intended embeddable use.

Specifically, this is causing deadlocks in embedding use-cases where shutdown hooks are registered when a fatal error occurs (fatal errors which are also invalid and must be commuted to other rejection scenarios): a thread waiting on a result will never be unblocked by an executor thread waiting in System.exit - this is further magnified in the case where this blocked thread blocks the shutdown of another component (such as an RPC server).