apache / apache/opendal

bug: dav-server-opendalfs: OpendalFile drops opendal::Writer without close() or abort() on write failure

Open
#7,425 4 comments 1 reaction 0 assignees View on GitHub
bug releases-note/fix services/webdav
Dominant language
Rust
Stars
5.4k
Forks
825
Avg merge
1d 14m
Merged PRs (30d)
127

Description

### Describe the bug

`dav-server-opendalfs` appears to violate the `opendal::Writer` lifecycle requirement in its `OpendalFile` implementation.

In `src/file.rs` if a write path fails before `close()`, the writer is left to be dropped without an explicit `abort()`.

That seems incompatible with the `opendal::Writer` documentation, which says callers must terminate the writer explicitly with either `close()` or `abort()`.

### Steps to Reproduce

See the test in https://github.com/apache/opendal/compare/main...andrei-21:opendal:test/abort-on-failure.

### Expected Behavior

If a write path cannot be completed successfully, `dav-server-opendalfs` should explicitly terminate the underlying OpenDAL writer lifecycle.

### Additional Context

Logs
```
DEBUG request{method=PUT uri="http://localhost/dav/pub/two.bin" version=HTTP/1.1}: dav_server::davhandler: == START REQUEST Put /pub/two.bin
WARN request{method=PUT uri="http://localhost/dav/pub/two.bin" version=HTTP/1.1}: opendal::layers::complete: writer has not been closed or aborted, must be a bug
DEBUG request{method=PUT uri="http://localhost/dav/pub/two.bin" version=HTTP/1.1}: dav_server::davhandler: == END REQUEST result FsError(GeneralFailure)
ERROR request{method=PUT uri="http://localhost/dav/pub/two.bin" version=HTTP/1.1}: tower_http::trace::on_failure: response failed classification=Status code: 500 Internal Server Error latency=4 ms
```

### Are you willing to submit a PR to fix this bug?

- [x] Yes, I would like to submit a PR.

Contributor guide

Open the contributing guide

Research direction

Start in src/file.rs and inspect the OpendalFile write path, especially the failure path before the writer is closed. Use the referenced abort-on-failure test as the reproduction and verify that failed writes explicitly terminate the OpenDAL writer with close() or abort() without triggering the lifecycle warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.