Last Comment Bug 746853 - WARNING: SQL statement 'SELECT * FROM moz_downloads ORDER BY id DESC' was not finalized
: WARNING: SQL statement 'SELECT * FROM moz_downloads ORDER BY id DESC' was not...
: assertion, regression
Product: Firefox
Classification: Client Software
Component: Downloads Panel (show other bugs)
: Trunk
: x86_64 Linux
-- normal (vote)
: Firefox 15
Assigned To: :Paolo Amadini
: :Paolo Amadini
Depends on:
Blocks: DownloadsPanel 726444
  Show dependency treegraph
Reported: 2012-04-18 18:47 PDT by Jesse Ruderman
Modified: 2012-04-29 14:03 PDT (History)
5 users (show)
ryanvm: in‑testsuite?
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

The patch (2.57 KB, patch)
2012-04-23 11:25 PDT, :Paolo Amadini
mak77: review+
Details | Diff | Splinter Review

Description User image Jesse Ruderman 2012-04-18 18:47:13 PDT
I've been hitting this semi-randomly when fuzzing:

WARNING: SQL statement 'SELECT * FROM moz_downloads ORDER BY id DESC' was not finalized: file /builds/slave/m-cen-lnx64-dbg/build/storage/src/mozStorageConnection.cpp, line 851

###!!! ASSERTION: sqlite3_close failed. There are probably outstanding statements that are listed above!: 'srv == SQLITE_OK', file /builds/slave/m-cen-lnx64-dbg/build/storage/src/mozStorageConnection.cpp, line 858

mozilla::storage::::AsyncCloseConnection::Run [storage/src/mozStorageConnection.cpp:391]
nsThread::ProcessNextEvent [xpcom/threads/nsThread.cpp:656]
NS_ProcessNextEvent_P [obj-firefox/xpcom/build/nsThreadUtils.cpp:245]
nsThread::Shutdown [xpcom/threads/nsThread.cpp:497]
nsUrlClassifierDBService::Shutdown [toolkit/components/url-classifier/nsUrlClassifierDBService.cpp:1539]
nsUrlClassifierDBService::Observe [toolkit/components/url-classifier/nsUrlClassifierDBService.cpp:1498]
nsObserverList::NotifyObservers [nsVoidArray.h:69]
nsObserverService::NotifyObservers [xpcom/ds/nsObserverService.cpp:185]
nsXREDirProvider::DoShutdown [toolkit/xre/nsXREDirProvider.cpp:854]
ScopedXPCOMStartup::~ScopedXPCOMStartup [toolkit/xre/nsAppRunner.cpp:1127]
XREMain::XRE_main [mozalloc.h:253]
XRE_main [toolkit/xre/nsAppRunner.cpp:3920]
main [browser/app/nsBrowserApp.cpp:190] + 0x2130d
firefox-bin + 0x1b99
Comment 1 User image Marco Bonardo [::mak] 2012-04-19 05:51:58 PDT
thanks.  Paolo could you please prioritize this fix?
Comment 2 User image :Paolo Amadini 2012-04-23 11:25:17 PDT
Created attachment 617553 [details] [diff] [review]
The patch

Since we don't need to wait for the statement to finish its execution before
calling finalize on it, we can simplify the finalization code, and probably
solve this issue.
Comment 3 User image Marco Bonardo [::mak] 2012-04-23 11:56:11 PDT
Comment on attachment 617553 [details] [diff] [review]
The patch

Review of attachment 617553 [details] [diff] [review]:

::: browser/components/downloads/src/DownloadsCommon.jsm
@@ +450,5 @@
>        }
>      } else {
>        if (this._loadState != this.kLoadAll) {
> +        let statement = Services.downloads.DBConnection.createAsyncStatement(
> +                          "SELECT * FROM moz_downloads ORDER BY id DESC");

please specify column names here, just to make it more efficient and future-proof
Comment 4 User image :Paolo Amadini 2012-04-27 06:09:35 PDT
Pushed with the requested change:
Comment 5 User image Ryan VanderMeulen [:RyanVM] 2012-04-29 14:03:45 PDT

Note You need to log in before you can comment on or make changes to this bug.