Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Commons Threads 3.2.22
-
None
Description
The mechanism introduced with SLING-6261 does no longer work with Java 9 and above and always fails with
27.12.2023 11:18:23 *WARN * [FelixStartLevel] o.a.s.c.t.i.DefaultThreadPool: Unsupported JRE, cannot register ThreadPoolExecutorCleaningThreadLocals due to 'null', fall back to regular ThreadPoolExecutor (DefaultThreadPool.java, line 157) java.lang.ExceptionInInitializerError: null at org.apache.sling.commons.threads.impl.ThreadPoolExecutorCleaningThreadLocals.<init>(ThreadPoolExecutorCleaningThreadLocals.java:52) at org.apache.sling.commons.threads.impl.DefaultThreadPool.<init>(DefaultThreadPool.java:150) at org.apache.sling.commons.threads.impl.DefaultThreadPoolManager$Entry.incUsage(DefaultThreadPoolManager.java:371) at org.apache.sling.commons.threads.impl.DefaultThreadPoolManager.get(DefaultThreadPoolManager.java:143) at org.apache.sling.commons.scheduler.impl.SchedulerProxy.<init>(SchedulerProxy.java:65) at org.apache.sling.commons.scheduler.impl.QuartzScheduler.scheduleJob(QuartzScheduler.java:588) at org.apache.sling.commons.scheduler.impl.QuartzScheduler.addPeriodicJob(QuartzScheduler.java:344) at org.apache.sling.commons.scheduler.impl.QuartzScheduler.addPeriodicJob(QuartzScheduler.java:329) at org.apache.sling.commons.scheduler.impl.GaugesSupport.activate(GaugesSupport.java:156) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:245) at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:687) at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:531) at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:317) at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:307) at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:354) at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:115) at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:1002) at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:975) at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:785) at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:1274) at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:1225) at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1232) at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1152) at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:959) at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:895) at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1184) at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:116) at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990) at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838) at org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545) at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4863) at org.apache.felix.framework.Felix.registerService(Felix.java:3834) at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328) at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:929) at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:915) at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:133) at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:984) at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:752) at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:674) at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:437) at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:671) at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:310) at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:593) at org.apache.felix.scr.impl.Activator.access$200(Activator.java:74) at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:460) at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196) at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169) at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49) at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488) at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:420) at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450) at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915) at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834) at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516) at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4847) at org.apache.felix.framework.Felix.startBundle(Felix.java:2363) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1566) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) at java.base/java.lang.Thread.run(Thread.java:840) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field java.lang.ThreadLocal$ThreadLocalMap java.lang.Thread.threadLocals accessible: module java.base does not "opens java.lang" to unnamed module @15a81a26 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at org.apache.sling.commons.threads.impl.ThreadLocalCleaner.field(ThreadLocalCleaner.java:86) at org.apache.sling.commons.threads.impl.ThreadLocalCleaner.<clinit>(ThreadLocalCleaner.java:54) ... 65 common frames omitted
That warning is very verbose as it happens nowadays with almost every JRE. The stack trace should only be exposed on level "DEBUG". Apart from that the ExceptionInInitializerError seems to always return null in its getMessage.
Attachments
Issue Links
- is caused by
-
SLING-6261 ThreadExpiringThreadPool is relying on uncaught exceptions to kill threads
- Resolved
- is related to
-
SLING-10831 o.a.s.commons.thread fails setting up ThreadLocal cleaner on Java 17
- Open
- links to