privacyidea / shibboleth-plugin

Plugin for shibboleth MFA with privacyidea
https://privacyidea.org
GNU Affero General Public License v3.0
8 stars 0 forks source link

Java thread pool leak bug in idp-plugin-privacyIDEA-1.1.0 #60

Open equbaykiflay opened 1 month ago

equbaykiflay commented 1 month ago

I opened this bug on Shibboleth but it was found that the bug is actually in the privacyIDEA plugin. I verified that by disabling the plugin and checking if the problem disappears, which it did. So I am posting it here

Description

Thread pools are not being released resulting in thread and memory leak. Here is the output of jstack with a threads aged over 11 hours and less than 10 second stuck waiting on condition.

root@shibserver:~# jstack 1115417 | grep -A 14 thread-1 | head -30 "pool-3-thread-1" #105 prio=5 os_prio=0 cpu=36.14ms elapsed=42650.98s tid=0x00007f52f819fe80 nid=0x1106a7 waiting on condition [0x00007f52d6ffe000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@17.0.12/Native Method)

"pool-4-thread-1" #109 prio=5 os_prio=0 cpu=0.62ms elapsed=42649.61s tid=0x00007f52f81a2ff0 nid=0x1106af waiting on condition [0x00007f52d69f8000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@17.0.12/Native Method)

root@shibserver:~# jstack 1115417 | grep -A 14 thread-1 | tail -32 "pool-6929-thread-1" #32245 prio=5 os_prio=0 cpu=0.57ms elapsed=7.75s tid=0x00007f535e314060 nid=0x122c78 waiting on condition [0x00007f5122ad4000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@17.0.12/Native Method)

-- "pool-6930-thread-1" #32248 prio=5 os_prio=0 cpu=0.21ms elapsed=6.41s tid=0x00007f52f4724470 nid=0x122c7b waiting on condition [0x00007f51249f3000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@17.0.12/Native Method)

Environment

OS: Debian 12.7 Container: Jetty 12.0.13 JVM: amazon-corretto 17.0.12.7.1 (build 17.0.12+7-LTS, mixed mode, sharing) Idp: Shibboleth 5.1.3 PI plugin: idp-plugin-privacyIDEA 1.1.0

nilsbehlen commented 1 month ago

@lukasmatusiewicz does this plugin in v1.1.0 use the javaclient in v1.2.2? I have made changes to the java client to fix this problem. it was reported previously with keycloak. If not, we need to build a new version of this plugin with the current javaclient.

lukasmatusiewicz commented 1 month ago

@nilsbehlen it uses v1.2.0 - 17 Jan 2023, so we need to update it