Skip to content

Handle any exception thrown while generating source for an IngestDocument #91981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/91981.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 91981
summary: Handle any exception thrown while generating source for an `IngestDocument`
area: Ingest Node
type: bug
issues: []
12 changes: 6 additions & 6 deletions server/src/main/java/org/elasticsearch/ingest/IngestService.java
Original file line number Diff line number Diff line change
Expand Up @@ -944,13 +944,13 @@ private void innerExecute(
try {
boolean ensureNoSelfReferences = ingestDocument.doNoSelfReferencesCheck();
indexRequest.source(ingestDocument.getSource(), indexRequest.getContentType(), ensureNoSelfReferences);
} catch (IllegalArgumentException ex) {
// An IllegalArgumentException can be thrown when an ingest
// processor creates a source map that is self-referencing.
// In that case, we catch and wrap the exception so we can
// include which pipeline failed.
} catch (Exception ex) {
// An IllegalArgumentException can be thrown when an ingest processor creates a source map that is self-referencing.
// Rarely, a ConcurrentModificationException can be thrown if a pipeline leaks a reference to a shared mutable
// collection, and another indexing thread modifies the shared reference while we're trying to ensure it has
// no self references. If anything goes wrong here, we want to know, but also cannot proceed with normal execution.
handler.accept(
new IllegalArgumentException(
new RuntimeException(
"Failed to generate the source document for ingest pipeline [" + pipeline.getId() + "]",
ex
)
Expand Down