cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sumant Padbidri (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-13898) Stack overflow error with UDF using IBM JVM
Date Wed, 22 Nov 2017 22:13:02 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-13898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16263445#comment-16263445
] 

Sumant Padbidri commented on CASSANDRA-13898:
---------------------------------------------

I contacted the IBM JVM team. Their feedback:

https://docs.oracle.com/javase/8/docs/api/java/lang/SecurityManager.html#checkPackageAccess-java.lang.String-
says "If this method is overridden, then super.checkPackageAccess should be called as the
first line in the overridden method".

org/apache/cassandra/cql3/functions/ThreadAwareSecurityManager does not follow that:

{{public void checkPackageAccess(String pkg)
    {
        if (!isSecuredThread())
            return;

        if (!((SecurityThreadGroup) Thread.currentThread().getThreadGroup()).isPackageAllowed(pkg))
        {
            RuntimePermission perm = new RuntimePermission("accessClassInPackage." + pkg);
            throw new AccessControlException("access denied: " + perm, perm);
        }

        super.checkPackageAccess(pkg);
    }
}}

> Stack overflow error with UDF using IBM JVM
> -------------------------------------------
>
>                 Key: CASSANDRA-13898
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13898
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: Cassandra 3.11 with IBM JVM 8.0.5
>            Reporter: Sumant Padbidri
>
> I'm using Cassandra 3.11 right out of the box (i.e. all default parameters) with the
IBM JVM 8.0.5. Using any UDF results in a stack overflow error. They work fine with the Oracle
JVM. "Create function" works, but using the function in a query results in the error.
> CREATE TABLE test (
>     id int,
>     val1 int,
>     val2 int,
>     PRIMARY KEY(id)
> );
> INSERT INTO test(id, val1, val2) VALUES(1, 100, 200);
> INSERT INTO test(id, val1, val2) VALUES(2, 100, 300);
> INSERT INTO test(id, val1, val2) VALUES(3, 200, 150);
> CREATE OR REPLACE FUNCTION maxOf(current int, testvalue int)
> CALLED ON NULL INPUT
> RETURNS int
> LANGUAGE java
> AS $$return Math.max(current,testvalue);$$;
> SELECT id, val1, val2, maxOf(val1,val2) FROM test WHERE id = 1;
> Here's the stack trace from debug.log:
> java.lang.RuntimeException: java.lang.StackOverflowError
>     at org.apache.cassandra.cql3.functions.UDFunction.async(UDFunction.java:453) ~[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.functions.UDFunction.executeAsync(UDFunction.java:398)
~[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.functions.UDFunction.execute(UDFunction.java:298) ~[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.selection.ScalarFunctionSelector.getOutput(ScalarFunctionSelector.java:61)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.selection.Selection$SelectionWithProcessing$1.getOutputRow(Selection.java:592)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.selection.Selection$ResultSetBuilder.getOutputRow(Selection.java:430)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.selection.Selection$ResultSetBuilder.build(Selection.java:417)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:763)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:400)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:378)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:251)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:79)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:217)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:248) [apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:233) [apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:116)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:517)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:410)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
[netty-all-4.0.44.Final.jar:4.0.44.Final]
>     at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:357)
[netty-all-4.0.44.Final.jar:4.0.44.Final]
>     at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:35)
[netty-all-4.0.44.Final.jar:4.0.44.Final]
>     at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:348)
[netty-all-4.0.44.Final.jar:4.0.44.Final]
>     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:522) [na:1.8.0]
>     at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:162)
[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:109) [apache-cassandra-3.11.0.jar:3.11.0]
>     at java.lang.Thread.run(Thread.java:795) [na:2.9 (09-01-2017)]
> Caused by: java.lang.StackOverflowError: null
>     at java.lang.String.substring(String.java:2637) ~[na:2.9 (09-01-2017)]
>     at java.lang.Class.getNonArrayClassPackageName(Class.java:1531) ~[na:2.9 (09-01-2017)]
>     at java.lang.Class.getPackageName(Class.java:1546) ~[na:2.9 (09-01-2017)]
>     at java.lang.J9VMInternals$2.run(J9VMInternals.java:252) ~[na:2.9 (09-01-2017)]
>     at java.security.AccessController.doPrivileged(AccessController.java:647) ~[na:1.8.0]
>     at java.lang.J9VMInternals.checkPackageAccess(J9VMInternals.java:250) ~[na:2.9 (09-01-2017)]
>     at org.apache.cassandra.cql3.functions.ThreadAwareSecurityManager.isSecuredThread(ThreadAwareSecurityManager.java:210)
~[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.functions.ThreadAwareSecurityManager.checkPackageAccess(ThreadAwareSecurityManager.java:259)
~[apache-cassandra-3.11.0.jar:3.11.0]
>     at java.lang.J9VMInternals$2.run(J9VMInternals.java:254) ~[na:2.9 (09-01-2017)]
>     at java.security.AccessController.doPrivileged(AccessController.java:647) ~[na:1.8.0]
>     at java.lang.J9VMInternals.checkPackageAccess(J9VMInternals.java:250) ~[na:2.9 (09-01-2017)]
>     at org.apache.cassandra.cql3.functions.ThreadAwareSecurityManager.isSecuredThread(ThreadAwareSecurityManager.java:210)
~[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.cql3.functions.ThreadAwareSecurityManager.checkPackageAccess(ThreadAwareSecurityManager.java:259)
~[apache-cassandra-3.11.0.jar:3.11.0]
>     [previous 5 lines repeated many times]
>     at java.lang.J9VMInternals$2.run(J9VMInternals.java:254) ~[na:2.9 (09-01-2017)]
>     at java.security.AccessController.doPrivileged(AccessController.java:647) ~[na:1.8.0]
>     at java.lang.J9VMInternals.checkPackageAccess(J9VMInternals.java:250) ~[na:2.9 (09-01-2017)]
>     at org.apache.cassandra.cql3.functions.UDFunction$$Lambda$277.00000000154A7350.call(Unknown
Source) ~[na:na]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:277) ~[na:1.8.0]
>     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
~[na:1.8.0]
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
~[na:1.8.0]
>     at org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator$0(NamedThreadFactory.java:81)
~[apache-cassandra-3.11.0.jar:3.11.0]
>     at org.apache.cassandra.concurrent.NamedThreadFactory$$Lambda$12.0000000013A22FB0.run(Unknown
Source) ~[na:na]
>     ... 1 common frames omitted



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message