Mola-maker opened a new issue, #9039:
URL: https://github.com/apache/opendal/issues/9039
### OpenDAL version or commit
main (57f8b75)
### Affected service or component
core: `new_std_io_error` (`core/core/src/raw/std_io_util.rs`), used by fs,
compfs, hdfs, monoiofs and other services that surface `std::io::Error`.
### Describe the bug
`new_std_io_error` maps every `std::io::ErrorKind` that it does not list
explicitly to `ErrorKind::Unexpected` and marks the error **temporary**. #8984
fixed this for `IsADirectory` and `NotADirectory`, because temporary directory
errors "triggered pointless retries". Several other kinds that are just as
permanent still fall through to the temporary branch:
- `DirectoryNotEmpty` (ENOTEMPTY, Windows `ERROR_DIR_NOT_EMPTY`)
- `InvalidFilename` (ENAMETOOLONG, Windows `ERROR_INVALID_NAME`)
- `FileTooLarge` (EFBIG)
- `NotSeekable` (ESPIPE)
- `CrossesDevices` (EXDEV)
- `TooManyLinks` (EMLINK)
All of these are stable on the workspace MSRV (1.91). With `RetryLayer`,
each of these failures is retried until the retry budget runs out before it is
reported.
### Steps to Reproduce
```rust
use opendal::{Operator, layers::RetryLayer, services::Fs};
let op = Operator::new(Fs::default().root(root))?
.layer(RetryLayer::new().with_max_times(3));
// Windows: '?' is not allowed in file names. On Unix, use a 300-byte name
instead (ENAMETOOLONG).
op.write("bad?name", "x").await; // InvalidFilename
op.write("d/x", "1").await?;
op.delete("d/").await; // DirectoryNotEmpty
```
Output on Windows 11, main 57f8b75:
```
fs write invalid filename Err(Unexpected) temporary=true | ... =>
invalid filename, source: (os error 123)
fs delete non-empty dir d/ Err(Unexpected) temporary=true | ... =>
directory not empty, source: (os error 145)
fs+retry(3) write invalid filename Err(Unexpected) persistent=true
elapsed 7.03s
fs+retry(3) delete non-empty dir d/ Err(Unexpected) persistent=true
elapsed 7.02s
```
### Actual Behavior
The errors are marked temporary, and `RetryLayer` spends about 7 seconds (3
retries with the default backoff) on each one before it gives up.
### Expected Behavior
These errors are permanent and returned right away, as `IsADirectory` and
`NotADirectory` already are.
### Additional Context
OpenDAL has no dedicated `ErrorKind` for these, so the proposed fix keeps
`ErrorKind::Unexpected` and only stops marking them temporary. `StorageFull`,
`QuotaExceeded`, `ResourceBusy` and `StaleNetworkFileHandle` can clear on their
own and stay retryable. `ReadOnlyFilesystem` also stays retryable, because
libhdfs reports NameNode safe mode as EROFS. So does `InvalidInput`, because
tokio returns it when DNS resolves a host to no addresses.
### Reproduction confirmation
- [x] I reproduced this issue against the affected component. For a
service-specific report, I used the actual service rather than only a mock,
emulator, or source-code analysis.
### Are you willing to submit a PR to fix this bug?
- [x] Yes, I would like to submit a PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]