Initially I had a problem with the Web3j object, but after explicitly calling its shutdown method everything works fine (JVM quits immediately, so my application closes). The problem occurs when I call load(...) method of any Smart Contract. For some reason, if I quit the application, JVM hangs for 40-50 seconds until it quits. This is the thread dump: The thread dump

Here is the code used to load the contract:

enter image description here

  • Hey, could you share some code to try to reproduce the issue. I never experienced anything like that. Jun 24, 2019 at 21:10
  • I added some code that loads a contract
    – Bogdan
    Jun 25, 2019 at 2:23
  • Oh man, this is something very interesting. Apparently it is related to OkHttp, and some cleaning task that starts from the ConnectionPool. It might be related with this: github.com/square/okhttp/issues/4029
    – Bogdan
    Jun 25, 2019 at 4:49
  • Interesting one. So I deduce your are using java9. Ethereum client doesn't support HTTP/2 so I might suggest you (if possible) to rollback to Java8 as suggested. Or alternatively, you can try connecting via WebSocket to the client. Jun 25, 2019 at 8:10
  • Nope. I use Java 8 with Http/1.1. So far after my small research I am 99% sure that the ForkJoinPool is responsible for that (it is executed while I call load()). Also, the cleaning threads from Okhttp are Daemons so they should not block the JVM from closing.
    – Bogdan
    Jun 25, 2019 at 9:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.