apache / apache/lucene

Test exception handling better/easier than testThreadInterruptDeadlock() [LUCENE-4460]

Open
#5,526 1 comment 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major type:bug type:test
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

currently the fact that MockDirectoryWrapper has throttlers and such that sleep, combined with the fact this test interrupts, makes a good test for exception handling.

The problem is this is really crappy to debug: things dont reproduce, you have to use hundreds or thousands of iterations, etc etc.

I think it would be better if we made it possible for MockIndexInput to throw random exceptions like MockIndexOutput and had a single threaded test that just threw random exceptions? This way it would reproduce...

---
Migrated from [LUCENE-4460](https://issues.apache.org/jira/browse/LUCENE-4460) by Robert Muir (@rmuir)

Contributor guide

Open the contributing guide

Research direction

Start by reading testThreadInterruptDeadlock() and the exception-throttling behavior in MockDirectoryWrapper. Compare MockIndexInput with MockIndexOutput to understand how random exceptions are injected. Done should be a single-threaded test that exercises exception handling reproducibly without relying on interrupt timing or hundreds of iterations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 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.