vscode-codeql icon indicating copy to clipboard operation
vscode-codeql copied to clipboard

Failed to run query: Database is not registered

Open smowton opened this issue 1 year ago • 1 comments

Happens about half the time I select a new database, make a quick query and try to run it:

                              com.semmle.util.exception.UserError: Database is not registered: /private/tmp/db
                              	at com.semmle.cli2.execute.queryServer2.QueryServer2BackendManager.withDB(QueryServer2BackendManager.java:175)
                              	at com.semmle.cli2.execute.queryServer2.QueryServer2BackendManager.withDBShared(QueryServer2BackendManager.java:70)
                              	at com.semmle.cli2.execute.queryServer2.QueryServer2Command$Impl.lambda$runQuery$26(QueryServer2Command.java:580)
                              	at com.semmle.util.concurrent.FutureUtils.supplyCompose(FutureUtils.java:248)
                              	at com.semmle.cli2.execute.queryServer2.QueryServer2Command$Impl.lambda$runQuery$28(QueryServer2Command.java:560)
                              	at com.semmle.cli2.execute.queryServer2.QueryServer2Command$Impl.lambda$withProgressAndCancellation$15(QueryServer2Command.java:405)
                              	at com.semmle.util.concurrent.FutureUtils.supplyCompose(FutureUtils.java:248)
                              	at com.semmle.cli2.execute.queryServer2.QueryServer2Command$Impl.lambda$withProgressAndCancellation$16(QueryServer2Command.java:404)
                              	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                              	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

Restarting the query server always fixes the situation.

smowton avatar Jan 15 '24 11:01 smowton

This error happens because the query server needs to have a lock on the database in order to operate on it. Before each query-ish operation, the extension is supposed to register the database so that it can be used. For some reason, this is not happening.

Or, the database is getting registered, but then another database is getting re-registered right before the query server tries to run something on the first database. Either way, this is a bug. (edited)

Is this bug related to how many databases are currently in your database view? Or is one or more of them a test database?

aeisenberg avatar Jan 15 '24 18:01 aeisenberg