You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to replicate
Deployment of the application which includes a migration against the documents table (Document model) coupled with saving a claim (on a server instance that has not been restarted since the migration?!)
Impact
Will raise an ActiveRecord::PreparedStatementCacheExpired error and users creating or updating claims
will experience a 500 error and possibly lose some changes they have made as a result.
Cause
The code below means that any save on claim queries and could attempt to update the document table. I believe the query itself is what can raise the error. If the document table has been migrated the query's prepared statement expires. Existing sessions on a server that have not been restarted following the migration will therefore be using an expired statement?!
Further to the comment about whether we need the after_save block, it is possible that we can set the claim_id and external_user_id fields when the document is uploaded rather than when the claim is submitted.
How to replicate
Deployment of the application which includes a migration against the documents table (Document model) coupled with saving a claim (on a server instance that has not been restarted since the migration?!)
Impact
Will raise an ActiveRecord::PreparedStatementCacheExpired error and users creating or updating claims
will experience a 500 error and possibly lose some changes they have made as a result.
Cause
The code below means that any save on claim queries and could attempt to update the document table. I believe the query itself is what can raise the error. If the document table has been migrated the query's prepared statement expires. Existing sessions on a server that have not been restarted following the migration will therefore be using an expired statement?!
Fix
This article is useful background reading but we should question whether we even need this after_save hook now.
The text was updated successfully, but these errors were encountered: