[odb-users] Mutex may not be released  Re: It was blocked by
	odb::sqlite::connection_pool_factory::create()
    Boris Kolpackov 
    boris at codesynthesis.com
       
    Tue Jun 25 06:39:52 EDT 2024
    
    
  
Sunny Sun <sunny.sun at ringcentral.com> writes:
> We encountered a problem that was the thread was blocked by
> odb::sqlite::connection_pool_factory::create().
> 
> We created a new db file with odb::sqlite::database, then we call
> db->schema_version() which will call
> odb::sqlite::connection_pool_factory::create().
Are you sure it is connection_pool_factory::create() that is blocking
and not connection_pool_factory::connect()?
connection_pool_factory::create() essentially calls sqlite3_open_v2()
and then executes a couple of PRAGMA statements, which I don't see how
they can block, at least not at the ODB level. Perhaps the file is locked
on the filesystem level or some such?
> I noticed the following code snippet:
> 
> signal ()
>     {
> 
> 
> 
>       if (waiters_ > signals_)
>       {
>         if (signals_++ == 0)
>         {
>           if (SetEvent (event_) == 0)
>             throw win32_exception ();
>         }
>       }
> 
> 
>       mutex_.unlock ();
>     }
> 
> 
> If it throw win32_exception(), it will not unlock mutex.
If the Win32 SetEvent() function fails, it means there is something
fundamentally broken with synchronization primitives in the process
and whether you unlock a mutex or not doesn't really matter.
Are you observing this exception being thrown in your case?
Also, I don't see how it is connected to the create() function
above. Can you explain how this code is relevant to the problem
at hand?
    
    
More information about the odb-users
mailing list