[Rust] 当无法读取元数据缓存时, Selenium 管理器会发生崩溃,而不是降级
Description
Selenium Manager treats an unusable se-metadata.json cache inconsistently: some failures degrade gracefully, one aborts the process. This came up reviewing #18087, which improves the diagnostic for the fatal arm but deliberately leaves the behaviour as-is. se-metadata.json is a pure cache — TTL'd browser/driver version lookups plus last_used stamps for cache pruning. Losing it costs one round of re-discovery, nothing more. Today in Rust/src/metadata.rs:
| Failure | Current behaviour |
|---|---|
| File absent | new_metadata(log) — empty cache |
Unparseable JSON (metadata.rs:110) |
Err(_e) => new_metadata(log) — empty cache, silently |
Write fails (metadata.rs:243) |
log.warn("Metadata cannot be written in cache ...") |
Delete fails (metadata.rs:262) |
log.warn("Error deleting metadata file: ...") |
Open fails (metadata.rs:102) |
panic |
The open-fails arm is functionally indistinguishable from the unparseable-JSON arm — in both cases the cache is unusable and the obvious recovery is "carry on with an empty cache" — yet it is the only one that stops Selenium Manager entirely. The scenario that surfaced this (running Selenium inside a nono sandbox, reported in #18087) is exactly the case where degrading would let things work. Same applies to a cache file left root-owned by an earlier sudo run, or a read-only mount.
内容来源: SeleniumHQ/selenium