Mantis - Resin
Viewing Issue Advanced Details
4889 minor always 12-02-11 12:08 02-21-12 16:55
cowan  
ferg  
normal  
closed 4.0.24  
fixed  
none    
none 4.0.26  
0004889: Static calls to Alarm create Threads
The AlarmClock created in Alarm as a static class declaration calls ThreadPool.getThreadPool which spawns new threads. It seems unnecessary to spawn threads unless they are really needed, particularly simply upon class initialization.

This causes issues running on Google App Engine, because their sandbox does not permit thread creation.

This results in GoogleQuercusServlet failing to serve PHP because PageManager calls Alarm.isActive.

WARNING: Nested in java.lang.ExceptionInInitializerError:
java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
    at java.security.AccessController.checkPermission(AccessController.java:546)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:166)
    at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:191)
    at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:299)
    at java.lang.Thread.init(Thread.java:336)
    at java.lang.Thread.<init>(Thread.java:436)
    at com.caucho.env.thread.ThreadLauncher.startWorkerThread(ThreadLauncher.java:125)
    at com.caucho.env.thread.AbstractTaskWorker.wake(AbstractTaskWorker.java:118)
    at com.caucho.env.thread.AbstractThreadLauncher.update(AbstractThreadLauncher.java:453)
    at com.caucho.env.thread.ThreadLauncher.setPriorityIdleMin(ThreadLauncher.java:74)
    at com.caucho.env.thread.ThreadLauncher.<init>(ThreadLauncher.java:64)
    at com.caucho.env.thread.ThreadPool.<init>(ThreadPool.java:136)
    at com.caucho.env.thread.ThreadPool.<init>(ThreadPool.java:129)
    at com.caucho.env.thread.ThreadPool.getThreadPool(ThreadPool.java:156)
    at com.caucho.util.AlarmClock.<init>(AlarmClock.java:65)
    at com.caucho.util.Alarm.<clinit>(Alarm.java:68)
Rep by M. Frank

There are no notes attached to this issue.