Cluster manager failed to destroy session

1
In the logfile we see that the cluster managers fails to destroy the session. This post contains the same issue with a solution We added a startup flow action deleting all entries in the Session object We cannot find the cause of the problem, it appears somehow during the day and after the first entry of this error the session manager is not able to destroy any session. The errors are gone when users create a new session again (the next day). We cannot use the solution as described before because the system.session table is empty. 1. How can we monitor problems with the session manager besides digging through the logfile? 2. Is there a correct way to kill the corrupt sessions? 2016-02-24 05:57:09.586 INFO - Core: Removing session for user 'XXXXX' 2016-02-24 05:57:09.632 ERROR - Core: Cluster manager failed to destroy session'6b4e3332-cdc3-4cc0-893d-b6bea8c5c7f1', probably caused by a lock or running transaction on the database. 2016-02-24 05:57:09.632 ERROR - Core: com.mendix.core.CoreRuntimeException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.core.UserException: Verwijderen niet toegestaan. at com.mendix.core.actionmanagement.ActionManager.executeInTransactionSync(ActionManager.java:163) Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.core.UserException: Verwijderen niet toegestaan. at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:198) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.systemwideinterfaces.core.UserException: Verwijderen niet toegestaan. at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36) Caused by: com.mendix.systemwideinterfaces.core.UserException: Verwijderen niet toegestaan.
asked
1 answers
2

Unfortunately there currently isn't such a feature. The platform tries to keep the data completely consistent.
In this case it also means cleaning up uncommitted objects, but still following the necessary rules.

Based on the error message you have here I'm assuming the following is happening.

The error is saying: "UserException: Verwijderen niet toegestaan." This is likely caused by an error configured by the developer, this can be delete prevention or a before/after delete microflow.
While working in the application the platform keeps track of all the objects that have been implicitly inserted in the db (auto-commit). Upon killing a session the platform checks if there are auto-committed objects, if there are the platform will do a Delete action on that same entity.

My first guess is that you have auto-committed entities, which is basically a modelling error if they persist. Auto-commit happens for example: - when the user creates a new Order (no commit),
- then creates a new OrderLine which he completes and commits.
- This last commit inserts the OrderLine in the db, but since the OrderLine has an association to the Order which is also being stored in the db the platform auto-commits (inserts) the Order in the database too.
- If the user now closes his browser without explicitly committing the Order the Order record will remain in the auto-commit state.
- Upon killing the session the platform remembers the auto-committed Order and executes a delete on this entity.
- What happens to the OrderLine depends on other configured actions
    * If you have cascading delete the OrderLine gets removed as well
    * If you have delete prevention you'd get an error like you are having right now

Also see this page for more info on autocommit

As a next step I'd recommend searching (ctrl+f) on the text from this error and making your message a bit more explicit like: Verwijderen van een Order is niet toegestaan. this gives you more context on what is being removed.
Alternatively you can enable TRACE logging of the Core log node. This node prints actions taken in memory and also when auto-committed objects are being removed. Keep in mind this does print a lot of messages, but very useful to find the cause of your case.

answered