-
Notifications
You must be signed in to change notification settings - Fork 53
✨ Handle Java provider shutdown logs #862
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
Conversation
WalkthroughUpdated process shutdown and logging in the Java external provider: adjusted language-server error messages and punctuation, replaced a verbose stop log with a simple info, and added an Changes
Sequence Diagram(s)sequenceDiagram
participant Provider as Java Provider
participant Process as Language Server (cmd)
participant StopFn as Stop()
participant isSafe as isSafeErr
participant Logger as Logger
Provider->>Process: start
Note right of Process: Runs until termination
Process-->>StopFn: returns error (err)
StopFn->>isSafe: isSafeErr(err)
alt safe termination
isSafe-->>StopFn: true
StopFn->>Logger: info "java provider stopped"
Note right of StopFn #C7F9CC: no forced cancel
else unsafe termination
isSafe-->>StopFn: false
StopFn->>Logger: error "java provider stopped with error"
StopFn->>Provider: (no change to cancel handling here)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
external-providers/java-external-provider/pkg/java_external_provider/provider.go
Outdated
Show resolved
Hide resolved
external-providers/java-external-provider/pkg/java_external_provider/service_client.go
Outdated
Show resolved
Hide resolved
shawn-hurley
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the logs should be error, and I wonder if instead of if else blocks that do the same thing, if we could handle that more cleanly
external-providers/java-external-provider/pkg/java_external_provider/service_client.go
Show resolved
Hide resolved
| } | ||
| } | ||
| // to prevent log msg="stopping java provider" error="{\"Stderr\":null}" provider=java | ||
| errStr := err.Error() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what type of error is this and does this happen when the provider stops successfully? wondering if we can get the exit code and if it zero?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It comes from here https://github.com/konveyor/analyzer-lsp/blob/main/external-providers/java-external-provider/pkg/java_external_provider/service_client.go#L261 and it does occur whenever the Java provider successfully completes. I can look into the exit code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shawn-hurley I was able to remove this line now that 90b71b4 is in. I no longer see this retuning.
Signed-off-by: Emily McMullan <[email protected]>
Signed-off-by: Emily McMullan <[email protected]>
Signed-off-by: Emily McMullan <[email protected]>
23783e7 to
7ca33c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
external-providers/java-external-provider/pkg/java_external_provider/service_client.go (1)
270-284: Invoke the stored cancellation function in Stop()
ThecancelFuncstored onjavaServiceClientis never called, so the exec‐command context isn’t canceled and the Java process may hang. Add a call top.cancelFunc()inStop()(e.g. beforep.cmd.Wait()) to ensure the process is terminated even if RPC shutdown stalls.
🧹 Nitpick comments (1)
external-providers/java-external-provider/pkg/java_external_provider/service_client.go (1)
325-339: Well-structured helper for classifying safe termination scenarios.The implementation correctly identifies expected shutdown conditions:
context.Canceledfor cancelled operationsSIGTERM/SIGKILLfor external process terminationThe use of
errors.Isanderrors.Asfollows Go best practices for error handling.Consider adding a brief comment explaining the rationale for classifying these conditions as safe, e.g.:
+// isSafeErr returns true if the error represents an expected shutdown condition +// (context cancellation or termination signals) rather than an actual failure. func isSafeErr(err error) bool {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
external-providers/java-external-provider/pkg/java_external_provider/provider.go(1 hunks)external-providers/java-external-provider/pkg/java_external_provider/service_client.go(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- external-providers/java-external-provider/pkg/java_external_provider/provider.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: test
- GitHub Check: benchmark (windows-latest, windows)
- GitHub Check: benchmark (macos-latest, mac)
- GitHub Check: test (windows-latest)
🔇 Additional comments (1)
external-providers/java-external-provider/pkg/java_external_provider/service_client.go (1)
18-18: LGTM: Import required for signal inspection.The
syscallimport is necessary for checking SIGTERM/SIGKILL in theisSafeErrhelper function.
aufi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
resolves #871 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Clarified and simplified logging for the Java language server and provider: distinct messages for normal vs. error terminations, adjusted log levels, and improved punctuation. * Reduced noisy logs by classifying termination scenarios as "safe" (e.g., context cancellation or SIGTERM/SIGKILL) and logging accordingly. * Refined shutdown handling to avoid unconditional cancellation during stop. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Emily McMullan <[email protected]> Signed-off-by: Cherry Picker <[email protected]>
resolves #871 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Clarified and simplified logging for the Java language server and provider: distinct messages for normal vs. error terminations, adjusted log levels, and improved punctuation. * Reduced noisy logs by classifying termination scenarios as "safe" (e.g., context cancellation or SIGTERM/SIGKILL) and logging accordingly. * Refined shutdown handling to avoid unconditional cancellation during stop. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Emily McMullan <[email protected]> Signed-off-by: Cherry Picker <[email protected]> Signed-off-by: Emily McMullan <[email protected]> Signed-off-by: Cherry Picker <[email protected]> Co-authored-by: Emily McMullan <[email protected]>
resolves #871
Summary by CodeRabbit