Repository navigation
fix(fileservice): honor context while waiting for object storage slots - #26532
mergify[bot] merged 6 commits into
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review passed.
The change closes the cancellation contract consistently across every context-bearing object-storage operation that still used the unconditional semaphore path. Acquisition failure owns no slot; every successful acquisition retains exactly one release path, including Read's existing EOF/error/Close once-release contract and List's lazy iterator lifetime. Cancellation now terminates the local queue wait independently of the operation holding the slot. No unbounded resource, API/format compatibility, or material performance concern was found.
Validation on head 16b91d8: focused semaphore tests passed under -race -count=100, the full pkg/fileservice package passed under -race, and build/vet passed.
Merge Queue Status
This pull request spent 33 minutes 14 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonThe merge conditions cannot be satisfied due to failing checks Failing checks:
HintYou may have to fix your CI before adding the pull request to the queue again. Requeued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 27 seconds in the queue, including 3 seconds running CI. Required conditions to merge
|
matrixorigin#26532) `objectStorageSemaphore` limited concurrency with a blocking channel send. Although every object-storage operation receives a caller context, `Exists`, `List`, `Read`, `Stat`, `Write`, and `WriteMultipartParallel` waited for a semaphore slot through the unconditional `acquire` path. Once all slots were occupied, cancellation could not terminate that local wait, so an already-canceled operation remained blocked until another storage operation released a slot and could then reach the upstream storage. This change: - uses the existing context-aware acquisition path for every context-bearing object-storage operation; - returns the caller context error without invoking upstream storage when cancellation wins while queued; - propagates acquisition failure through the lazy `List` iterator; - preserves the existing release ownership after successful acquisition, including `Read` holding its slot until EOF, read error, or `Close`; - removes the now-unused unconditional acquisition helper. The regression test occupies the only slot, cancels the caller context, and verifies all six previously affected operations return `context.Canceled` without acquiring the semaphore. The same test fails deterministically on the pre-fix `main` implementation because each operation remains blocked until the test releases the slot. Validation: - `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -timeout=120s -run '^TestObjectStorageSemaphoreOperationsObserveContextWhileWaiting$' ./pkg/fileservice` - `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=300s ./pkg/fileservice` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/fileservice` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -coverprofile=/tmp/issue26273.cover ./pkg/fileservice` - `go build -mod=readonly ./pkg/fileservice` - `go vet -mod=readonly ./pkg/fileservice` All newly added context-acquisition branches are covered by the regression test. Approved by: @XuPeng-SH
matrixorigin#26532) `objectStorageSemaphore` limited concurrency with a blocking channel send. Although every object-storage operation receives a caller context, `Exists`, `List`, `Read`, `Stat`, `Write`, and `WriteMultipartParallel` waited for a semaphore slot through the unconditional `acquire` path. Once all slots were occupied, cancellation could not terminate that local wait, so an already-canceled operation remained blocked until another storage operation released a slot and could then reach the upstream storage. This change: - uses the existing context-aware acquisition path for every context-bearing object-storage operation; - returns the caller context error without invoking upstream storage when cancellation wins while queued; - propagates acquisition failure through the lazy `List` iterator; - preserves the existing release ownership after successful acquisition, including `Read` holding its slot until EOF, read error, or `Close`; - removes the now-unused unconditional acquisition helper. The regression test occupies the only slot, cancels the caller context, and verifies all six previously affected operations return `context.Canceled` without acquiring the semaphore. The same test fails deterministically on the pre-fix `main` implementation because each operation remains blocked until the test releases the slot. Validation: - `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -timeout=120s -run '^TestObjectStorageSemaphoreOperationsObserveContextWhileWaiting$' ./pkg/fileservice` - `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=300s ./pkg/fileservice` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/fileservice` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -coverprofile=/tmp/issue26273.cover ./pkg/fileservice` - `go build -mod=readonly ./pkg/fileservice` - `go vet -mod=readonly ./pkg/fileservice` All newly added context-acquisition branches are covered by the regression test. Approved by: @XuPeng-SH
matrixorigin#26532) `objectStorageSemaphore` limited concurrency with a blocking channel send. Although every object-storage operation receives a caller context, `Exists`, `List`, `Read`, `Stat`, `Write`, and `WriteMultipartParallel` waited for a semaphore slot through the unconditional `acquire` path. Once all slots were occupied, cancellation could not terminate that local wait, so an already-canceled operation remained blocked until another storage operation released a slot and could then reach the upstream storage. This change: - uses the existing context-aware acquisition path for every context-bearing object-storage operation; - returns the caller context error without invoking upstream storage when cancellation wins while queued; - propagates acquisition failure through the lazy `List` iterator; - preserves the existing release ownership after successful acquisition, including `Read` holding its slot until EOF, read error, or `Close`; - removes the now-unused unconditional acquisition helper. The regression test occupies the only slot, cancels the caller context, and verifies all six previously affected operations return `context.Canceled` without acquiring the semaphore. The same test fails deterministically on the pre-fix `main` implementation because each operation remains blocked until the test releases the slot. Validation: - `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -timeout=120s -run '^TestObjectStorageSemaphoreOperationsObserveContextWhileWaiting$' ./pkg/fileservice` - `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=300s ./pkg/fileservice` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/fileservice` - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -coverprofile=/tmp/issue26273.cover ./pkg/fileservice` - `go build -mod=readonly ./pkg/fileservice` - `go vet -mod=readonly ./pkg/fileservice` All newly added context-acquisition branches are covered by the regression test. Approved by: @XuPeng-SH
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #26273
What this PR does / why we need it:
objectStorageSemaphorelimited concurrency with a blocking channel send. Although every object-storage operation receives a caller context,Exists,List,Read,Stat,Write, andWriteMultipartParallelwaited for a semaphore slot through the unconditionalacquirepath. Once all slots were occupied, cancellation could not terminate that local wait, so an already-canceled operation remained blocked until another storage operation released a slot and could then reach the upstream storage.This change:
Listiterator;Readholding its slot until EOF, read error, orClose;The regression test occupies the only slot, cancels the caller context, and verifies all six previously affected operations return
context.Canceledwithout acquiring the semaphore. The same test fails deterministically on the pre-fixmainimplementation because each operation remains blocked until the test releases the slot.Validation:
.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -timeout=120s -run '^TestObjectStorageSemaphoreOperationsObserveContextWhileWaiting$' ./pkg/fileservice.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=300s ./pkg/fileservice.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/fileservice.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -coverprofile=/tmp/issue26273.cover ./pkg/fileservicego build -mod=readonly ./pkg/fileservicego vet -mod=readonly ./pkg/fileserviceAll newly added context-acquisition branches are covered by the regression test.