Skip to content

Commit

Permalink
🐛 adding timeout for RPC call (#678) (#681)
Browse files Browse the repository at this point in the history
This cuased a problem when the language server is OOM killed and the
read step was always waiting causing an indefinite hang. This will
timeout these requests.

Signed-off-by: Shawn Hurley <shawn@hurley.page>
Signed-off-by: Cherry Picker <noreply@github.com>

Signed-off-by: Shawn Hurley <shawn@hurley.page>
Signed-off-by: Cherry Picker <noreply@github.com>
Co-authored-by: Shawn Hurley <shawn@hurley.page>
  • Loading branch information
konveyor-ci-bot[bot] and shawn-hurley committed Jul 29, 2024
1 parent 9b7f589 commit ffc2d24
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"regexp"
"strings"
"sync"
"time"

"github.com/go-logr/logr"
"github.com/konveyor/analyzer-lsp/jsonrpc2"
Expand Down Expand Up @@ -137,7 +138,9 @@ func (p *javaServiceClient) GetAllSymbols(ctx context.Context, query, location s
}

var refs []protocol.WorkspaceSymbol
err := p.rpc.Call(ctx, "workspace/executeCommand", wsp, &refs)
// If it takes us 5min to complete a request, then we are in trouble
timeOutCtx, _ := context.WithTimeout(ctx, 5*time.Minute)
err := p.rpc.Call(timeOutCtx, "workspace/executeCommand", wsp, &refs)
if err != nil {
if jsonrpc2.IsRPCClosed(err) {
p.log.Error(err, "connection to the language server is closed, language server is not running")
Expand Down

0 comments on commit ffc2d24

Please sign in to comment.