fix: add timeout mechanism for OpenServer Shutdown#330
fix: add timeout mechanism for OpenServer Shutdown#330mohammad-arif662 wants to merge 4 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #330 +/- ##
==========================================
- Coverage 76.12% 76.11% -0.01%
==========================================
Files 38 38
Lines 4083 4107 +24
Branches 488 488
==========================================
+ Hits 3108 3126 +18
- Misses 791 796 +5
- Partials 184 185 +1
🚀 New features to boost your workflow:
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a timeout mechanism to the Shutdown method, which is a valuable improvement to prevent the application from hanging. However, the current implementation has a critical flaw that could lead to resource leaks by not releasing the COM object if PreShutdown fails. I have provided a critical review comment with a suggested fix for this issue. Additionally, I've included a high-severity comment to address a style guide violation regarding a hardcoded timeout value.
abdullah-cognite
left a comment
There was a problem hiding this comment.
Lets hold off on this for now.
The timeout path in Shutdown() can return while shutdown is still running in the background. That leaves lifecycle state inconsistent: Initialize() currently uses Server != null as a readiness check, so during/after timeout it can observe stale state and either skip re-initialization incorrectly or race with ongoing cleanup.
Properly fixing this would require more rework than we had anticipated, so lets park this one for now. I wouldn't rate the need for this a high priority right now.
This PR adds a timeout to Shutdown() so the calling thread is not blocked if shutdown hangs. It adds 10-second timeout to
Shutdown(). If shutdown hangs the method still returns after 10 seconds instead of blocking the thread.