Open
Description
Bug description
When using QueuingTransactionReceiptProcessor in a Spring Boot, a crash (an exception thrown) during the singleton beans initialization phase leaves the Spring Boot application hanging.
Steps to reproduce
In a SpringBoot Application using web3j, in a bean constructor call:
- Create a QueuingTransactionReceiptProcessor:
transactionReceiptProcessor = new QueuingTransactionReceiptProcessor(this.readWeb3j, callback, txManagerPollAttempts, txManagerPollSleepDuration);
- Throw an exception afterwards.
Expected behavior
The resources will be released and the Spring-boot application will exit.
Actual behavior
The resources are not released and the Spring boot application stays hanging, waiting all the hreads to quit. The reason is that the shutdown().
The cause is that the shutdown hook is set up only after the singleton beans are created and in this case the bean creation fails.
Environment
- Web3j version: 4.12.3
- Java : 21
- Operating System: Ubuntu 22