[bug-355]GatewayException: Unable to decode arguments

It fails due to the datetime. This work in earlier versions for years but when i upgraded to the newest version this no longer works. If I take the StartDate out the query writes to the DB fine. I have tried converting to string, framing with % , ‘, ", and using CAST(N’.

Here is the query:

system.db.runPrepUpdate(INSERT INTO tblResourceEvents (ItemID, StartDate, Label, Foreground, Background, PctDone, EventType) VALUES (?,?,?,?,?,?,?), [1, 2020-10-30 19:59:59.0, 111111 : $??? : MyCust, color(0,0,0,255), color(255,255,255,255), 0, Task], DBEvents, , false, false)

I need to pass the datetime in a query. Anyone have an idea?

Are you passing an actual date object, or some string literal?
If the latter, try parsing into a Java Date object before sending it through the query:
https://docs.inductiveautomation.com/display/DOC80/system.date.parse

Any actual stack trace or the rest of your code would be helpful, also.

that shown is the result after the variables were resolved. I am passing a java date variable in the actual call,

Traceback (most recent call last):
File “event:mouseReleased”, line 53, in
java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(INSERT INTO ResourceEvent (ItemID, StartDate, Label, Foreground, Background, PctDone, EventType) VALUES (?,?,?,?,?,?,?), [1, 2020-10-23 19:59:59.0, 111111 : $??? : MyCustomer, color(0,0,0,255), color(255,255,255,255), 0, Task], MyDB, , false, false)

caused by Exception: Error executing system.db.runPrepUpdate(INSERT INTO ResourceEvent (ItemID, StartDate, Label, Foreground, Background, PctDone, EventType) VALUES (?,?,?,?,?,?,?), [1, 2020-10-23 19:59:59.0, 111111 : $???? : MyCustomer, color(0,0,0,255), color(255,255,255,255), 0, Task], MyDB, , false, false)
caused by GatewayException: Unable to decode arguments
caused by InvalidClassException: failed to read class descriptor

Ignition v8.0.16 (b2020082513)
Java: Azul Systems, Inc. 11.0.7

I have the same issue (v8.0.16)

running this:

db = 'dbname'
job_type = 'formula'
user_name = system.security.getUsername()
user_id = system.user.getUser("", user_name).getId()
job_id = system.db.runPrepUpdate('INSERT INTO jobs (ok_to_start, job_type, user_id) VALUES (?, ?, ?);',[0, job_type, user_id], database=db, getKey=1)
Traceback (most recent call last):
  File "<event:actionPerformed>", line 124, in <module>
java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(INSERT INTO jobs (ok_to_start, job_type, user_id) VALUES (?, ?, ?);, [0, formula, 1], dbname, , true, false)

	caused by Exception: Error executing system.db.runPrepUpdate(INSERT INTO jobs (ok_to_start, job_type, user_id) VALUES (?, ?, ?);, [0, formula, 1], dbname, , true, false)
	caused by GatewayException: Unable to decode arguments
	caused by InvalidClassException: failed to read class descriptor

Ignition v8.0.16 (b2020082513)
Java: Azul Systems, Inc. 11.0.7

Full trace: https://pastebin.com/1W88KZ6b

Ah, the full stack trace is helpful. I have a hunch what’s going on here, I’ll file an internal ticket.

Please share the hunch. i’m running into the same issue in multiple places on a production server since updating to 8.0.16 from 15. I have had to wrap the value 1 in an int() in one place and now have where fifteen parameters that are being passed are failing. If there is a work-around, I’ll take it, otherwise were rolling back.

