[
https://issues.apache.org/jira/browse/CALCITE-687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14735915#comment-14735915
]
Josh Elser commented on CALCITE-687:
------------------------------------
I am a little perplexed -- I've been seeing an error, often like:
{noformat}
java.sql.SQLException: error while executing SQL "create table TEST_TABLE(id
int not null, msg varchar(3) not null)": java.sql.SQLSyntaxErrorException:
object name already exists: TEST_TABLE in statement [create table TEST_TABLE(id
int not null, msg varchar(3) not null)]
at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
at
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:112)
at
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:130)
at
org.apache.calcite.avatica.RemoteDriverTest.testCreateInsertUpdateDrop(RemoteDriverTest.java:465)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:370)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: object
name already exists: TEST_TABLE in statement [create table TEST_TABLE(id int
not null, msg varchar(3) not null)]
at org.apache.calcite.avatica.jdbc.JdbcMeta.propagate(JdbcMeta.java:704)
at
org.apache.calcite.avatica.jdbc.JdbcMeta.prepareAndExecute(JdbcMeta.java:762)
at org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:141)
at
org.apache.calcite.avatica.remote.Service$PrepareAndExecuteRequest.accept(Service.java:806)
at
org.apache.calcite.avatica.remote.Service$PrepareAndExecuteRequest.accept(Service.java:1)
at
org.apache.calcite.avatica.remote.LocalJsonService.apply(LocalJsonService.java:36)
at
org.apache.calcite.avatica.RemoteDriverTest$LoggingLocalJsonService.apply(RemoteDriverTest.java:1074)
at org.apache.calcite.avatica.remote.JsonService.apply(JsonService.java:121)
at
org.apache.calcite.avatica.remote.RemoteMeta.prepareAndExecute(RemoteMeta.java:175)
at
org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:477)
at
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:110)
... 24 more
Caused by: java.sql.SQLSyntaxErrorException: object name already exists:
TEST_TABLE in statement [create table TEST_TABLE(id int not null, msg
varchar(3) not null)]
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)
at
org.apache.calcite.avatica.jdbc.JdbcMeta.prepareAndExecute(JdbcMeta.java:742)
... 33 more
Caused by: org.hsqldb.HsqlException: object name already exists: TEST_TABLE
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.SchemaObjectSet.checkAdd(Unknown Source)
at org.hsqldb.SchemaManager.checkSchemaObjectNotExists(Unknown Source)
at org.hsqldb.StatementSchema.setOrCheckObjectName(Unknown Source)
at org.hsqldb.StatementSchema.getResult(Unknown Source)
at org.hsqldb.StatementSchema.execute(Unknown Source)
at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
at org.hsqldb.Session.executeDirectStatement(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 36 more
{noformat}
The curious thing to me is that it doesn't look like there were any overlapping
executions by surefire (not a thread-safe problem), but it certainly acts like
it only failing occasionally. I have to assume it's something in Avatica, but
I'm confused how after apparently we drop the table and it still exists when
we're essentially just wrapping the hsqldb driver. Will dig more, but hints are
welcome.
> Make RemoteDriverTest thread-safe
> ---------------------------------
>
> Key: CALCITE-687
> URL: https://issues.apache.org/jira/browse/CALCITE-687
> Project: Calcite
> Issue Type: Bug
> Components: avatica
> Reporter: Julian Hyde
> Assignee: Nick Dimiduk
> Fix For: next
>
>
> There is apparently a thread safety issue in
> RemoteDriverTest.testStatementLifecycle. Here is output from <a
> href="https://travis-ci.org/julianhyde/incubator-calcite/jobs/58869949">Travis</a>:{code}ests
> run: 18, Failures: 1, Errors: 0, Skipped: 4, Time elapsed: 29.008 sec <<<
> FAILURE! - in org.apache.calcite.avatica.RemoteDriverTest
> testStatementLifecycle(org.apache.calcite.avatica.RemoteDriverTest) Time
> elapsed: 1.807 sec <<< FAILURE!
> java.lang.AssertionError: expected:<1> but was:<9>
> at org.junit.Assert.fail(Assert.java:88)
> at org.junit.Assert.failNotEquals(Assert.java:743)
> at org.junit.Assert.assertEquals(Assert.java:118)
> at org.junit.Assert.assertEquals(Assert.java:555)
> at org.junit.Assert.assertEquals(Assert.java:542)
> at
> org.apache.calcite.avatica.RemoteDriverTest.testStatementLifecycle(RemoteDriverTest.java:388)
> {code} Presumably this occurs in Travis because several tests are running
> concurrently.
> I have disabled the test. We must fix this issue and re-enable the test.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)