Skip to content

Crash at shutdown (global destructor order is undefined) #1832

@gavinandresen

Description

@gavinandresen

CDBEnv::Shutdown calls OutputDebugStringF if there is an error closing the database.

The database environment is a global variable.

OutputDebugStringF contains a static boost::mutex.

C++ does not guarantee an order for the destruction of static/global objects, and I am getting a crash I assume because at shutdown (I'm testing handling of corrupt wallet files):

the static mutexDebugLog is destroyed
THEN the bitdb CDBEnv is destroyed, calling printf (OutputDebugStringF), which then crashes calling scoped_lock(mutexDebugLog)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions