Skip to content

Conversation

@mhl-b
Copy link
Contributor

@mhl-b mhl-b commented Aug 27, 2025

Incremental bulk does not check if content is missing, and can throw NPE on xContentType.

java.lang.NullPointerException: Cannot invoke "org.elasticsearch.xcontent.XContentType.xContent()" because "xContentType" is null
	at [email protected]/org.elasticsearch.action.bulk.BulkRequestParser$IncrementalParser.<init>(BulkRequestParser.java:248)
	at [email protected]/org.elasticsearch.action.bulk.BulkRequestParser.incrementalParser(BulkRequestParser.java:177)

Non-incremental path checks through ReleasableBytesReference content = request.requiredContent();.

This PR adds explicit check for content presence in the incremental processing path.

ES-12591

@mhl-b mhl-b requested review from a team and DaveCTurner August 27, 2025 20:33
@mhl-b mhl-b added >non-issue :Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. Team:Distributed Indexing Meta label for Distributed Indexing team v9.2.0 labels Aug 27, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing)

@mhl-b mhl-b requested a review from JeremyDahlgren August 28, 2025 04:12
Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


public void testIncrementalBulkMissingContent() {
assertThrows(
ElasticsearchParseException.class,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could we also assert the exception message here? We're catching the empty body, not the lack of a content-type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, pressed merge button too soon. Addressed in new PR #133855

@mhl-b mhl-b merged commit 36de99b into elastic:main Aug 29, 2025
33 checks passed
@mhl-b
Copy link
Contributor Author

mhl-b commented Aug 29, 2025

💔 Some backports could not be created

Status Branch Result
9.1
8.19 Conflict resolution was aborted by the user

Manual backport

To create the backport manually run:

backport --pr 133685

Questions ?

Please refer to the Backport tool documentation

mhl-b added a commit to mhl-b/elasticsearch that referenced this pull request Aug 29, 2025
@mhl-b
Copy link
Contributor Author

mhl-b commented Aug 29, 2025

@DaveCTurner, I'm backporting to 9.1, should I backport to 8.19?

@DaveCTurner
Copy link
Contributor

should I backport to 8.19?

Yes I think so, we want to reinstate the old behaviour in 8.19 too.

mhl-b added a commit that referenced this pull request Aug 29, 2025
@DaveCTurner
Copy link
Contributor

Yes I think so, we want to reinstate the old behaviour in 8.19 too.

Actually I haven't checked whether this is needed in 8.19, and there were certainly some changes in this area that only landed in 8.19.

@mhl-b
Copy link
Contributor Author

mhl-b commented Sep 2, 2025

Incremental stuff is disabled by default in 8.x, but NPE can happen. The problem is missing machinery for content detection at Rest layer. This part landed together with moving aggregator into Rest layer. 8.x still aggregates by netty. I would fix it if anyone complains about it in 8.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >non-issue Team:Distributed Indexing Meta label for Distributed Indexing team v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants