You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
[Qt] "database is locked" when opening the same db in different threads #9108
[ RUN ] OfflineDatabase.ConcurrentUse
[WARNING] {memcheck-amd64-}[Database]: Removing existing incompatible offline database
terminate called after throwing an instance of 'mapbox::sqlite::Exception'
what(): database is locked Unable to fetch row
We are not sharing the DefaultFileSource on Qt. We should do that by default, unless the user defines a path for the cache that is different from the default path, otherwise it would break the QtLocation plugin API.
That test is wrong, not sure how it is working to be honest. The sqlite API is not thread safe unless we use SQLITE_OPEN_FULLMUTEX which we should not use.
The test is correct. We need sqlite in at least "multi-thread" mode, where multiple threads with independent connections are safe; that's what the test is testing.
If the current Qt setup is operating in "single-thread" mode, then that needs to be fixed.
We do not depend on "serialized" mode, but there's no harm if the sqlite implementation is in that mode.
The log message "Removing existing incompatible offline database" (OfflineDatabase::removeExisting()) may be the key here. I don't think that should be happening with this test.
@jfirebaugh thanks a lot for the new insight on this issue. I'm suspecting that QSqlDatabase can only do single-thread to keep compatibility across multiple platforms it supports. I will investigate the Qt source code further to reach a more solid conclusion.
I think I finally found the issue. The busy timeout we set in mapboxgl is overflowing in Qt (signed -> unsigned) and for some reason Qt silently ignores the error, leaving the default timeout that is very low.
Activity
brunoabinader commentedon May 25, 2017
/cc @tmpsantos
tmpsantos commentedon May 29, 2017
We are not sharing the DefaultFileSource on Qt. We should do that by default, unless the user defines a path for the cache that is different from the default path, otherwise it would break the QtLocation plugin API.
[Qt] Share the DefaultFileSource for all QMapboxGL instances
[Qt] Share the DefaultFileSource for all QMapboxGL instances
[Qt] Share the DefaultFileSource for all QMapboxGL instances
tmpsantos commentedon Jul 13, 2017
Still seeing this! https://circleci.com/gh/mapbox/mapbox-gl-native/10564
tmpsantos commentedon Jul 13, 2017
That test is wrong, not sure how it is working to be honest. The sqlite API is not thread safe unless we use
SQLITE_OPEN_FULLMUTEXwhich we should not use.jfirebaugh commentedon Jul 13, 2017
The test is correct. We need sqlite in at least "multi-thread" mode, where multiple threads with independent connections are safe; that's what the test is testing.
If the current Qt setup is operating in "single-thread" mode, then that needs to be fixed.
We do not depend on "serialized" mode, but there's no harm if the sqlite implementation is in that mode.
https://sqlite.org/threadsafe.html
jfirebaugh commentedon Jul 13, 2017
The log message "Removing existing incompatible offline database" (
OfflineDatabase::removeExisting()) may be the key here. I don't think that should be happening with this test.tmpsantos commentedon Jul 13, 2017
@jfirebaugh thanks a lot for the new insight on this issue. I'm suspecting that QSqlDatabase can only do single-thread to keep compatibility across multiple platforms it supports. I will investigate the Qt source code further to reach a more solid conclusion.
brunoabinader commentedon Jul 14, 2017
Qt Sqlite plugin for QSqlDatabase does not allow setting e.g.
SQLITE_OPEN_FULLMUTEXwhen opening the connection: https://doc.qt.io/qt-5/qsqldatabase.html#setConnectOptionstmpsantos commentedon Jul 18, 2017
tmpsantos commentedon Jul 25, 2017
I think I finally found the issue. The busy timeout we set in mapboxgl is overflowing in Qt (signed -> unsigned) and for some reason Qt silently ignores the error, leaving the default timeout that is very low.
[Qt] Fix database timeout not being set correctly
[Qt] Fix database timeout not being set correctly