Skip to content

fix: expand to nearest Maven module group to prevent OOM#57

Open
aviadshiber wants to merge 2 commits intomainfrom
fix/maven-group-root-expansion
Open

fix: expand to nearest Maven module group to prevent OOM#57
aviadshiber wants to merge 2 commits intomainfrom
fix/maven-group-root-expansion

Conversation

@aviadshiber
Copy link
Copy Markdown
Owner

Summary

  • expand_full_workspace() was expanding jdtls to the full IDE workspace root (products/, 248 modules), causing OutOfMemoryError: Java heap space followed by textDocument/definition timeouts
  • New _find_maven_group_root() helper walks up from the initial module to the nearest ancestor whose pom.xml contains <modules>, bounding the index to a module group (typically 5-20 modules)
  • Falls back to the workspace root only for flat monorepos with no intermediate multi-module parent

Root cause from logs

jdtls stderr: SEVERE: Internal error: java.lang.OutOfMemoryError: Java heap space
jdtls request textDocument/definition timed out after 30.0s

For the products monorepo: products/pom.xml has 248 modules. The fix scopes to products/editorial-management/ (17 modules) instead.

Test plan

  • test_expand_uses_maven_group_root_not_workspace_root — expands to group POM level, not IDE root
  • test_expand_falls_back_to_workspace_root_when_no_group_pom — flat layout falls back correctly
  • All 439 existing tests pass, 84% coverage

🤖 Generated with Claude Code

aviadsTaboola and others added 2 commits April 14, 2026 23:37
Expanding jdtls to the full IDE workspace root (e.g. products/ with 248
modules) caused OutOfMemoryError: Java heap space during indexing.

_find_maven_group_root() walks up from the initial module to the nearest
ancestor whose pom.xml contains <modules>, giving a tight cross-module
scope (typically 5-20 sibling modules) instead of the entire monorepo.
Falls back to the workspace root only when no intermediate multi-module
parent exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Address code review findings on _find_maven_group_root:
- Resolve both paths before walking to prevent symlink-based boundary
  escapes (security reviewer finding: lexical Path equality could let a
  symlinked initial_module escape workspace_root to /)
- Add is_relative_to guard so containment is enforced, not assumed
- Rename expansion_path → group_root_path for clarity
- Clarify docstring: note that initial_module itself is intentionally
  skipped (we want its parent group), and that paths are resolved

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants