db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A B (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-388) Intermittent failures when executing UPDATE trigger statements
Date Thu, 23 Jun 2005 08:12:16 GMT
     [ http://issues.apache.org/jira/browse/DERBY-388?page=all ]

A B updated DERBY-388:
----------------------

    Attachment: go.java

Attaching a sample program to reproduce the behavior described in this bug.  Note that  while
this particular repro is contrived, this problem CAN show up in a normal application environment
as a result of the fact that Derby sometimes chooses to recompile triggers automatically.
 If it does so while a trigger is firing, the result will be the same as what is witnessed
by this program.

The "intermittent" nature of the bug as first reported was because Derby didn't always choose
to recompile the trigger statements, and hence the problem didn't always occur.  I'm not sure
how Derby goes about deciding when to automatically recompile the trigger, but in any event,
I've written the repro to be more consistent: it forces a table alteration while running,
which makes it mandatory for the trigger to be recompiled, and thus the problem is more easily
reproduced.

I think I have a patch for this problem, but would like to run derbyall (tonight) before posting.

> Intermittent failures when executing UPDATE trigger statements
> --------------------------------------------------------------
>
>          Key: DERBY-388
>          URL: http://issues.apache.org/jira/browse/DERBY-388
>      Project: Derby
>         Type: Bug
>     Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0
>     Reporter: A B
>     Assignee: A B
>      Fix For: 10.0.2.2
>  Attachments: go.java
>
> If I define an UPDATE trigger and then I repeatedly perform a table update that fires
the trigger over many rows, I occasionally see intermittent failures of two kinds: 1) a null
pointer exception, and/or 2) a syntax error.
> The NPE stack trace is this:
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.makeValid(GenericPreparedStatement.java:808)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.rePrepare(GenericPreparedStatement.java:229)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:342)
> 	at org.apache.derby.impl.sql.execute.GenericTriggerExecutor.executeSPS(GenericTriggerExecutor.java:166)
> 	at org.apache.derby.impl.sql.execute.RowTriggerExecutor.fireTrigger(RowTriggerExecutor.java:108)
> 	at org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(TriggerEventActivator.java:296)
> 	at org.apache.derby.impl.sql.execute.UpdateResultSet.fireAfterTriggers(UpdateResultSet.java:824)
> 	at org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:292)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1271)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:259)
> The syntax error stack trace is this:
> ERROR 42X01: Syntax error: org.apache.derby.iapi.db.Factory::getTriggerExecutionContext.
> 	at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:311)
> 	at org.apache.derby.impl.sql.compile.MethodCallNode.resolveMethodCall(MethodCallNode.java:666)
> 	at org.apache.derby.impl.sql.compile.StaticMethodCallNode.bindExpression(StaticMethodCallNode.java:455)
> 	at org.apache.derby.impl.sql.compile.NonStaticMethodCallNode.bindExpression(NonStaticMethodCallNode.java:170)
> 	at org.apache.derby.impl.sql.compile.NonStaticMethodCallNode.bindExpression(NonStaticMethodCallNode.java:170)
> 	at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.bindExpression(JavaToSQLValueNode.java:250)
> 	at org.apache.derby.impl.sql.compile.CastNode.bindExpression(CastNode.java:224)
> 	at
> [snip]
> org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions(DMLStatementNode.java:247)
> 	at org.apache.derby.impl.sql.compile.UpdateNode.bind(UpdateNode.java:507)
> 	at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:332)
> 	at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:107)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.makeValid(GenericPreparedStatement.java:811)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.rePrepare(GenericPreparedStatement.java:229)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:342)
> 	at org.apache.derby.impl.sql.execute.GenericTriggerExecutor.executeSPS(GenericTriggerExecutor.java:166)
> 	at org.apache.derby.impl.sql.execute.RowTriggerExecutor.fireTrigger(RowTriggerExecutor.java:108)
> 	at org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(TriggerEventActivator.java:296)
> 	at org.apache.derby.impl.sql.execute.UpdateResultSet.fireAfterTriggers(UpdateResultSet.java:824)
> 	at org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:292)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1271)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:259)
> In both cases, it looks like the error happens when Derby decides (internally) to recompile
the trigger-action statement in the middle of trigger processing--depending on the state of
the underlying Statement object that performs the trigger action, the result will be an NPE
or a syntax error.
> I'm working on writing up a simplified reproduction and will post soon...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message