Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 225DB200BBC for ; Sun, 13 Nov 2016 12:39:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 15ED6160AF8; Sun, 13 Nov 2016 11:39:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5E1CE160AF2 for ; Sun, 13 Nov 2016 12:39:00 +0100 (CET) Received: (qmail 87498 invoked by uid 500); 13 Nov 2016 11:38:59 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 87486 invoked by uid 99); 13 Nov 2016 11:38:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Nov 2016 11:38:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 2B6C22C4C70 for ; Sun, 13 Nov 2016 11:38:59 +0000 (UTC) Date: Sun, 13 Nov 2016 11:38:59 +0000 (UTC) From: "Robert Stupp (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CASSANDRA-12535) Prevent reloading of logback.xml from UDF sandbox MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 13 Nov 2016 11:39:01 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-12535?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robert Stupp updated CASSANDRA-12535: ------------------------------------- Summary: Prevent reloading of logback.xml from UDF sandbox (was: Occasionally seeing AccessControlException, CodecNotFoundException when executing a User Defined Aggregate) > Prevent reloading of logback.xml from UDF sandbox > ------------------------------------------------- > > Key: CASSANDRA-12535 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12535 > Project: Cassandra > Issue Type: Bug > Environment: Cassandra 3.7 (via brew install), Mac OS X 10.11.6 > Reporter: Pat Patterson > Assignee: Robert Stupp > Priority: Minor > Fix For: 3.0.x, 3.x > > > I have defined a UDA to implement standard deviation: > {noformat} > cqlsh:mykeyspace> CREATE OR REPLACE FUNCTION sdState ( state tuple, val double ) CALLED ON NULL INPUT RETURNS tuple LANGUAGE java AS > ... 'int n = state.getInt(0); double mean = state.getDouble(1); double m2 = state.getDouble(2); n++; double delta = val - mean; mean += delta / n; m2 += delta * (val - mean); state.setInt(0, n); state.setDouble(1, mean); state.setDouble(2, m2); return state;'; > cqlsh:mykeyspace> CREATE OR REPLACE FUNCTION sdFinal ( state tuple ) CALLED ON NULL INPUT RETURNS double LANGUAGE java AS > ... 'int n = state.getInt(0); double m2 = state.getDouble(2); if (n < 1) { return null; } return Math.sqrt(m2 / (n - 1));'; > cqlsh:mykeyspace> CREATE AGGREGATE IF NOT EXISTS stdev ( double ) > ... SFUNC sdState STYPE tuple FINALFUNC sdFinal INITCOND (0,0,0); > {noformat} > My table: > {noformat} > CREATE TABLE readings ( > sensor_id int, > time timestamp, > temperature double, > status text, > PRIMARY KEY (sensor_id, time) > ) WITH CLUSTERING ORDER BY (time ASC); > {noformat} > I'm inserting a row every 0.1 seconds. The data looks like this: > {noformat} > cqlsh:mykeyspace> select * from readings limit 10; > sensor_id | time | status | temperature > -----------+---------------------------------+--------+------------- > 5 | 2016-08-24 19:11:34.896000+0000 | OK | 9.97 > 5 | 2016-08-24 19:11:43.933000+0000 | OK | 10.28 > 5 | 2016-08-24 19:11:49.958000+0000 | OK | 7.65 > 5 | 2016-08-24 19:11:51.968000+0000 | OK | 10.11 > 5 | 2016-08-24 19:12:58.512000+0000 | Fault | 10.41 > 5 | 2016-08-24 19:13:04.542000+0000 | OK | 9.66 > 5 | 2016-08-24 19:13:16.593000+0000 | OK | 10.9 > 5 | 2016-08-24 19:13:37.692000+0000 | OK | 11.2 > 5 | 2016-08-24 19:13:46.738000+0000 | OK | 10.34 > 5 | 2016-08-24 19:13:49.757000+0000 | OK | 10.6 > {noformat} > I'm running a query every few seconds with my UDA - like this (timestamps are different each time): > {noformat} > select avg(temperature), stdev(temperature) from readings where sensor_id = 1 and time > 1472066523193; > {noformat} > Most of the time, this works just fine: > {noformat} > cqlsh:mykeyspace> select avg(temperature), stdev(temperature) from readings where sensor_id = 1 and time > 1472066523193; > system.avg(temperature) | mykeyspace.stdev(temperature) > -------------------------+------------------------------- > 9.9291 | 0.94179 > (1 rows) > {noformat} > But, occasionally, it fails with one of two exceptions: > {noformat} > cqlsh:mykeyspace> select avg(temperature), stdev(temperature) from readings where sensor_id = 1 and time > 1472066523193; > Traceback (most recent call last): > File "/usr/local/Cellar/cassandra/3.7/libexec/bin/cqlsh.py", line 1277, in perform_simple_statement > result = future.result() > File "cassandra/cluster.py", line 3629, in cassandra.cluster.ResponseFuture.result (cassandra/cluster.c:69369) > raise self._final_exception > FunctionFailure: Error from server: code=1400 [User Defined Function failure] message="execution of 'mykeyspace.sdstate[frozen>, double]' failed: java.security.AccessControlException: access denied ("java.io.FilePermission" "/usr/local/etc/cassandra/logback.xml" "read")" > {noformat} > or > {noformat} > cqlsh:mykeyspace> select count(*), avg(temperature), stdev(temperature) from readings where sensor_id = 1 and time > '2016-08-24 15:00:00.000+0000'; > Traceback (most recent call last): > File "/usr/local/Cellar/cassandra/3.7/libexec/bin/cqlsh.py", line 1277, in perform_simple_statement > result = future.result() > File "cassandra/cluster.py", line 3629, in cassandra.cluster.ResponseFuture.result (cassandra/cluster.c:69369) > raise self._final_exception > FunctionFailure: Error from server: code=1400 [User Defined Function failure] message="execution of 'mykeyspace.sdstate[frozen>, double]' failed: com.datastax.driver.core.exceptions.CodecNotFoundException" > {noformat} > The next query usually works ok. > I don't see any clues in /usr/local/var/log/cassandra/system.log > If I can pin it down more, I'll post follow-up comments. -- This message was sent by Atlassian JIRA (v6.3.4#6332)