Well, interestingly it seemed to solve it in one case, but it still persists in anotherSo what I currently have is:========================================auto main(int argc, char** argv) -> int{seastar::app_template app;return app.run(argc, argv, [&] {return seastar::async([&] {seastar::sharded<application_service> app_svc;app_svc.start().get();});});}struct application_service final{explicit application_service(): disk_io_svc(format("db.stripe_{}.dat", shard_id)) {}}struct disk_io_service final{seastar::file db_file;explicit disk_io_service(seastar::sstring db_file_path){db_file = seastar::open_file_dma(db_file_path, open_flags::rw | open_flags::create).get0();}}========================================What is strange is that it seems to succeed on some cores, but not others?When I count the "Assertion `thread' failed." messages below, I get 15, which is NUM_CPUS - 1 (not sure if that has any significance)
To view this discussion on the web visit https://groups.google.com/d/msgid/seastar-dev/6e635cd0-9cd7-403e-97d6-d7c2775db2d2n%40googlegroups.com.
> the thread is created only on shard 0, the one that starts the app, while sharded<T>::start constructs the service instances on all shards.
> ...
> It's worth noting that a typical design for a seastar application will stick to synchronous calls in constructors and put the async initialization in another method
> e.g. future<> start() or future<> init() that call the async path.
> With c++20 it could very well be a coroutine which looks and feels more similar to a synchronous function, without the need to run in a thread.
> the thread is created only on shard 0, the one that starts the app, while sharded<T>::start constructs the service instances on all shards.
> ...> It's worth noting that a typical design for a seastar application will stick to synchronous calls in constructors and put the async initialization in another method
> e.g. future<> start() or future<> init() that call the async path.
> With c++20 it could very well be a coroutine which looks and feels more similar to a synchronous function, without the need to run in a thread.Ahh okay, this makes a lot of sense -- thank you!I've refactored my app to use this pattern.On this note, there seem to be few examples of coroutines and C++ 20/23 codebases using SeastarI've been building a toy relational database with Seastar for my own learning/hobby purposesI'd love to contribute a PR for at least something like the buffer manager + disk I/O service that shows how to write a seastar appwith modern C++ and coroutines that perform async disk I/O with io_uring and implement a sharded buffer pool manager.Seastar seems to have a heavy emphasis on the networking side of things so I think this could be valuable for folks looking to build DBMSor other tools/services that are heavily file IO-bound.
(The gotcha here being that the PR may need a bit of hand-holding on best-practices. I've never professionally written C++, or a database)