Summary: When making some transactional insert/update/delete to database I get a blocking call issue (Tracked by Block Hound) This is related with UUID class because SecureRandom uses /dev/random which has block behaviour.
Alternative: Replace SecureRandom by /dev/urandom is not an alternative in my case, can you provide a fix for non blocking thread in this case?
** Source of the problem**: this line
Stack trace:
at java.io.FileInputStream.readBytes(FileInputStream.java) ~[?:?]
at java.io.FileInputStream.read(FileInputStream.java:279) ~[?:?]
at java.io.FilterInputStream.read(FilterInputStream.java:133) ~[?:?]
at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424) ~[?:?]
at sun.security.provider.NativePRNG$RandomIO.ensureBufferValid(NativePRNG.java:526) ~[?:?]
at sun.security.provider.NativePRNG$RandomIO.implNextBytes(NativePRNG.java:545) ~[?:?]
at sun.security.provider.NativePRNG.engineNextBytes(NativePRNG.java:220) ~[?:?]
at java.security.SecureRandom.nextBytes(SecureRandom.java:751) ~[?:?]
at java.util.UUID.randomUUID(UUID.java:150) ~[?:?]
at org.springframework.transaction.reactive.TransactionContext.<init>(TransactionContext.java:43) ~[spring-tx-5.3.7.jar:5.3.7]
at org.springframework.transaction.reactive.TransactionContext.<init>(TransactionContext.java:60) ~[spring-tx-5.3.7.jar:5.3.7]
at org.springframework.transaction.reactive.TransactionContextHolder.createContext(TransactionContextHolder.java:63) ~[spring-tx-5.3.7.jar:5.3.7]
at org.springframework.transaction.reactive.TransactionContextManager.lambda$getOrCreateContext$2(TransactionContextManager.java:91) ~[spring-tx-5.3.7.jar:5.3.7]
Version: org.springframework:spring-tx:5.3.7
Comment From: jhoeller
This is a duplicate of #26955 - we're revisiting that UUID generation call for 5.3.9, probably switching to a simpler id generation strategy (since the id is mostly just used for logging anyway).