You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@toree.apache.org by Piyush Narang <pn...@twitter.com.INVALID> on 2017/06/28 19:01:17 UTC
KernelSecurityManager doesn't allow users to create their own thread groups
hi folks,
I'm trying to run a Spark Scala job using Toree and I'm running into some
issues as the code in our job calls into one of our libraries which tries
to create threads in its own ThreadGroup:
https://github.com/twitter/util/blob/develop/util-core/src/main/scala/com/twitter/concurrent/NamedPoolThreadFactory.scala#L28
This seems to cause this check in Toree's KernelSecurityManager to trip:
https://github.com/apache/incubator-toree/blob/master/kernel-api/src/main/scala/org/apache/toree/security/KernelSecurityManager.scala#L121
Stack looks like:
Name: java.lang.SecurityException
Message: Not allowed to modify ThreadGroups!
StackTrace: at
org.apache.toree.security.KernelSecurityManager.checkAccess(KernelSecurityManager.scala:114)
at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)
at java.lang.Thread.init(Thread.java:394)
at java.lang.Thread.init(Thread.java:349)
at java.lang.Thread.<init>(Thread.java:599)
at com.twitter.concurrent.NamedPoolThreadFactory.newThread(NamedPoolThreadFactory.scala:32)
...
Here's a simple repro:
println(Thread.currentThread().getThreadGroup) // default thread
groupval group: ThreadGroup = new
ThreadGroup(Thread.currentThread().getThreadGroup(), "name")
val hello = new Thread(group, new Runnable {
def run() {
println("hello world")
}
})
println(hello.getThreadGroup)
hello.start
Any suggestions for working around this? (TOREE-421
<https://issues.apache.org/jira/browse/TOREE-421>)
Thanks,
--
- Piyush