[grid] Preventing potential deadlock in Distributor#17022
Conversation
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
PR TypeBug fix Description
|
| Relevant files | |||
|---|---|---|---|
| Bug fix |
| ||
| Tests |
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||
java/src/org/openqa/selenium/grid/distributor/local/LocalGridModel.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
🔗 Related Issues
💥 What does this PR do?
Fixes #17018 potential deadlock in LocalGridModel by firing events outside the lock scope
LocalGridModelNodeRestartedEvent,NodeRemovedEvent) were previously fired while holdingLocalGridModel.lock, causing circular lock dependency withLocalNodeRegistry.lockWrite a unit test to simulate (based on analysis & thread dump in #17018)
Fixed by updating LocalGridModel to fire events outside the lock scope:
purgeDeadNodes(): Collect removed nodes in a set, release lock, then fireNodeRemovedEventfor eachadd(): Store restarted node reference, release lock, then fireNodeRestartedEventif needed🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes