CrashReportDatabase keeps accumulating reports

199 views
Skip to first unread message

Alec Miller

unread,
Oct 29, 2023, 1:28:18 AM10/29/23
to Crashpad-dev
There seems to be no default Initialize to have this start fresh every time the app launches.  So our crash_report directory fills with 8mb dmp files, and up to 1mb dump files. Then on shutdown this series of error messages start to appear (now up to 30).  There aren't even 30 files in the attachments directory.

I see a call for CleanDatabase()  There's an InitializeWithoutCreating, but that loads an existing database.  Initialize() says it creates a new database, or opens an existing one.  But I don't want the old one opened, or I need the old one wiped when we launch the app.

This cleaned out attachments (logs), but not the reports (dmp files).  And the metadata, and StartHandler calls still complain about missing attachments.

// Cleanup the existing files, or they'll just build and report a ton of errors
_tzset(); // set timezone
time_t localTime;
::time( &localTime );
database->CleanDatabase( localTime );

[38432:29224:20231028,145655.995:ERROR filesystem_win.cc:130] GetFileAttributes crash_reports\attachments\ce120da2-8868-4e01-b63f-5b6f11f1ab54: The system cannot find the file specified. (2)
[38432:29224:20231028,145655.995:ERROR filesystem_win.cc:130] GetFileAttributes crash_reports\attachments\c967a799-f1e6-4004-a6cb-ff8945e27035: The system cannot find the file specified. (2)
[38432:29224:20231028,145655.995:ERROR filesystem_win.cc:130] GetFileAttributes crash_reports\attachments\fbc7f7ad-43fd-45d5-8c1e-f611b43f5413: The system cannot find the file specified. (2)

Alec Miller

unread,
Oct 29, 2023, 2:02:13 AM10/29/23
to Crashpad-dev, Alec Miller
This seemed to work, but wasn't in any of the sample code that I saw.

```
              // get rid of all the old reports std::vector<CrashReportDatabase::Report> reports; reports.clear(); CrashReportDatabase::OperationStatus res = database->GetCompletedReports(&reports); if ( res == CrashReportDatabase::OperationStatus::kNoError ) { for ( auto& report : reports ) { database->DeleteReport( report.uuid ); } } reports.clear(); res = database->GetPendingReports(&reports); if ( res == CrashReportDatabase::OperationStatus::kNoError ) { for ( auto& report : reports ) { database->DeleteReport( report.uuid ); } }

```

Alec Miller

unread,
Oct 29, 2023, 2:11:15 AM10/29/23
to Crashpad-dev, Alec Miller
I don't get why there isn't a helper call to perform this.  Like database->Reset()

Mark Mentovai

unread,
Oct 30, 2023, 5:10:08 PM10/30/23
to Alec Miller, Crashpad-dev
Crashpad’s database behavior is by design.

I think you’ve made some assumptions about the crash report database based on how you expect it to work, instead of how it’s designed and implemented to work. By design, the database maintains crash reports. There’s no provision for rapid removal of crash reports, because crash reports may not have been uploaded, or may be locally valuable even after upload. Application launch and relaunch are uninteresting to the database’s role in fulfilling this purpose. Instead, Crashpad implements pruning, wherein the crashpad_handler process will periodically examine the database and remove (or “prune”) old or large reports. You’ll find more about this at client/prune_crash_reports.h.

Crashpad does not expect you to poke around in its database by yourself. It’s very easy to put it into an inconsistent state. Database operations should be made through the database interface, which you’ll fid in client/crash_report_database.h.

I think your assumptions about what CleanDatabase does, and how to use it, are also incorrect. It’s also documented in client/crash_report_database.h, but I also can’t envision a need for you to call it.

--
You received this message because you are subscribed to the Google Groups "Crashpad-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crashpad-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/crashpad-dev/e21af05c-1127-4707-b419-19990ccaebf1n%40chromium.org.

Alec Miller

unread,
Oct 30, 2023, 7:38:23 PM10/30/23
to Crashpad-dev, Mark Mentovai, Crashpad-dev, Alec Miller
Database was getting into some invalid state just by calling StartHandler as per the Error's above. The old metadata and reports were never cleared out, and somehow crashpad kept searching for attachments that didn't exist.  We were up to 40 errors calling StartHandler and also another 40 when a crash occurred.  And so were manually deleting the crash_reports folder.  Anyways, it's fixed now by wiping out the old reports.   I'll check the files you mentioned to see if those shed anymore light.  
Reply all
Reply to author
Forward
0 new messages