Hotfix: Fix wrong/missing use of transactions in kernel #81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit fixes multiple places where transactions were either not used, or were used incorrectly. By incorrect use of transaction, it is meant that nested transaction commits were executed.
CMRX kernel transaction subsystem does NOT support nested transactions so this behavior caused any outer transaction to run unprotected. These two effects combined caused problems in wait_for_object() with timeout defined where in certain cases it could happen that the notification has been delivered just before the wait would time out. This led to crash inside the kernel.
This fix has a nature of hotfix. It was decided to rework the internals of the kernel to support "object methods" approach. There the architecture of who is responsible for creating transactions should be cleaner leading to overall cleaner code. As this is quite some work, hotfix fixes crash for now with refactor coming in later.
In order to fix code that issued nested commits, some new code had to be developed that allows to break functions creating their own transactions into parts that don't need transaction to be committed and part that lives under existing committed transaction.
In the future the whole kernel should be rewritten to look like this.