Skip to content

fix(fileservice): avoid closing idle upload connections - #25458

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:codex/25350-fileservice-idle-retry
Jul 4, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
LeftHandCold:codex/25350-fileservice-idle-retry

Conversation

@LeftHandCold

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #25350
Related to #23225
Related to #24916

What this PR does / why we need it:

LOAD DATA from COS can intermittently fail with http: server closed idle connection during long multipart uploads. The fileservice HTTP transport already has IdleConnTimeout and connection limits, but the background metrics cleanup loop was also calling CloseIdleConnections() every 5s, which can close an idle upload connection between multipart requests.

Changes:

  • stop periodically calling httpTransport.CloseIdleConnections() from the fileservice background loop
  • keep stale connection metric cleanup, using IdleConnTimeout + 2s as the stale metric threshold
  • treat server closed idle connection as retryable so existing COS retry wrappers can retry this transient transport error
  • add retryability coverage for the COS error string

Validation:

go build ./pkg/fileservice
go vet ./pkg/fileservice
go test -v -count=1 ./pkg/fileservice

PASS
ok  	github.com/matrixorigin/matrixone/pkg/fileservice	27.250s

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

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.

Reviewed from first principles and unhappy-path angles.\n\nI checked the functional closure around the COS idle upload failure: the periodic CloseIdleConnections call was the active source of mid-upload idle-connection churn, while Go's Transport still bounds and expires idle connections through IdleConnTimeout / MaxIdleConns / MaxIdleConnsPerHost / MaxConnsPerHost after this change. The retryable classification for "server closed idle connection" is also acceptable in this fileservice path because QCloud write retries replay data through memory / seek / multipart buffers, and the read-side retry paths recreate range readers.\n\nUnhappy-path review covered leak/hung/OOM risk, stale metric cleanup, custom vs global transports, upload retry safety, and active connection metric behavior. I did not find a blocking issue.\n\nLocal verification:\n- git diff --check origin/main...HEAD\n- go build ./pkg/fileservice\n- go vet ./pkg/fileservice\n- go test -v -count=1 ./pkg/fileservice\n\nCI is green as well.

@mergify mergify Bot added the queued label Jul 4, 2026
@mergify

mergify Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-04 19:29 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-07-04 20:45 UTC · at 008f2df71e9590bacb6e7e8b340a8745ba982b1a · squash

This pull request spent 1 hour 16 minutes 2 seconds in the queue, including 1 hour 15 minutes 51 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • github-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-neutral = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64

@XuPeng-SH XuPeng-SH left a comment

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.

LGTM.

The main behavior change looks right to me: this stops force-closing idle fileservice HTTP connections every 5s and lets the transport's own idle policy manage them, which is exactly the safer direction for long-running or intermittent COS uploads. Treating http: server closed idle connection as retryable also matches the transient transport failure mode we want to mask.

Non-blocking follow-up: it would still be nice to add a multipart UploadPart retry / retry-exhaust regression case in pkg/fileservice/parallel_sdk_test.go, but I don't see a substantive blocker in the patch itself.

@mergify
mergify Bot merged commit 651b729 into matrixorigin:main Jul 4, 2026
23 of 24 checks passed
@mergify mergify Bot removed the queued label Jul 4, 2026
LeftHandCold added a commit to LeftHandCold/matrixone that referenced this pull request Jul 6, 2026
…#25458)

`LOAD DATA` from COS can intermittently fail with `http: server closed idle connection` during long multipart uploads. The fileservice HTTP transport already has `IdleConnTimeout` and connection limits, but the background metrics cleanup loop was also calling `CloseIdleConnections()` every 5s, which can close an idle upload connection between multipart requests.

Changes:
- stop periodically calling `httpTransport.CloseIdleConnections()` from the fileservice background loop
- keep stale connection metric cleanup, using `IdleConnTimeout + 2s` as the stale metric threshold
- treat `server closed idle connection` as retryable so existing COS retry wrappers can retry this transient transport error
- add retryability coverage for the COS error string

