This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-16. For the latest, interactive version please visit https://mariadb.com/kb/.

MariaDB connector bug with bulk insert ?

I'm new to MariaDB and testing with some applications. Yesterday I met a wired bug. When I using bulk insert with MariaDB connector 1.3.4, following errors occur. (Ubuntu 14.4 and MariaDB 10.1.11)

When I replace the connector driver with 'MySQL connector', It works fine. The reference Q&A was http://stackoverflow.com/questions/18693800/mariadb-jdbc-connection-fails-during-bulk-inserts

The reason that I call this bug is wired was, with same mariadb connector I haven't met bug in any other systems, Mac/Centos 6. Even more another ubuntu system MariaDB 10.1.10 with same driver, no error occurs.

works fine: Linux ubuntu 3.13.0-34-generic #60-Ubuntu SMP Wed Aug 13 15:45:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Error occurred system: No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS Release: 14.04 Codename: trusty Linux Yukino 3.16.0-57-generic #7714.04.1-Ubuntu SMP Thu Dec 17 23:20:00 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux java version "1.8.0_66" Java(TM) SE Runtime Environment (build 1.8.0_66-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

Error message:

Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: Could not send query: Last stream not finished

-------

java.lang.NullPointerException at java.lang.String.getBytes(String.java:917) at org.mariadb.jdbc.internal.stream.PacketOutputStream.sendStream(PacketOutputStream.java:178) at org.mariadb.jdbc.internal.packet.dao.parameters.ReaderParameter.writeBinary(ReaderParameter.java:134) at org.mariadb.jdbc.internal.packet.send.SendPrepareParameterPacket.send(SendPrepareParameterPacket.java:93) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executePreparedQuery(AbstractQueryProtocol.java:568) at org.mariadb.jdbc.MariaDbServerPreparedStatement.executeBatch(MariaDbServerPreparedStatement.java:230) at com.jolbox.bonecp.StatementHandle.executeBatch(StatementHandle.java:424) at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:1005) at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:989) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:673) at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:989) at data.DefaultExchanger.batchUpdate(DefaultExchanger.java:319) at data.DefaultExchanger.importDataFromArray(DefaultExchanger.java:307) at data.DefaultExchanger.importData(DefaultExchanger.java:255) at data.DataService.importData(DataService.java:196) at controllers.SiteApp.importData(SiteApp.java:314) at Routes$$anonfun$routes$1$$anonfun$applyOrElse$54$$anonfun$apply$54.apply(routes_routing.scala:2058) at Routes$$anonfun$routes$1$$anonfun$applyOrElse$54$$anonfun$apply$54.apply(routes_routing.scala:2058) at play.core.Router$HandlerInvokerFactory$$anon$4.resultCall(Router.scala:264) at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.invocation(Router.scala:255) at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:55) at Global$1.call(Global.java:190) at actions.AnonymousCheckAction.call(AnonymousCheckAction.java:57) at utils.SiteManagerAuthAction.call(SiteManagerAuthAction.java:39) at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82) at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82) at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:40) at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:46) at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:32) at scala.concurrent.impl.Future$.apply(Future.scala:31) at scala.concurrent.Future$.apply(Future.scala:485) at play.core.j.JavaAction$class.apply(JavaAction.scala:82) at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.apply(Router.scala:252) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) at play.utils.Threads$.withContextClassLoader(Threads.scala:21) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:128) at scala.Option.map(Option.scala:145) at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:128) at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:121) at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483) at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483) at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519) at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519) at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496) at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496) at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) org.springframework.transaction.TransactionSystemException: Could not roll back JDBC transaction; nested exception is java.sql.SQLNonTransientConnectionException: Could not send query: Last stream not finished at org.springframework.jdbc.datasource.DataSourceTransactionManager.doRollback(DataSourceTransactionManager.java:290) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:849) at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:826) at data.DefaultExchanger.importData(DefaultExchanger.java:266) at data.DataService.importData(DataService.java:196) at controllers.SiteApp.importData(SiteApp.java:314) at Routes$$anonfun$routes$1$$anonfun$applyOrElse$54$$anonfun$apply$54.apply(routes_routing.scala:2058) at Routes$$anonfun$routes$1$$anonfun$applyOrElse$54$$anonfun$apply$54.apply(routes_routing.scala:2058) at play.core.Router$HandlerInvokerFactory$$anon$4.resultCall(Router.scala:264) at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.invocation(Router.scala:255) at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:55) at Global$1.call(Global.java:190) at actions.AnonymousCheckAction.call(AnonymousCheckAction.java:57) at utils.SiteManagerAuthAction.call(SiteManagerAuthAction.java:39) at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82) at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82) at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:40) at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:46) at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:32) at scala.concurrent.impl.Future$.apply(Future.scala:31) at scala.concurrent.Future$.apply(Future.scala:485) at play.core.j.JavaAction$class.apply(JavaAction.scala:82) at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.apply(Router.scala:252) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) at play.utils.Threads$.withContextClassLoader(Threads.scala:21) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:128) at scala.Option.map(Option.scala:145) at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:128) at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:121) at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483) at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483) at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519) at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519) at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496) at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496) at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) Caused by: java.sql.SQLNonTransientConnectionException: Could not send query: Last stream not finished at org.mariadb.jdbc.internal.util.ExceptionMapper.get(ExceptionMapper.java:123) at org.mariadb.jdbc.internal.util.ExceptionMapper.throwException(ExceptionMapper.java:69) at org.mariadb.jdbc.MariaDbStatement.executeQueryEpilog(MariaDbStatement.java:261) at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:290) at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:344) at org.mariadb.jdbc.MariaDbConnection.rollback(MariaDbConnection.java:532) at com.jolbox.bonecp.ConnectionHandle.rollback(ConnectionHandle.java:1272) at org.springframework.jdbc.datasource.DataSourceTransactionManager.doRollback(DataSourceTransactionManager.java:287) ... 46 more Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: Could not send query: Last stream not finished at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.sendQuery(AbstractQueryProtocol.java:390) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:377) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:334) at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:280) ... 50 more Caused by: java.io.IOException: Last stream not finished at org.mariadb.jdbc.internal.stream.PacketOutputStream.startPacket(PacketOutputStream.java:65) at org.mariadb.jdbc.internal.stream.PacketOutputStream.startPacket(PacketOutputStream.java:78) at org.mariadb.jdbc.internal.packet.send.SendTextQueryPacket.send(SendTextQueryPacket.java:101) at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.sendQuery(AbstractQueryProtocol.java:383) ... 53 more

Answer Answered by Ian Gilfillan in this comment.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.