15:34:39.080 [AWT-EventQueue-0] ERROR Vision.Components.AdvancedTable - Error invoking extension method.
org.python.core.PyException: Traceback (most recent call last):
File “”, line 53, in onCellEdited
File “module:shared.Kanoa.WIP”, line 242, in updateLineProductionData
File “module:shared.Kanoa.WIP”, line 1212, in writeLineProductionInfoToTable
INSERT INTO lineProductionData
(lineType, modeColor, Site, Area, Validated, [Equipment Path], [Equipment Name], [Equipment Mode Name], [Equipment Mode Type], [Work Order], [Product Code], [Mode Begin Time], [Mode End Time], [Mode Duration], [OEE Infeed Count], [Infeed Rate], Target, Units, [Rate Efficiency], [First Quality], [Quality Status], [OEE Outfeed Count], [OEE Reject Count], [Unplanned Downtime], [Line Downtime Occurrence Count])
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
, [Batch, #00FF00, Conway, Resin, true, Chemical\Conway\Resin\Reactor K1, Reactor K1, Production, Production, 0003162586, RPPD2378, Fri Jan 03 15:35:01 PST 2020, Fri Jan 03 23:04:30 PST 2020, 7.491388888888889, , , 6.710000038146973, Hr, 0.8956950306892395, 1.0, Approved, 45001, , , ], IGN_CUSTOM, , true, false)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:258)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(
INSERT INTO lineProductionData
(lineType, modeColor, Site, Area, Validated, [Equipment Path], [Equipment Name], [Equipment Mode Name], [Equipment Mode Type], [Work Order], [Product Code], [Mode Begin Time], [Mode End Time], [Mode Duration], [OEE Infeed Count], [Infeed Rate], Target, Units, [Rate Efficiency], [First Quality], [Quality Status], [OEE Outfeed Count], [OEE Reject Count], [Unplanned Downtime], [Line Downtime Occurrence Count])
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
, [Batch, #00FF00, Conway, Resin, true, Chemical\Conway\Resin\Reactor K1, Reactor K1, Production, Production, 0003162586, RPPD2378, Fri Jan 03 15:35:01 PST 2020, Fri Jan 03 23:04:30 PST 2020, 7.491388888888889, , , 6.710000038146973, Hr, 0.8956950306892395, 1.0, Approved, 45001, , , ], IGN_CUSTOM, , true, false)

at org.python.core.Py.JavaError(Py.java:552)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:258)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:524)
at org.python.core.PyObject.__call__(PyObject.java:413)
at org.python.pycode._pyx284.writeLineProductionInfoToTable$19(<module:shared.Kanoa.WIP>:1223)
at org.python.pycode._pyx284.call_function(<module:shared.Kanoa.WIP>)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:139)
at org.python.core.PyFunction.__call__(PyFunction.java:413)
at org.python.pycode._pyx284.updateLineProductionData$2(<module:shared.Kanoa.WIP>:248)
at org.python.pycode._pyx284.call_function(<module:shared.Kanoa.WIP>)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:171)
at org.python.core.PyFunction.__call__(PyFunction.java:434)
at org.python.pycode._pyx297.onCellEdited$1(<extension-method onCellEdited>:77)
at org.python.pycode._pyx297.call_function(<extension-method onCellEdited>)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyFunction.function___call__(PyFunction.java:471)
at org.python.core.PyFunction.__call__(PyFunction.java:466)
at org.python.core.PyFunction.__call__(PyFunction.java:456)
at org.python.core.PyFunction.__call__(PyFunction.java:451)
at com.inductiveautomation.vision.api.client.components.model.ExtensionFunction.invoke(ExtensionFunction.java:151)
at com.inductiveautomation.factorypmi.application.components.VisionAdvancedTable$Model.setValueAt(VisionAdvancedTable.java:1799)
at com.jidesoft.grid.TableModelWrapperImpl.setValueAt(Unknown Source)
at com.jidesoft.grid.DefaultTableModelWrapper.setValueAt(Unknown Source)
at com.jidesoft.grid.TableModelWrapperImpl.setValueAt(Unknown Source)
at com.jidesoft.grid.DefaultTableModelWrapper.setValueAt(Unknown Source)
at java.desktop/javax.swing.JTable.setValueAt(Unknown Source)
at com.jidesoft.grid.JideTable.editingStopped(Unknown Source)
at java.desktop/javax.swing.AbstractCellEditor.fireEditingStopped(Unknown Source)
at java.desktop/javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(Unknown Source)
at java.desktop/javax.swing.DefaultCellEditor.stopCellEditing(Unknown Source)
at de.javasoft.plaf.synthetica.SyntheticaDefaultTableCellEditor.stopCellEditing(SyntheticaDefaultTableCellEditor.java:123)
at java.desktop/javax.swing.DefaultCellEditor$EditorDelegate.actionPerformed(Unknown Source)
at java.desktop/javax.swing.JTextField.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.JTextField.postActionEvent(Unknown Source)
at java.desktop/javax.swing.JTextField$NotifyAction.actionPerformed(Unknown Source)
at java.desktop/javax.swing.SwingUtilities.notifyAction(Unknown Source)
at java.desktop/javax.swing.JComponent.processKeyBinding(Unknown Source)
at java.desktop/javax.swing.JComponent.processKeyBindings(Unknown Source)
at java.desktop/javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.desktop/java.awt.Component.processEvent(Unknown Source)
at java.desktop/java.awt.Container.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Caused by: java.lang.Exception: Error executing system.db.runPrepUpdate(
INSERT INTO lineProductionData
(lineType, modeColor, Site, Area, Validated, [Equipment Path], [Equipment Name], [Equipment Mode Name], [Equipment Mode Type], [Work Order], [Product Code], [Mode Begin Time], [Mode End Time], [Mode Duration], [OEE Infeed Count], [Infeed Rate], Target, Units, [Rate Efficiency], [First Quality], [Quality Status], [OEE Outfeed Count], [OEE Reject Count], [Unplanned Downtime], [Line Downtime Occurrence Count])
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
, [Batch, #00FF00, Conway, Resin, true, Chemical\Conway\Resin\Reactor K1, Reactor K1, Production, Production, 0003162586, RPPD2378, Fri Jan 03 15:35:01 PST 2020, Fri Jan 03 23:04:30 PST 2020, 7.491388888888889, , , 6.710000038146973, Hr, 0.8956950306892395, 1.0, Approved, 45001, , , ], IGN_CUSTOM, , true, false)
… 78 common frames omitted
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Unable to decode arguments
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:351)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:325)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:278)
at com.inductiveautomation.ignition.client.script.ClientDBUtilities._runPrepStmt(ClientDBUtilities.java:282)
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:256)
… 76 common frames omitted
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayResponse$GatewayThrowable: failed to read class descriptor
at java.io.ObjectInputStream.readNonProxyDesc(null)
at java.io.ObjectInputStream.readClassDesc(null)
at java.io.ObjectInputStream.readOrdinaryObject(null)
at java.io.ObjectInputStream.readObject0(null)
at java.io.ObjectInputStream.readArray(null)
at java.io.ObjectInputStream.readObject0(null)
at java.io.ObjectInputStream.readObject(null)
at java.io.ObjectInputStream.readObject(null)
at com.inductiveautomation.ignition.common.Base64.decodeToObjectFragile(Base64.java:985)
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.RunPrepStmt.runUpdateQuery(RunPrepStmt.java:43)
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.AbstractUpdateQuery.run(AbstractUpdateQuery.java:25)
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.AbstractDBAction.invoke(AbstractDBAction.java:68)
at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:86)
at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1391)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:760)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:547)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1607)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1577)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:500)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
at java.lang.Thread.run(null)

