Closed MonsieurNicolas closed 3 years ago
opened https://github.com/stellar/stellar-core/pull/3268 to deal with the race in captive core. I didn't change the logging - we're using the same app creation path to spin up temp apps, and I'm not really sure this is a big problem? I mean, we log things like "did not find the DB, so initializing a new one" or "found the DB" to give users an idea of what's happening, so maybe that's fine?
There are a couple issues with captive-core logging.
First, logs start with a bunch of messages related to temporary application objects, leading to a log sequence like:
note the logs only say "Starting stellar-core..." only after spewing a bunch of stuff related to temporary applications getting created and torn down.
Second, if there is a conflicting core instance running, the error messages are:
What is wrong here is that the error
unable to flock file: buckets/stellar-core.lock
is being silently handled and then triggersMinimal database not found, creating one...
. This is confusing and dangerous: the database already exists (it's just that another instance is already running) and there is an actual race: if the other instance stops, the current one will happily callnew-db
thinking it needs to create a new database. In this situation we should rethrow the exception and not handle it like this.