Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix: Fix wrong/missing use of transactions in kernel #81

Merged
merged 1 commit into from
Mar 14, 2025

Conversation

ventZl
Copy link
Owner

@ventZl ventZl commented Mar 14, 2025

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.

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.
@ventZl ventZl merged commit 243ff79 into master Mar 14, 2025
1 check passed
@ventZl ventZl deleted the fix/transaction-use branch March 14, 2025 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant