[Bug]: RAGFS PathLock lock-token creation fails on Alibaba Cloud OSS
Issue Origin
Observed or reproduced in a real environment
Bug Description
When /local is backed by Alibaba Cloud OSS through the RAGFS S3FS plugin, session mutations can fail while the native PathLock provider creates an exact-lock token:
AGFSInternalError: internal error: lock error: lock I/O error:
failed to create lock token at
/local/<account>/user/<user>/sessions/<session>/.exact.ovlock.messages.jsonl.<lock_suffix>
In one captured access.log, the affected process lifetimes contained 231 failed session mutation operations:
- 100
session.batch_add_messagesfailures - 131
session.commitfailures - 1,128 QueueManager worker error records caused by replay of unacknowledged session-commit tasks
Session search operations continued to succeed during the same periods. The failure scope was concentrated on storage writes protected by PathLock.
Current main still contains the relevant source path:
S3Client::put_object_create_new()sendsPutObjectwithIf-None-Match: *.is_s3_conditional_failure()already maps HTTP 409/412 and the AWS conditional failure codes toAlreadyExists.FilesystemPathLockProvider::try_create_token()catches the remaining error asErr(_), reads the token, and returns the genericfailed to create lock tokenerror when the token is absent.
Alibaba Cloud OSS documents x-oss-forbid-overwrite: true as its atomic no-overwrite mechanism for PutObject. The original OSS response is currently discarded by the PathLock provider, so the exact OSS status, error code, and Request ID cannot be recovered from the application log.
Steps to Reproduce
- Configure RAGFS S3FS with an Alibaba Cloud OSS endpoint and mount it at
/local. - Use the filesystem PathLock provider.
- Start
openviking-server. - Create a session and call either endpoint:
POST /api/v1/sessions/{session_id}/messages/batchPOST /api/v1/sessions/{session_id}/commit
- Observe creation of
.exact.ovlock.*under the session directory.
In the captured environment, the first lock failure occurred less than one second after application startup in each affected process lifetime. Every recorded session mutation in those lifetimes failed.
Expected Behavior
RAGFS should atomically create the lock token on Alibaba Cloud OSS. An existing token should produce a lock conflict. Other backend failures should retain the HTTP status, OSS error code, and Request ID.
Actual Behavior
Lock-token creation fails and the caller receives AGFSInternalError. The generic PathLock error hides the original S3-compatible backend response. Session writes stop for the affected process lifetime, and unacknowledged background tasks are replayed after restart.
Minimal Reproducible Example
# Configure storage.agfs with an Alibaba Cloud OSS S3-compatible endpoint,
# create a session, then invoke batch_add_messages() or commit().
# The failure occurs during the native write of messages.jsonl,
# before the session mutation completes.
Error Logs
internal error: lock error: lock I/O error: failed to create lock token at /local/<account>/user/<user>/sessions/<session>/.exact.ovlock.messages.jsonl.<lock_suffix>
SessionService.commit_async
-> Session.commit_async
-> VikingFS.write_file
-> ragfs_python
-> PathLockWrappedFS
-> FilesystemPathLockProvider::try_create_token
-> WriteFlag::CreateNew
-> S3 PutObject
Additional Context
Relevant source on current main:
- Conditional create: https://github.com/volcengine/OpenViking/blob/main/crates/ragfs/src/plugins/s3fs/client.rs#L651-L677
- Conditional conflict mapping: https://github.com/volcengine/OpenViking/blob/main/crates/ragfs/src/plugins/s3fs/client.rs#L145-L167
- Dropped backend error: https://github.com/volcengine/OpenViking/blob/main/crates/ragfs/src/lock/provider.rs#L317-L340
- Alibaba Cloud OSS PutObject semantics: https://www.alibabacloud.com/help/en/oss/developer-reference/putobject
Related project history:
- #1330 / #1333 added an OSS-specific workaround for
DeleteObjectscompatibility. - #3447 / #3602 moved PathLock into RAGFS; the design deferred backend-specific PathLock provider enhancements.
- #3122 describes restart-time queue amplification and misleading lock errors from a separate earlier lock path.
Suggested changes:
- Preserve the underlying error in
try_create_token()and expose the backend status, code, and Request ID. - Add a backend-aware atomic create strategy for Alibaba Cloud OSS, using its supported no-overwrite request semantics.
- Keep the existing 409/412-to-conflict mapping.
- Add an OSS integration test for successful create, concurrent conflict, release, and backend-error propagation.
@suqinghen hi: Can you provide the configuration for Alibaba OSS Storage (ak/sk should be mask)?
https://help.aliyun.com/en/oss/user-guide/0017-00000245?spm=5176.8466032.console-base_help.dexternal.81d81450fhMN9E&scm=20140722.S_help%40%40%E6%96%87%E6%A1%A3%40%40601665.S_BB1%40bl%2BBB2%40bl%2BRQW%40ag0%2Bos0.ID_601665-RL_PutObject%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6%E6%97%B6%E4%B8%8D%E6%94%AF%E6%8C%81If~DAS~Modified-LOC_console~UND~help-OR_ser-PAR1_0bc059b717881828174453155ec248-V_4-P0_0-P1_0
Hi: We Revert https://github.com/volcengine/OpenViking/pull/4564
Cause:
- OpenViking fully supports the standard S3 protocol. Using a custom S3 protocol may result in compatibility issues or reliance on outdated protocols.
- Alibaba OSS PutObject Does Not Support If-Match ,Truely Causes Data inconsistency in concurrent scenarios
you can use OSS with Standard S3 protocol. Like AWS S3、 MinIO、RustFS 、Volcengine Object Storage(TOS) etc.