You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/11/03 23:07:00 UTC
[jira] [Commented] (KARAF-6697) karaf-maven-plugin verify goal leaks threads
[ https://issues.apache.org/jira/browse/KARAF-6697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17628560#comment-17628560 ]
ASF GitHub Bot commented on KARAF-6697:
---------------------------------------
wborn opened a new pull request, #1678:
URL: https://github.com/apache/karaf/pull/1678
Since we now verify ~400 features in the openHAB Addons repo, the number of threads being leaked by the verify goal causes GitHub Actions builds to run out of memory.
I did some investigation and found that the thread leak is caused by the VerifyMojo itself.
For some reason the threads created by the executor are never garbage collected.
---
The goal leaks 8 threads each time it is executed. So if you verify 400 features in a build it causes 3200 threads to be leaked:
![before](https://user-images.githubusercontent.com/12213581/199851563-751c3ad6-d9ec-49c0-9560-1d1bcb54749d.png)
---
When the executor is shutdown the verify goal no longer leaks threads. :slightly_smiling_face:
![after](https://user-images.githubusercontent.com/12213581/199851572-bac84c95-8b94-4014-95b8-d36b9de44316.png)
---
It would also be nice when the fix is cherry-picked to 4.3.x.
> karaf-maven-plugin verify goal leaks threads
> --------------------------------------------
>
> Key: KARAF-6697
> URL: https://issues.apache.org/jira/browse/KARAF-6697
> Project: Karaf
> Issue Type: Bug
> Components: karaf
> Affects Versions: 4.2.7, 4.2.8
> Reporter: Wouter Born
> Priority: Major
> Attachments: karaf-no-threads-leak.png, karaf-threads-leak.png
>
>
> We use the verify goal of the karaf-maven-plugin to verify 200+ features in our openHAB add-ons build (see [pom.xml|https://github.com/openhab/openhab-addons/blob/2.5.x/bundles/pom.xml]).
> When monitoring the build using [VisualVM|https://visualvm.github.io/] the live thread counts keep increasing each time the verify goal is executed.
> It increases to ~2000 threads after invoking the goal 200+ times:
>
> !karaf-threads-leak.png!
>
> When the [plugin|https://github.com/openhab/openhab-addons/blob/65eff40dba68a346845f4c69db495bed2086b05f/bundles/pom.xml#L399-L402] is removed from the build everything returns to normal (this was a full build with tests):
>
> !karaf-no-threads-leak.png!
>
> To reproduce it on our code:
> # {{git clone -b 2.5.x --single-branch git@github.com:openhab/openhab-addons.git}}
> # {{cd openhab-addons}}
> # {{mvn clean install -DskipChecks -DskipTests}}
> # Monitor the live thread counts using a tool like VisualVM
> When re-running the same build without Karaf feature validation, VisualVM will show that the live thread counts peak at 20 instead:
> # {{mvn clean install -DskipChecks -DskipTests -Dfeatures.verify.skip=true}}
> I also tested the 4.2.8 version of the plugin but it was still leaking threads.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)