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

Check for Common FJP Having Zero Threads #131

Merged
merged 3 commits into from
Oct 27, 2023
Merged

Conversation

Michael-A-McMahon
Copy link
Member

@Michael-A-McMahon Michael-A-McMahon commented Aug 29, 2023

This branch addresses the case where the common ForkJoinPool (FJP) has zero threads. This can occur with -Djava.util.concurrent.ForkJoinPool.common.parallelism=0, or in certain Kubernetes environments on certain versions of the JDK.
When this condition occurs, the result is brutal for our users. The system will simply hang without reporting any error. A jstack dump won't show any threads blocked either. The user will have no indication about it is causing the issue and how to fix it.
The fix will have Oracle R2DBC fallback to a single threaded ForkJoinPool if the common pool potentially has zero threads. Unfortunately, there is no simple way to distinguish between common FJP that has 1 thread or 0 threads. The getParallelism and getCommonPoolParallelism methods both return 1 when the FJP has 0 threads. They also return 1 when the FJP has 1 thread. So the fix will fall back to a single threaded FJP in either case.

Revised Fix:
Oracle R2DBC will only check for common.parallelism=0. This is the only valid way to have zero threads in the common pool.
Oracle R2DBC will not check for getCommonPoolParallelism()==1. That fix is only valuable when the JDK has a defect. The fix detract value for users who aren't using a defective JDK, as it unnecessarily allocates an additional thread.

@Michael-A-McMahon Michael-A-McMahon self-assigned this Aug 29, 2023
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Aug 29, 2023
@Michael-A-McMahon Michael-A-McMahon merged commit da33589 into main Oct 27, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with microservice using r2dbc oracle inside kubernetes cluster. (Request timeouts)
2 participants