https://slatedb.io logo
Facing a strange issue on `main`: ``` "INFO","fie...
# general
a
Facing a strange issue on `main`:
Copy code
"INFO","fields":{"message":"Garbage Collector is done - exiting main thread."},"target":"slatedb::garbage_collector","threadId":"ThreadId(7)"
"INFO","fields":{"message":"GC shutdown after collecting 0 Manifests, 0 WAL SSTs and 0 Compacted SSTs."},"target":"slatedb::garbage_collector","threadId":"ThreadId(7)"
"WARN","fields":{"message":"GC thread exited with BackgroundTaskShutdown"},"target":"slatedb::db::builder","threadId":"ThreadId(6)"
"ERROR","fields":{"message":"error from wal flush: background task shutdown"},"target":"slatedb::flush","threadId":"ThreadId(3)"
"INFO","fields":{"message":"wal flush thread exiting with Err(BackgroundTaskShutdown)"},"target":"slatedb::flush","threadId":"ThreadId(3)"
"WARN","fields":{"message":"flush task exited with BackgroundTaskShutdown","log.target":"slatedb::flush","log.module_path":"slatedb::flush","log.file":"/home/runner/.cargo/git/checkouts/slatedb-a6e73982df30678a/8de22fb/slatedb/src/flush.rs","log.line":165},"target":"slatedb::flush","threadId":"ThreadId(3)"
"INFO","fields":{"message":"notifying writeable wal of error"},"target":"slatedb::flush","threadId":"ThreadId(3)"
"INFO","fields":{"message":"notifying immutable wals of error"},"target":"slatedb::flush","threadId":"ThreadId(3)"
"INFO","fields":{"message":"memtable flush thread exiting with Err(BackgroundTaskShutdown)"},"target":"slatedb::mem_table_flush","threadId":"ThreadId(2)"
After this point
Db::put
starts reporting
SlateDBError::BackgroundTaskShutdown
. Happens during the regular put-get workload. Traced it down to https://github.com/slatedb/slatedb/commit/9cbb1765dddd0077181d557c5dc233244d334de2, not sure how it might affect all background tasks, but something is wrong here.
c
Hm.. that's not good šŸ˜…
I have a ā˜• meeting then I'll take a peak
That builder API shouldn't have broken anything, but perhaps there was a mistake during the updates..
ah, nah.. I see the handle seems to be handled (hah) correctly in builders.rs
a
yes, it was my first guess too
c
@actual_04780 This is happening when you run
benchmark-db.sh
locally?
It'd be helpful if you could open a GH issue with more detail. I ran the bencher and it worked OK.
a
trying to create a small isolated reproducer, no luck so far
d
I believe my latest PR for the garbage collector solves that. It’s possible that it was introduced by the db builder api change because depending on the configuration, the garbage collector could start with ā€œDirGcStatus == Doneā€, which would terminate the GC right away and would record the BackgroundTaskShutdown error into the DB object, making the DB completely inaccessible for writes and reads
that’s not possible anymore
@actual_04780 try fetching main again, the problem should not happen anymore
c
Talk about good timing!
a
appears to be fixed now, thanks!
d
yeah, the previous configuration for GC was a little bit brittle, you could actually configure slatedb to enter that weird state in a couple of ways. That’s also why I cleaned the logic like I did XD
a
looks like
db.close().await
now doesn't wait for GC to finish:
Copy code
thread 'slatedb-gc' panicked at /Users/sergei/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/time/entry.rs:568:9:
A Tokio 1.x context was found, but it is being shutdown.
stack backtrace:
...
  34: slatedb::manifest::store::ManifestStore::try_read_latest_manifest::{{closure}}
             at /Users/sergei/.cargo/git/checkouts/slatedb-a6e73982df30678a/626e128/slatedb/src/manifest/store.rs:645:63
  35: slatedb::manifest::store::StoredManifest::try_load::{{closure}}
             at /Users/sergei/.cargo/git/checkouts/slatedb-a6e73982df30678a/626e128/slatedb/src/manifest/store.rs:266:69
  36: slatedb::manifest::store::StoredManifest::load::{{closure}}
             at /Users/sergei/.cargo/git/checkouts/slatedb-a6e73982df30678a/626e128/slatedb/src/manifest/store.rs:280:31
  37: slatedb::garbage_collector::remove_expired_checkpoints::{{closure}}
             at /Users/sergei/.cargo/git/checkouts/slatedb-a6e73982df30678a/626e128/slatedb/src/garbage_collector.rs:236:81
  38: slatedb::garbage_collector::run_gc_task::{{closure}}
             at /Users/sergei/.cargo/git/checkouts/slatedb-a6e73982df30678a/626e128/slatedb/src/garbage_collector.rs:226:64
  39: slatedb::garbage_collector::GarbageCollector::start_async_task::{{closure}}
             at /Users/sergei/.cargo/git/checkouts/slatedb-a6e73982df30678a/626e128/slatedb/src/garbage_collector.rs:132:110
...
d
I’m not at my computer at the moment, but I have a hunch that this is because the tokio::select! in the garbage collector is biased, and it’s trying to process messages from the channels when the cancellation token has been canceled already. I would move the cancellation_token logic in the select up to be at the top
I think this should fix the problem: https://github.com/slatedb/slatedb/pull/583
c
Thanks!
a
did the run on the latest main, the issue is gone, thanks one more time! šŸ˜„
c
šŸ”„
3 Views