Skip to content

Conversation

wilocu
Copy link
Contributor

@wilocu wilocu commented Aug 8, 2025

#4082
Network connectivity errors like "HTTP/1.1 header parser received no bytes" were not being retried across all Spring AI model providers. These
ResourceAccessException errors occurred during poor network conditions but failed immediately instead of utilizing the existing retry mechanism.

Solution

Added ResourceAccessException.class to both DEFAULT_RETRY_TEMPLATE and SHORT_RETRY_TEMPLATE in RetryUtils.java. This enables automatic retry of
network-level connectivity issues with the same exponential backoff strategy used for other transient errors.

Impact

  • ✅ Fixes network connectivity issues for all 19+ AI model providers (OpenAI, DeepSeek, Anthropic, etc.)
  • ✅ Maintains existing retry behavior for TransientAiException
  • ✅ Uses established retry configuration (10 attempts, exponential backoff)
  • ✅ No breaking changes - purely additive retry behavior

Manually verified with MockWebServer that ResourceAccessException is now properly retried and succeeds after network errors are resolved.

Signed-off-by: Mattia Pasetto matpat17@gmail.com

I am still pretty new to contributions, please double check and let me know of any errors.

Signed-off-by: Mattia Pasetto <matpat17@gmail.com>
@sobychacko sobychacko added this to the 1.1.0.M1 milestone Aug 9, 2025
@sobychacko sobychacko merged commit c7f7b68 into spring-projects:main Aug 9, 2025
2 checks passed
spring-builds pushed a commit that referenced this pull request Aug 9, 2025
…rrors(#4094) Fixes #4082 Signed-off-by: Mattia Pasetto <matpat17@gmail.com> (cherry picked from commit c7f7b68)
little-huang pushed a commit to little-huang/spring-ai that referenced this pull request Aug 12, 2025
… connectivity errors(spring-projects#4094) Fixes spring-projects#4082 Auto-cherry-pick to 1.0.x Signed-off-by: Mattia Pasetto <matpat17@gmail.com> Signed-off-by: little_huang <53588889+little-huang@users.noreply.github.com>
tzolov pushed a commit to tzolov/spring-ai that referenced this pull request Aug 17, 2025
… connectivity errors(spring-projects#4094) Fixes spring-projects#4082 Auto-cherry-pick to 1.0.x Signed-off-by: Mattia Pasetto <matpat17@gmail.com>
scionaltera pushed a commit to scionaltera/spring-ai that referenced this pull request Sep 3, 2025
… connectivity errors(spring-projects#4094) Fixes spring-projects#4082 Auto-cherry-pick to 1.0.x Signed-off-by: Mattia Pasetto <matpat17@gmail.com>
chedim pushed a commit to couchbaselabs/spring-ai that referenced this pull request Sep 19, 2025
… connectivity errors(spring-projects#4094) Fixes spring-projects#4082 Auto-cherry-pick to 1.0.x Signed-off-by: Mattia Pasetto <matpat17@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment