Skip to content
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

QueuingTransactionReceiptProcessor should provide a mechanism of closing the scheduledExecutorService thread pool #2148

Open
IvanovVenko opened this issue Feb 6, 2025 · 0 comments
Labels
bug A bug in behaviour or functionality

Comments

@IvanovVenko
Copy link

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:

  1. Create a QueuingTransactionReceiptProcessor:
    transactionReceiptProcessor = new QueuingTransactionReceiptProcessor(this.readWeb3j, callback, txManagerPollAttempts, txManagerPollSleepDuration);
  2. 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

Additional context

@IvanovVenko IvanovVenko added the bug A bug in behaviour or functionality label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in behaviour or functionality
Projects
None yet
Development

No branches or pull requests

1 participant