Validation:
```text
go build ./pkg/fileservice
go vet ./pkg/fileservice
go test -v -count=1 ./pkg/fileservice

PASS
ok  	github.com/matrixorigin/matrixone/pkg/fileservice	27.250s
```

Approved by: @XuPeng-SH
mergify Bot pushed a commit that referenced this pull request Jul 6, 2026
)

`LOAD DATA` from COS can intermittently fail with `http: server closed idle connection` during long multipart uploads. The fileservice HTTP transport already has `IdleConnTimeout` and connection limits, but the background metrics cleanup loop was also calling `CloseIdleConnections()` every 5s, which can close an idle upload connection between multipart requests.

Changes:
- stop periodically calling `httpTransport.CloseIdleConnections()` from the fileservice background loop
- keep stale connection metric cleanup, using `IdleConnTimeout + 2s` as the stale metric threshold
- treat `server closed idle connection` as retryable so existing COS retry wrappers can retry this transient transport error
- add retryability coverage for the COS error string

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…#25458)

`LOAD DATA` from COS can intermittently fail with `http: server closed idle connection` during long multipart uploads. The fileservice HTTP transport already has `IdleConnTimeout` and connection limits, but the background metrics cleanup loop was also calling `CloseIdleConnections()` every 5s, which can close an idle upload connection between multipart requests.

Changes:
- stop periodically calling `httpTransport.CloseIdleConnections()` from the fileservice background loop
- keep stale connection metric cleanup, using `IdleConnTimeout + 2s` as the stale metric threshold
- treat `server closed idle connection` as retryable so existing COS retry wrappers can retry this transient transport error
- add retryability coverage for the COS error string

Validation:
```text
go build ./pkg/fileservice
go vet ./pkg/fileservice
go test -v -count=1 ./pkg/fileservice

PASS
ok  	github.com/matrixorigin/matrixone/pkg/fileservice	27.250s
```

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…#25458)

`LOAD DATA` from COS can intermittently fail with `http: server closed idle connection` during long multipart uploads. The fileservice HTTP transport already has `IdleConnTimeout` and connection limits, but the background metrics cleanup loop was also calling `CloseIdleConnections()` every 5s, which can close an idle upload connection between multipart requests.

Changes:
- stop periodically calling `httpTransport.CloseIdleConnections()` from the fileservice background loop
- keep stale connection metric cleanup, using `IdleConnTimeout + 2s` as the stale metric threshold
- treat `server closed idle connection` as retryable so existing COS retry wrappers can retry this transient transport error
- add retryability coverage for the COS error string

Validation:
```text
go build ./pkg/fileservice
go vet ./pkg/fileservice
go test -v -count=1 ./pkg/fileservice

PASS
ok  	github.com/matrixorigin/matrixone/pkg/fileservice	27.250s
```

Approved by: @XuPeng-SH
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…#25458)

`LOAD DATA` from COS can intermittently fail with `http: server closed idle connection` during long multipart uploads. The fileservice HTTP transport already has `IdleConnTimeout` and connection limits, but the background metrics cleanup loop was also calling `CloseIdleConnections()` every 5s, which can close an idle upload connection between multipart requests.

Changes:
- stop periodically calling `httpTransport.CloseIdleConnections()` from the fileservice background loop
- keep stale connection metric cleanup, using `IdleConnTimeout + 2s` as the stale metric threshold
- treat `server closed idle connection` as retryable so existing COS retry wrappers can retry this transient transport error
- add retryability coverage for the COS error string

Validation:
```text
go build ./pkg/fileservice
go vet ./pkg/fileservice
go test -v -count=1 ./pkg/fileservice

PASS
ok  	github.com/matrixorigin/matrixone/pkg/fileservice	27.250s
```

Approved by: @XuPeng-SH

This branch was previously deployed

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

Labels

kind/bug Something isn't working kind/enhancement kind/test-ci size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LOAD DATA fails with COS server closed idle connection due to fileservice forcibly closing idle connections

3 participants