apache / apache/lucene

OutOfMemoryError should not be wrapped in an IllegalStateException, as it is misleading for fault-tolerant programs [LUCENE-2511]

Open
#3,585 8 comments 0 reactions 0 assignees View on GitHub
affects-version:2.4.1 legacy-jira-priority:Minor module:core/index type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

I have a program, which does explicit commits. On one occasion, I saw the following exception thrown:

java.lang.IllegalStateException: this writer hit an OutOfMemoryError; cannot commit
at org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:4061)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4136)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4114)

In our program, we treat all errors as fatal and terminate the program (and restart). Runtime exceptions are sometimes handled differently, since they are usually indicative of a programming bug that might be recoverable. in some situations.

I think the OutOfMemoryError should not be wrapped as a runtime exception.. as this can mask a serious issue from a fault-tolerant application.

---
Migrated from [LUCENE-2511](https://issues.apache.org/jira/browse/LUCENE-2511) by David Sitsky, updated Nov 30 2013

Contributor guide

Open the contributing guide

Research direction

Start in org/apache/lucene/index/IndexWriter.java at prepareCommit and the commit call paths shown in the report. Trace how an OutOfMemoryError becomes an IllegalStateException, then inspect the surrounding tests if available. Done means the original OutOfMemoryError is not misleadingly wrapped during commit.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.