Skip to content

fix(batch-requests): the number of sub-responses does not match that of sub-requests#12779

Merged
Baoyuantop merged 9 commits into
apache:masterfrom
hachi029:master
Dec 23, 2025
Merged

fix(batch-requests): the number of sub-responses does not match that of sub-requests#12779
Baoyuantop merged 9 commits into
apache:masterfrom
hachi029:master

Conversation

@hachi029

@hachi029 hachi029 commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

Description

when there is any timeout sub request, the number of sub responses does not match the number of sub requests。

for example:

the batch-request with 2 sub requests
{"headers":{},"pipeline":[{"path":"/ok","method":"GET"},{"path":"/timeout","method":"GET"}]}

there are 3 sub responses in the batch-response, with an extra empty json object '{}'
[{"status":200,"body":"ok","reason":"OK","headers":{"Connection":"keep-alive"}},{"status":504,"reason":"upstream timeout"},{}]

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Nov 26, 2025
@hachi029 hachi029 changed the title batch-request: the number of sub responses does not match the number of sub requests fix: (batch-requests)the number of sub responses does not match the number of sub requests Nov 27, 2025
@hachi029 hachi029 changed the title fix: (batch-requests)the number of sub responses does not match the number of sub requests fix(batch-requests): the number of sub responses does not match the number of sub requests Nov 27, 2025
Comment thread t/plugin/batch-requests2.t Outdated
--- error_log
timeout
--- response_body
2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is recommended to check the specific content, such as the status.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the original response contains variables such as Date header like : [{"body":"ok","headers":{"Server":"openresty/1.27.1.2","Content-Type":"text/plain","Date":"Thu, 27 Nov 2025 06:46:49 GMT","Connection":"keep-alive","Transfer-Encoding":"chunked"},"status":200,"reason":"OK"},{"status":504,"reason":"upstream timeout"}]', so it is not easy to compare the original content.

@membphis membphis Dec 19, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for me, i think we can print two status which is much clear.

like this:

1th response code: 200
2th response code: 504

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @hachi029, please check this comment, thanks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread t/plugin/batch-requests2.t Outdated
@hachi029 hachi029 changed the title fix(batch-requests): the number of sub responses does not match the number of sub requests fix(batch-requests): the number of sub-responses does not match that of sub-requests Nov 27, 2025
nic-6443
nic-6443 previously approved these changes Dec 9, 2025
@Baoyuantop

Copy link
Copy Markdown
Contributor

Hi @hachi029, could you merge the latest main branch to make CI pass?

@hachi029

Copy link
Copy Markdown
Contributor Author

@Baoyuantop merged

Baoyuantop
Baoyuantop previously approved these changes Dec 19, 2025
membphis
membphis previously approved these changes Dec 19, 2025

@membphis membphis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, only one minor issue I have leave comment

Comment thread t/plugin/batch-requests2.t Outdated
--- error_log
timeout
--- response_body
2

@membphis membphis Dec 19, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for me, i think we can print two status which is much clear.

like this:

1th response code: 200
2th response code: 504

@hachi029
hachi029 dismissed stale reviews from membphis, Baoyuantop, and nic-6443 via a631807 December 22, 2025 03:59
@Baoyuantop
Baoyuantop requested a review from membphis December 22, 2025 07:56
@Baoyuantop

Copy link
Copy Markdown
Contributor

@membphis The comment has been resolved. Please review it again.

@Baoyuantop
Baoyuantop merged commit 9cca42e into apache:master Dec 23, 2025
23 checks passed
wistefan pushed a commit to wistefan/apisix that referenced this pull request Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants