Skip to content

[adapters] Avoid races updating status.json.#5554

Merged
blp merged 1 commit intomainfrom
status-json
Feb 4, 2026
Merged

[adapters] Avoid races updating status.json.#5554
blp merged 1 commit intomainfrom
status-json

Conversation

@blp
Copy link
Member

@blp blp commented Feb 4, 2026

This avoids warnings like the following:

WARN dbsp::storage::backend::posixio_impl:  /pipeline-storage/status.json.mut: unable to delete dropped file: No such file or directory (os error 2)
WARN dbsp_adapters::server:  status.json: failed to write to storage (/pipeline-storage/status.json.mut: rename failed: entity not found)

which occurred because the task to update status.json would start an update before waiting for the previous one to complete.

Checklist

  • Documentation updated
  • Changelog updated

Breaking Changes?

Mark if you think the answer is yes for any of these components:

Describe Incompatible Changes

This avoids warnings like the following:

```
WARN dbsp::storage::backend::posixio_impl:  /pipeline-storage/status.json.mut: unable to delete dropped file: No such file or directory (os error 2)
WARN dbsp_adapters::server:  status.json: failed to write to storage (/pipeline-storage/status.json.mut: rename failed: entity not found)
```

which occurred because the task to update status.json would start an update
before waiting for the previous one to complete.

Signed-off-by: Ben Pfaff <blp@feldera.com>
@blp blp self-assigned this Feb 4, 2026
@blp blp added the bug Something isn't working label Feb 4, 2026
Copilot AI review requested due to automatic review settings February 4, 2026 00:38
@blp blp added connectors Issues related to the adapters/connectors crate rust Pull requests that update Rust code labels Feb 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Serializes status.json writes by awaiting the prior blocking write task, preventing overlapping updates that caused rename/delete race warnings.

Changes:

  • Await the spawn_blocking task responsible for writing status.json so updates don’t overlap.

if Some(stored_status) != prev_stored_status {
let storage = storage.clone();
spawn_blocking(move || stored_status.write(&*storage));
let _ = spawn_blocking(move || stored_status.write(&*storage)).await;
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awaiting the task prevents the race (good), but the result is discarded, which can hide a panic in the blocking task (JoinError) and any error returned by stored_status.write(...) (if it returns a Result). Consider handling the awaited result explicitly (e.g., log JoinError and/or the write error) so failures to persist status don’t silently pass.

Suggested change
let _ = spawn_blocking(move || stored_status.write(&*storage)).await;
if let Err(join_err) =
spawn_blocking(move || stored_status.write(&*storage)).await
{
eprintln!(
"failed to persist stored status: blocking task panicked or was cancelled: {join_err}"
);
}

Copilot uses AI. Check for mistakes.
@blp blp enabled auto-merge February 4, 2026 00:43
@blp blp added this pull request to the merge queue Feb 4, 2026
Merged via the queue into main with commit 8e8ad24 Feb 4, 2026
6 of 7 checks passed
@blp blp deleted the status-json branch February 4, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working connectors Issues related to the adapters/connectors crate rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants