Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D13FF10CC9 for ; Thu, 6 Mar 2014 11:05:00 +0000 (UTC) Received: (qmail 74315 invoked by uid 500); 6 Mar 2014 11:05:00 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 73126 invoked by uid 500); 6 Mar 2014 11:04:56 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 72526 invoked by uid 99); 6 Mar 2014 11:04:53 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Mar 2014 11:04:53 +0000 Date: Thu, 6 Mar 2014 11:04:53 +0000 (UTC) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DERBY-6496) Optional tool registration may fail because the CompilerContext is not always available at execution time. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-6496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13922313#comment-13922313 ] Knut Anders Hatlen commented on DERBY-6496: ------------------------------------------- I disabled the optimization in my sandbox, so that popCompilerContext() always removed the context from the stack, and ran the full regression test suite to see if we try to access the compiler context at execution time any other places in the code. There was one failure in OptionalToolsTest.test_04_customOptimizerTrace() which suggests that we need a similar fix in OptimizerTracer.loadTool(). I was able to reproduce that problem with a clean trunk as well: {noformat} ij version 10.11 ij> connect 'jdbc:derby:memory:db;create=true'; ij> call syscs_util.syscs_register_tool('optimizerTracing', true, 'custom', 'org.apache.derbyTesting.functionTests.tests.lang.DummyOptTrace'); 0 rows inserted/updated/deleted ij> call syscs_util.syscs_register_tool('optimizerTracing', false); 0 rows inserted/updated/deleted ij> connect 'jdbc:derby:memory:db'; ij(CONNECTION1)> call syscs_util.syscs_register_tool('optimizerTracing', true, 'custom', 'org.apache.derbyTesting.functionTests.tests.lang.DummyOptTrace'); ERROR 38000: The exception 'java.sql.SQLException' was thrown while evaluating an expression. ERROR (no SQLState): (no message) {noformat} derby.log tells that the root cause is a NullPointerException in OptimizerTracer.loadTool(): {noformat} java.lang.NullPointerException at org.apache.derby.impl.sql.compile.OptimizerTracer.loadTool(OptimizerTracer.java:111) at org.apache.derby.catalog.Java5SystemProcedures.SYSCS_REGISTER_TOOL(Java5SystemProcedures.java:116) at org.apache.derby.exe.ac4d3680a5x0144x970cx763cx00000d4d4fe50.g0(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.derby.impl.services.reflect.ReflectMethod.invoke(ReflectMethod.java:46) at org.apache.derby.impl.sql.execute.CallStatementResultSet.open(CallStatementResultSet.java:75) at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:470) at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:349) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1337) at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:704) at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:631) at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:367) at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:527) at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:369) at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:245) at org.apache.derby.impl.tools.ij.Main.go(Main.java:229) at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184) at org.apache.derby.impl.tools.ij.Main.main(Main.java:75) at org.apache.derby.tools.ij.main(ij.java:59) {noformat} > Optional tool registration may fail because the CompilerContext is not always available at execution time. > ---------------------------------------------------------------------------------------------------------- > > Key: DERBY-6496 > URL: https://issues.apache.org/jira/browse/DERBY-6496 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.11.0.0 > Reporter: Rick Hillegas > Assignee: Rick Hillegas > Attachments: derby-6496-01-aa-useClassFactoryContext.diff, derby-6496-01-ab-useClassFactoryContext.diff > > > For reasons which elude me, the CompilerContext is sometimes available at execution time and sometimes not. When the CompilerContext is not available at execution time, optional tool loading fails on an NPE: > Caused by: java.lang.NullPointerException > at org.apache.derby.catalog.Java5SystemProcedures.SYSCS_REGISTER_TOOL(Java5SystemProcedures.java:104) > at org.apache.derby.exe.ac4d3680a5x0144x93adx0136xffffe1d7aa3e0.g0(Unknown Source) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at org.apache.derby.impl.services.reflect.ReflectMethod.invoke(ReflectMethod.java:46) > at org.apache.derby.impl.sql.execute.CallStatementResultSet.open(CallStatementResultSet.java:75) > at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:470) > at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:349) > at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1338) -- This message was sent by Atlassian JIRA (v6.2#6252)