Seeing repeated errors of the type "StaleObjectStateException" on MG bugfest in mod-agreements
In some cases the error is not just generated in the logs but also included in the API response
Steps to Reproduce:
- Log into https://bugfest-mg.int.aws.folio.org/
- Open agreement https://bugfest-mg.int.aws.folio.org/erm/agreements/861b0312-1172-4d4c-93fd-97cfdc6f7262
- See agreement doesn't display correctly and in console see response includes a stack trace
- Discussion in Slack channel: https://folio-project.slack.com/archives/CAYCU07SN/p1658397120027459
- Bugfest logs from 2022-07-20_15-17-03 to 2022-07-22_10-02-03 available from https://www.dropbox.com/sh/lrmyxr4p7fxuzx0/AAA8alFFpV3ozWegRq6FHQp5a?dl=0
In these logs 26 objects lead to the error occurring:
All these Entitlements are type = external with an EKB resource linked. The Entitlements all appear with the error >1 times in the log with org.olf.erm.Entitlement#d05cce2e-574b-4a9e-8f4b-59d9c6fe29e9 appearing 111 times - but it seems likely that this is probably due to it being an Entitlement linked to "2019 Trial Agreement" which happens to be the first result in the list of agreements on the opening search and filter screen - so probably just repeated a lot because people keep viewing that same agreement.
The error for com.k_int.web.toolkit.settings.AppSetting#2c9180867860f3940178657ed9fc0003 appears only once
Logs also contain many errors of the type "org.hibernate.exception.GenericJDBCException: Unable to release JDBC Connection" which suggests the DB connections aren't behaving as expected. Possibly hikari is being forced to constantly create new connections to account for the ones being snapped out from under it.