Losing prepare statements in Postgres when committing lists.

1
Major issue, when committing a list inside a loop, I receive error. Did someone did see this before? ERROR: prepared statement "S_26" does not exist I have trouble creating a good test case... First looping/batch is is working nicely, but second time in the loop, it throws an error: com.mendix.modules.microflowengine.MicroflowException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.connectionbus.ConnectionBusException: Exception occurred while inserting data. (SQL State: 26000, Error Code: 0) Detail Message: org.postgresql.util.PSQLException: ERROR: prepared statement "S_26" does not exist at eBackoffice.SUB_ProcessPersons (Commit : 'Commit 'PersonList' ') at eBackoffice.SUB_UpdatePersons (SubMicroflow : 'SUB_ProcessPersons') at eBackoffice.SCE_UpdateCobra (SubMicroflow : 'SUB_UpdatePersons') Advanced stacktrace: at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:143) Caused by: com.mendix.core.CoreRuntimeException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.connectionbus.ConnectionBusException: Exception occurred while inserting data. (SQL State: 26000, Error Code: 0) Detail Message: org.postgresql.util.PSQLException: ERROR: prepared statement "S_26" does not exist at com.mendix.core.actionmanagement.ActionManager.executeInTransactionSync(ActionManager.java:143) Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.connectionbus.ConnectionBusException: Exception occurred while inserting data. (SQL State: 26000, Error Code: 0) Detail Message: org.postgresql.util.PSQLException: ERROR: prepared statement "S_26" does not exist at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:178) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.connectionbus.ConnectionBusException: Exception occurred while inserting data. (SQL State: 26000, Error Code: 0) Detail Message: org.postgresql.util.PSQLException: ERROR: prepared statement "S_26" does not exist at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36) Caused by: com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.connectionbus.ConnectionBusException: Exception occurred while inserting data. (SQL State: 26000, Error Code: 0) Detail Message: org.postgresql.util.PSQLException: ERROR: prepared statement "S_26" does not exist at com.mendix.core.actionmanagement.SyncEventExtendedAction.executeAction(SyncEventExtendedAction.java:39) Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.connectionbus.ConnectionBusException: Exception occurred while inserting data. (SQL State: 26000, Error Code: 0) Detail Message: org.postgresql.util.PSQLException: ERROR: prepared statement "S_26" does not exist at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:178) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.connectionbus.ConnectionBusException: Exception occurred while inserting data. (SQL State: 26000, Error Code: 0) Detail Message: org.postgresql.util.PSQLException: ERROR: prepared statement "S_26" does not exist at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36) Caused by: com.mendix.systemwideinterfaces.connectionbus.ConnectionBusException: Exception occurred while inserting data. (SQL State: 26000, Error Code: 0) Detail Message: org.postgresql.util.PSQLException: ERROR: prepared statement "S_26" does not exist at com.mendix.connectionbus.connections.jdbc.JDBCDataStore.getCorrectException(JDBCDataStore.java:1203) Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO "ebackoffice$person" ("id", "personnumber", "dateofbirth", "anniversarydate", "iscurrentemployee", "lastname", "organizationid", "gender", "initials", "prefixes", "lastnameformat", "genderenum", "anniversarydatedatetime", "names", "dateofbirthdatetime", "personid", "citizenservicenumber", "nickname") VALUES (726205439358799, 302016, NULL, '2008-06-01T00:00:00+02:00', '1', 'Willians', '35aee12d-dadf-4a5d-a99f-e814799f7c', 1, 'M.', 'van', 1, 'Man', '2008-5-31 22:0:0.000000 +0:0:0', 'Jhon', '1970-1-1 22:0:0.000000 +0:0:0', '51b1242f-d56c-405-9659-20fb889e8a52', '1797888644', 'Mick') was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2778) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1912) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:338) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2959) at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345) at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:345) at com.mendix.connectionbus.connections.jdbc.JDBCDataStore.execCreateQueries(JDBCDataStore.java:576) at com.mendix.connectionbus.connections.jdbc.JDBCDataStore.execCreateQueries(JDBCDataStore.java:522) at com.mendix.connectionbus.connections.jdbc.JDBCDataStore.store(JDBCDataStore.java:482) at com.mendix.connectionbus.store.EntityStorer.storeDataSetInstance(EntityStorer.java:246) at com.mendix.connectionbus.store.EntityStorer.handleCreateRequest(EntityStorer.java:200) at com.mendix.connectionbus.store.EntityStorer.handleRequest(EntityStorer.java:139) at com.mendix.connectionbus.store.EntityStorer.store(EntityStorer.java:69) at com.mendix.connectionbus.RequestAnalyzer.doRequest(RequestAnalyzer.java:82) at com.mendix.connectionbus.ConnectionBusImpl.doRequest(ConnectionBusImpl.java:414) at com.mendix.core.action.user.CommitAction.commit(CommitAction.scala:67) at com.mendix.core.action.user.CommitAction.commitPersistableObjects(CommitAction.scala:57) at com.mendix.core.action.user.CommitAction.executeAction(CommitAction.scala:39) at com.mendix.core.action.user.CommitAction.executeAction(CommitAction.scala:23) at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49) at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248) at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32) at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:174) at com.mendix.core.actionmanagement.SyncEventExtendedAction.executeAction(SyncEventExtendedAction.java:37) at com.mendix.core.actionmanagement.EventExtendedAction.execute(EventExtendedAction.java:92) at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248) at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:171) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32) at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:174) at com.mendix.core.actionmanagement.ActionManager.executeInTransactionSync(ActionManager.java:136) at com.mendix.core.component.InternalCore.commit(InternalCore.java:171) at com.mendix.core.component.InternalCore.commit(InternalCore.java:137) at com.mendix.modules.microflowengine.actions.mxobject.CommitAction.execute(CommitAction.scala:34) at com.mendix.modules.microflowengine.actions.mxobject.CommitAction.execute(CommitAction.scala:19) at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149) at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49) at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248) at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32) at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:174) at com.mendix.core.component.InternalCore.executeSync(InternalCore.java:459) at com.mendix.modules.microflowengine.actions.SubMicroflowAction.execute(SubMicroflowAction.scala:43) at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149) at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49) at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248) at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32) at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:174) at com.mendix.core.component.InternalCore.executeSync(InternalCore.java:459) at com.mendix.modules.microflowengine.actions.SubMicroflowAction.execute(SubMicroflowAction.scala:43) at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149) at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49) at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248) at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32) at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:174) at com.mendix.core.component.InternalCore.execute(InternalCore.java:377) at com.mendix.webui.actions.client.ExecuteAction.execute(ExecuteAction.java:135) at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply$mcV$sp(ClientRequestHandler.scala:324) at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:317) at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:317) at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2$$anon$1.execute(ActionDispatching.scala:144) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32) at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2.apply(ActionDispatching.scala:146) at scala.util.Try$.apply(Try.scala:192) at com.mendix.core.session.Worker$$anonfun$receive$3.applyOrElse(ActionDispatching.scala:140) at akka.actor.Actor$class.aroundReceive(Actor.scala:465) at com.mendix.core.session.Worker.aroundReceive(ActionDispatching.scala:136) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) at akka.actor.ActorCell.invoke(ActorCell.scala:487) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238) at akka.dispatch.Mailbox.run(Mailbox.scala:220) 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)
asked
3 answers
3

Based on this forum post and a ticket that was filed we have been investigating this and it turns out to be a bug in the underlying (official) PostgreSQL JDBC Java library used by Mendix. This library was updated in Mendix 6.3.1 to version 1206. And this issue has been fixed in the library in version 1207 (latest version: 1208).

We are currently looking into the best way to resolve this issue going forward.

answered
2

The release notes of 6.4.1 shows that there is an update for this issue:

https://world.mendix.com/display/ReleaseNotes/6.4.1

answered
1

I don't recognize the error, but can you commit outside the loop? You could add a list parameter to your microflow and add the items to the list. Then commit at the highest level. Note that committing in Mendix does not mean that the data is written to the database. That is done only after the topmost microflow finishes normally. (Unless you have custom error handling...)

answered