Skip to content

fix: increase LSP initialize timeout for JDTLS and KotlinLS#23988

Closed
norbu35 wants to merge 1 commit into
anomalyco:devfrom
norbu35:fix/lsp-jdtls-initialize-timeout
Closed

fix: increase LSP initialize timeout for JDTLS and KotlinLS#23988
norbu35 wants to merge 1 commit into
anomalyco:devfrom
norbu35:fix/lsp-jdtls-initialize-timeout

Conversation

@norbu35
Copy link
Copy Markdown

@norbu35 norbu35 commented Apr 23, 2026

Problem

JDTLS (Eclipse JDT Language Server) and KotlinLS are JVM-based language servers that must perform Gradle project sync and workspace indexing during the LSP initialize handshake. For real-world projects this routinely takes 60–180 seconds, well above the default 45 s timeout — causing every lsp_diagnostics call to fail with LSP request timeout (method: initialize).

See #23982 for full diagnosis.

Changes

  • Add an optional initializeTimeout field to the LSPServer.Handle interface so built-in servers can declare their timeout needs
  • Use it in client.ts with the existing INITIALIZE_TIMEOUT_MS (45 s) as the default — no behavior change for any other server
  • Set initializeTimeout: 180_000 (3 min) for JDTLS and KotlinLS, both of which are JVM-based and trigger Gradle sync during initialization

Testing

All existing LSP tests pass:

31 pass, 0 fail across test/lsp/*
9 pass, 0 fail for test/config/lsp.test.ts

Before / After

Server Before After
JDTLS 45 s (always times out for Gradle projects) 180 s
KotlinLS 45 s (same issue) 180 s
All others 45 s 45 s (unchanged)

Closes #23982

JDTLS (Eclipse JDT Language Server) and KotlinLS are JVM-based
language servers that must perform Gradle project sync and workspace
indexing during LSP initialize. For real-world projects this routinely
takes 60-180 seconds, well above the default 45 s timeout.

Add an optional  field to the LSP server Handle
interface so built-in servers can declare their timeout needs. Use it
in the client with the existing 45 s constant as the default.

Set 180 s for JDTLS and KotlinLS, both of which run on the JVM and
trigger Gradle sync during initialization.

Closes anomalyco#23982
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found two potentially related PRs:

  1. PR feat(opencode): add LSP timeout configuration #21006: "feat(opencode): add LSP timeout configuration"

  2. PR test: reproducer for write tool hanging on slow LSP initialize (related to #22872) #22884: "test: reproducer for write tool hanging on slow LSP initialize (related to write tool hangs indefinitely in 1.4.6 (works in 1.4.3) #22872)"

However, PR #23988 (the current PR) appears to be the most recent and focused fix specifically targeting JDTLS and KotlinLS timeout issues. The other PRs may be earlier attempts or related investigations into the same underlying problem.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 23, 2026
@github-actions github-actions Bot closed this Apr 23, 2026
@eugenenekh
Copy link
Copy Markdown

@norbu35, could you proceed with this MR? This will be super useful, and we have no moral rights to steal your place among the contributors 😄

@norbu35
Copy link
Copy Markdown
Author

norbu35 commented May 3, 2026

Reopened with the full PR template here: #25649

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LSP initialize timeout too short for Java/Gradle projects (~15s vs ~114s needed)

2 participants