@@ -945,17 +945,27 @@ private void innerExecute(
945
945
boolean ensureNoSelfReferences = ingestDocument .doNoSelfReferencesCheck ();
946
946
indexRequest .source (ingestDocument .getSource (), indexRequest .getContentType (), ensureNoSelfReferences );
947
947
} catch (IllegalArgumentException ex ) {
948
- // An IllegalArgumentException can be thrown when an ingest
949
- // processor creates a source map that is self-referencing.
950
- // In that case, we catch and wrap the exception so we can
951
- // include which pipeline failed.
948
+ // An IllegalArgumentException can be thrown when an ingest processor creates a source map that is self-referencing.
949
+ // In that case, we catch and wrap the exception, so we can include which pipeline failed.
952
950
handler .accept (
953
951
new IllegalArgumentException (
954
952
"Failed to generate the source document for ingest pipeline [" + pipeline .getId () + "]" ,
955
953
ex
956
954
)
957
955
);
958
956
return ;
957
+ } catch (Exception ex ) {
958
+ // If anything goes wrong here, we want to know, and cannot proceed with normal execution. For example,
959
+ // *rarely*, a ConcurrentModificationException could be thrown if a pipeline leaks a reference to a shared mutable
960
+ // collection, and another indexing thread modifies the shared reference while we're trying to ensure it has
961
+ // no self references.
962
+ handler .accept (
963
+ new RuntimeException (
964
+ "Failed to generate the source document for ingest pipeline [" + pipeline .getId () + "]" ,
965
+ ex
966
+ )
967
+ );
968
+ return ;
959
969
}
960
970
Map <String , String > map ;
961
971
if ((map = metadata .getDynamicTemplates ()) != null ) {
0 commit comments