The hunch is that a security measure we put in to prevent a class of Java vulnerabilities (serialization/deserialization, specifically) has too strict of a whitelist, and is preventing legitimate classes from being sent from the client to the gateway.

Unfortunately, since it’s internal to the gateway for security reasons, there’s probably no way to work around the issue. You could maybe try sending the arguments and query to the gateway using system.util.sendRequest, but that probably won’t work, since the payload still has to end up getting serialized.

That sounds like something that will break my database caching module, as it has a number of datatypes that need serialization in both directions. Is there a registry for the whitelist to support module RPC? If applicable?

( I haven’t had a chance to test 8.0.16 yet…)

That’s the issue. I’ve moved the database script function calls to be in gateway scope via a tag change event.

@PGriffith Any update on this one? we are running into this as well and trying to know if we should work around or downgrade back to 8.0.15

No update yet, but it’s a very high priority bug - will (almost) certainly be fixed in the next released version.

This is a serious issue for us, we have a dozen machines in commissioning being stalled.

We updated to 8.0.14 because of stale tags that hasn’t been fixed: Client Tags stay stale after connection is restored in Ignition 8.0.14
We updated to 8.0.16 to get around the “gateway hangs when loading” bug
We updated to 8.1rc2 to get away from this bug and have a new one: 8.1-rc2 Can't log in to designer
Now updating to nightly release… joy

This issue is fixed in 8.0.17, which will be the next version released after 8.1.0 final.

Is there an expected release date for this? Really hanging out for it, got some machines shipping in a few weeks.

The 8.0.17 RC was released today and the final release is scheduled for Nov. 9.

I guess this is the price for trying to be on the bleeding edge.

The release candidate does not solve this issue… rolling back again…

Hi Kevin, do you have any news on this please?

My understanding is that this will be part of the 8.0.17 release even though it wasn’t in the RC, and that it’s part of the 8.1.0 release that is available now.

Great, thanks Kevin

Hi Kevin, is there a revised release date for 8.0.17? Thanks.