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

Blocking call according to BlockHound in spring-tx #27040

Closed
kurt-jadson opened this issue Jun 8, 2021 · 1 comment
Closed

Blocking call according to BlockHound in spring-tx #27040

kurt-jadson opened this issue Jun 8, 2021 · 1 comment
Assignees
Labels
status: duplicate A duplicate of another issue

Comments

@kurt-jadson
Copy link

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 8, 2021
@jhoeller jhoeller self-assigned this Jun 8, 2021
@jhoeller jhoeller added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 8, 2021
@jhoeller
Copy link
Contributor

jhoeller commented Jun 8, 2021

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).

@jhoeller jhoeller closed this as completed Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants