-
Notifications
You must be signed in to change notification settings - Fork 191
Original felix/feat/dual based locking #23365
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
base: main
Are you sure you want to change the base?
Original felix/feat/dual based locking #23365
Conversation
Format Checker Report
Here is the list of files with format issues in your PR: |
|
Thanks for getting this initiative started! I haven't looked at the code since there's one high-level design question that would be good to clarify first. What has been done to avoid deadlocks if one thread has session A locked and does something that tries to lock UI B while another thread has UI B locked and does something that tries to lock session A?
That's not a bug. It's a conscious design decision. Furthermore, addressing multiple issues in the same PR is a bad practice since it can lead to a mess if one of the changes causes a regression because reverting the change will then also revert the unrelated changes. |
…cking' into OriginalFelix/feat/dual-based-locking
|
Session locking does not interfere with the UI-Locking in this code anymore so there is no possibility of creating a deadlock that way. And if 2 UIs lock each other this should also not be a Problem.... |
|
Closing expired UIs must be guarded by a session-wide lock since the list of open UIs is stored in the session. But the UI lock would also need to be acquired for closing the UI since it runs detach listeners for components in that UI. So how can that work without interaction between the session lock and the UI lock? |
|
I had a quick look at code and immediately noticed a red flag.
It would be tempting to fix that by acquiring the UI lock inside the loop before calling
So there are two possible scenarios here:
I might be biased, but I see the 2nd option as much more likely. |
|
The core problem remains also after the latest changes. The implementation acquires UI locks while holding the session lock which negates most of the potential performance benefits since a single locked UI will still effectively block progress for all UIs in the session until that UI is unlocked. This is currently happening in In addition to the negated performance benefit, there's also still the same deadlock risk since application code may acquire the session lock while holding a UI lock (at least for accessing session attributes but there might also be other cases). This just strengthens my impression that you are severely underestimating the complexity of this change. I'm sorry to say this but it seems like you are out of your league and the performance issues you see in your application are most likely a symptom of the same phenomenon and no amount of changes to the framework will help you get around that because it will not address the root cause. I don't see any reason for us to further look at code-level issues in this PR unless you clearly show that you have a good understand of the big picture by presenting a plan for how to address the fundamental issue of locking UIs while holding the session lock. |

Description
Fixes # (issue)
The issue was whenever a UI was freezing, all other UIs in the same VaadinSession were freezed as well.
Type of change
Checklist
Additional for
Featuretype of change