Bug 226290 - Add logging for when SQLiteDatabase fails to close
Summary: Add logging for when SQLiteDatabase fails to close
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-26 14:11 PDT by Sihui Liu
Modified: 2021-05-26 22:14 PDT (History)
6 users (show)

See Also:


Attachments
Patch (14.89 KB, patch)
2021-05-26 14:15 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch for landing (15.05 KB, patch)
2021-05-26 21:36 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sihui Liu 2021-05-26 14:11:06 PDT
...
Comment 1 Sihui Liu 2021-05-26 14:15:19 PDT
Created attachment 429793 [details]
Patch
Comment 2 Chris Dumez 2021-05-26 15:51:42 PDT
Comment on attachment 429793 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429793&action=review

r=me with nits

> Source/WebCore/platform/sql/SQLiteDatabase.cpp:238
> +            RELEASE_LOG_ERROR(SQLDatabase, "SQLiteDatabase::close: Failed to close database (%d) - %s", lastError(), lastErrorMsg());

Do you want a LOG_ERROR() too? I don't think you'll see the RELEASE_LOG_ERROR() on the bots' output, unless you get a sysdiagnose.

Also, you want to use %{public}s (assuming not privacy sensitive, %{private}s otherwise) on the string so the actually gets printed out in a RELEASE_LOG.

> Source/WebCore/platform/sql/SQLiteDatabase.h:62
> +    enum class ShouldSetErrorState { No, Yes };

enum class ShouldSetErrorState : bool { No, Yes };
Comment 3 Sihui Liu 2021-05-26 21:36:44 PDT
Created attachment 429842 [details]
Patch for landing
Comment 4 Sihui Liu 2021-05-26 21:37:22 PDT
Comment on attachment 429793 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429793&action=review

>> Source/WebCore/platform/sql/SQLiteDatabase.cpp:238
>> +            RELEASE_LOG_ERROR(SQLDatabase, "SQLiteDatabase::close: Failed to close database (%d) - %s", lastError(), lastErrorMsg());
> 
> Do you want a LOG_ERROR() too? I don't think you'll see the RELEASE_LOG_ERROR() on the bots' output, unless you get a sysdiagnose.
> 
> Also, you want to use %{public}s (assuming not privacy sensitive, %{private}s otherwise) on the string so the actually gets printed out in a RELEASE_LOG.

The test I am investigating is an API test failed on release bot, so this is enough for me.
Will add %{public}s.

>> Source/WebCore/platform/sql/SQLiteDatabase.h:62
>> +    enum class ShouldSetErrorState { No, Yes };
> 
> enum class ShouldSetErrorState : bool { No, Yes };

Okay
Comment 5 Chris Dumez 2021-05-26 21:42:11 PDT
(In reply to Sihui Liu from comment #4)
> Comment on attachment 429793 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=429793&action=review
> 
> >> Source/WebCore/platform/sql/SQLiteDatabase.cpp:238
> >> +            RELEASE_LOG_ERROR(SQLDatabase, "SQLiteDatabase::close: Failed to close database (%d) - %s", lastError(), lastErrorMsg());
> > 
> > Do you want a LOG_ERROR() too? I don't think you'll see the RELEASE_LOG_ERROR() on the bots' output, unless you get a sysdiagnose.
> > 
> > Also, you want to use %{public}s (assuming not privacy sensitive, %{private}s otherwise) on the string so the actually gets printed out in a RELEASE_LOG.
> 
> The test I am investigating is an API test failed on release bot, so this is
> enough for me.
> Will add %{public}s.

Not sure what you mean by enough. Release logging doesn’t show in api tests output. Only way would be to get a sysdiagnose from the bots.

> 
> >> Source/WebCore/platform/sql/SQLiteDatabase.h:62
> >> +    enum class ShouldSetErrorState { No, Yes };
> > 
> > enum class ShouldSetErrorState : bool { No, Yes };
> 
> Okay
Comment 6 Chris Dumez 2021-05-26 21:44:29 PDT
(In reply to Chris Dumez from comment #5)
> (In reply to Sihui Liu from comment #4)
> > Comment on attachment 429793 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=429793&action=review
> > 
> > >> Source/WebCore/platform/sql/SQLiteDatabase.cpp:238
> > >> +            RELEASE_LOG_ERROR(SQLDatabase, "SQLiteDatabase::close: Failed to close database (%d) - %s", lastError(), lastErrorMsg());
> > > 
> > > Do you want a LOG_ERROR() too? I don't think you'll see the RELEASE_LOG_ERROR() on the bots' output, unless you get a sysdiagnose.
> > > 
> > > Also, you want to use %{public}s (assuming not privacy sensitive, %{private}s otherwise) on the string so the actually gets printed out in a RELEASE_LOG.
> > 
> > The test I am investigating is an API test failed on release bot, so this is
> > enough for me.
> > Will add %{public}s.
> 
> Not sure what you mean by enough. Release logging doesn’t show in api tests
> output. Only way would be to get a sysdiagnose from the bots.

Maybe you want a temporary WTFLogAlways() since this is a release bot?

> > 
> > >> Source/WebCore/platform/sql/SQLiteDatabase.h:62
> > >> +    enum class ShouldSetErrorState { No, Yes };
> > > 
> > > enum class ShouldSetErrorState : bool { No, Yes };
> > 
> > Okay
Comment 7 EWS 2021-05-26 22:13:24 PDT
Committed r278150 (238194@main): <https://commits.webkit.org/238194@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 429842 [details].
Comment 8 Radar WebKit Bug Importer 2021-05-26 22:14:19 PDT
<rdar://problem/78551181>