-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
Use workaround to fix high CPU usage by LinkedTransferQueue #3756
Conversation
This is a workaround for JDK-8301341 by using the Java 11 LinkedTransferQueue with the QueueingThreadPoolExecutor in the Core and jUPnP. Signed-off-by: Wouter Born <[email protected]>
If you grant me owner rights on your repo, I can transfer it to the openHAB org. |
I can only add collaborators so I asked to transfer it to you so you can transfer it to openHAB and give me back permissions. 🙂 |
Done: https://github.com/openhab/openhab-base-fixes |
Great! Are the GAV parameters OK? If so, I can update the POM for the repo change and add a GitHub release. |
Fine with me. |
I've build the artifacts and added them to these releases:
So if you can upload those we can see if the build succeeds. |
Thanks, I have uploaded both to Artifactory. |
Related to openhab/openhab-core#3756 Signed-off-by: Wouter Born <[email protected]>
Related to openhab/openhab-core#3756 Signed-off-by: Wouter Born <[email protected]>
It seems to build pretty well except for #3257 acting up again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
* Resolve runbundles for workaround Related to openhab/openhab-core#3756 Signed-off-by: Wouter Born <[email protected]>
Related to openhab/openhab-core#3756 Signed-off-by: Wouter Born <[email protected]>
This is a workaround for JDK-8301341 by using the Java 11 LinkedTransferQueue with the QueueingThreadPoolExecutor in the Core and jUPnP. Signed-off-by: Wouter Born <[email protected]>
* Resolve runbundles for workaround Related to openhab/openhab-core#3756 Signed-off-by: Wouter Born <[email protected]>
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/openhab-4-1-milestone-discussion/149502/32 |
* Resolve runbundles for workaround Related to openhab/openhab-core#3756 Signed-off-by: Wouter Born <[email protected]> Signed-off-by: Jørgen Austvik <[email protected]>
…Executor Motivation: The use of `LinkedTransferQueue` in JDK 17 has a bug causing a thread to consume all of a CPU's usage: https://bugs.openjdk.org/browse/JDK-8301341. Although this bug has been fixed, the patch has not been backported to JDK 17. Since copying the code from JDK 11 poses licensing issues (openhab/openhab-core#3756), we need a different solution. Switching to `LinkedBlockingQueue` offers a feasible workaround. While `LinkedTransferQueue` is typically efficient under high multi-thread contention due to its use of CAS, our current usage does not exhibit significant contention as the queue tasks' size remains close to 0. Modifications: - Replaced the use of `LinkedTransferQueue` with `LinkedBlockingQueue` in `ThreadPoolExecutor`. Result: - You no longer see an excessive CPU usage by a single thread.
…Executor (#946) Motivation: The use of `LinkedTransferQueue` in JDK 17 has a bug causing a thread to consume all of a CPU's usage: https://bugs.openjdk.org/browse/JDK-8301341. Although this bug has been fixed, the patch has not been backported to JDK 17. Since copying the code from JDK 11 poses licensing issues (openhab/openhab-core#3756), we need a different solution. Switching to `LinkedBlockingQueue` offers a feasible workaround. While `LinkedTransferQueue` is typically efficient under high multi-thread contention due to its use of CAS, our current usage does not exhibit significant contention as the queue tasks' size remains close to 0. Modifications: - Replaced the use of `LinkedTransferQueue` with `LinkedBlockingQueue` in `ThreadPoolExecutor`. Result: - You no longer see an excessive CPU usage by a single thread.
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/jupnp-library-version-2-7-1-oh1-in-my-bundle-list/156221/9 |
This is a workaround for JDK-8301341 by using the Java 11
LinkedTransferQueue
with theQueueingThreadPoolExecutor
in the Core and jUPnP.Using the Java 11
LinkedTransferQueue
is probably the most stable option because it did not cause these issues with OH3.To be able to use the same artifact with jUPnP, jUPnP also needs to be build with Java 11 or newer (it's currently still compatible with Java 8).
I put the Java 11
LinkedTransferQueue
in a separate repo because it has a GPLv2+CE license.Perhaps the repo can also be moved to the openHAB organization?
Because Java and OpenJDK are trademarks, it is probably best to avoid these in repo and package names etc.
Let me know if you agree with the proposed artifact GAV parameters.
After that I can build the artifacts and they can be added to Artifactory.
Closes #3755