Notifications

38 views

Description

  • Two incidents were created with the same field values, same incident number
  • usually less than a minute of each other

 

STEPS TO REPRODUCE:

  1. create "before" bus.rule with script field containing "current.update();"
  2. to go /incident_list.do, click on the "new" button
  3. fill out as many fields as possible, and click on "submit"
  4. you'll get error "unique key violation, invalid insert"
  5. however, you'll still be on the same form, with same values
  6. Click "submit" again
  7. go back to /incident_list.do and you'll see two incidents with the same number, field values

Resolution

we already know why this occurred, the NPE was caused by the current.update in the before bus.rules. However in the customer's environment you'll see the following in the node logs:

 

2020-03-20 18:03:48 (466) Default-thread-5 251F4627B4EB48146CD643F77E4FC438 txid=527fc6ebb4eb SEVERE *** ERROR *** FAILED TRYING TO EXECUTE ON CONNECTION 30: INSERT INTO task
Unique Key violation detected by database (Duplicate entry '8d4fc62fb4eb48146cd643f77e4fc420' for key 'PRIMARY')

java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '8d4fc62fb4eb48146cd643f77e4fc420' for key 'PRIMARY'
        at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:132)
        at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106)
        at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:274)
        at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:302)
        at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:393)
        at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

 

We will NOT see the cause of the NPE in the node logs, however at this point, all "before" bus.rules , and script includes should be reviewed to ensure that a current dot update is NOT being done before the database operation.

 

Additional Information

We will only be able to move forward if we have the steps to reproduce this issue. If steps are provided, we can do the following to troubleshoot and find root cause.

  • all "before" bus.rules , and script includes should be reviewed to ensure that a current dot update is NOT being done before the database operation.
  • set system property "glide.businessrule.callstack" to true, and review node log output and evaluate all bus.rules that executed (Please set this property back to false when not in use, it generates a lot of logging).
  • add stack trace bus.rule on the table in question and evaluate where insert/update are coming from (KB0683765 - Troubleshooting Tip: Debug business rule to print StackTrace)

Article Information

Last Updated:2020-05-25 10:37:17
Published:2020-05-25