NotificationDB takes a lot of time on taskSave and JSON.stringify
Categories
(Core :: DOM: Notifications, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox145 | --- | fixed |
People
(Reporter: arcadiy, Assigned: saschanaz)
References
(Depends on 1 open bug)
Details
Attachments
(3 files, 1 external file)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:143.0) Gecko/20100101 Firefox/143.0
Steps to reproduce:
Ever since 141 there is an issue where when Firefox produces a notification popup via KDE plasma the entire Firefox stalls for a second, including when playing a video. When clearing all notifications from KDE plasma Firefox main process starts consuming CPU at a high rate with a stall/hickup every 300/500ms, basically every other keystroke.
No specific Firefox process is implicated as you can see in a screenshot.
No other application running suffers from this.
Comment 1•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•1 year ago
|
||
Hi,
This issue appears similar to bug 1984438, which also involves notification system interactions causing Firefox performance problems on KDE/Linux.
To help investigate this further, could you please capture a Firefox profiler trace during the freeze/stall? Here's how:
- Navigate to https://profiler.firefox.com/
- Click "Start recording"
- Trigger a KDE notification that causes the freeze
- After the stall occurs, click "Capture" in the profiler
- Upload the profile and share the link here
This will help us identify what's blocking the main thread during the notification event.
Thanks!
Comment 3•1 year ago
|
||
Kagami, this bug appears very similar to bug 1984438 where notification system interactions cause Firefox hangs on KDE/Linux.
Both involve notification-related blocking of the main thread. In bug 1984438, we identified that libnotify's synchronous D-Bus communication was the culprit.
We should consider moving the notification handling off the main thread to prevent these KDE notification-triggered stalls.
| Assignee | ||
Comment 4•1 year ago
|
||
Alternatively we could import libnotify code into firefox-main and patch it for our purpose (and eventually upstream it). Wdyt? (Off-the-main-thread is really a workaround than a real fix...)
Chromium has its own notification backend which is independent from libnotify, we could do the same if it makes sense.
We should also consider removing sync calls in our own code: https://searchfox.org/firefox-main/search?q=g_dbus_proxy_call_sync&path=&case=true®exp=false
When clearing all notifications from KDE plasma Firefox main process starts consuming CPU at a high rate with a stall/hickup every 300/500ms, basically every other keystroke.
But this doesn't make sense to me, that's nothing to do with sync dbus call. Arcadiy, would you mind creating a performance profile with https://profiler.firefox.com? You can use https://www.bennish.net/web-notifications.html to trigger notifications and then clear all.
| Assignee | ||
Comment 5•1 year ago
|
||
And also, when clearing happens, how many notifications are involved?
| Reporter | ||
Comment 6•1 year ago
|
||
(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #5)
And also, when clearing happens, how many notifications are involved?
I will run profile as requested once the problem reappears. I can't tell you how many but usually "a lot" as when I leave the laptop asleep while traveling for several hours, coming back and removing all Twitter notifications usually results in massive CPU consumption and stalls for tens of minutes. But it's hard to say because notifications also expire so they don't accumulate indefinitely.
| Assignee | ||
Comment 7•1 year ago
|
||
Can you provide some magnitude, like, 10+, 100+, even 1000+?
Comment 9•1 year ago
|
||
(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #4)
Alternatively we could import libnotify code into firefox-main and patch it for our purpose (and eventually upstream it). Wdyt? (Off-the-main-thread is really a workaround than a real fix...)
It would be better to check with upstream if they would accept the solution or patch.
If they accept the proposal, we should just land the patch at the upstream instead of importing the code. If it changes the signature of API or introduce a new API, we could use weak symbols for the new API to use it if available.
| Reporter | ||
Comment 10•1 year ago
|
||
Profile: https://share.firefox.dev/3IBantp
The number of notifications is probably in low hundreds.
| Reporter | ||
Comment 11•1 year ago
|
||
| Reporter | ||
Comment 12•1 year ago
|
||
Here is another one with the following scenario:
- Begins normally
- A single notification arrives, causing a stutter.
- Single notification is dismissed.
- All notifications cleared, CPU maxes out, stutter constant.
| Assignee | ||
Comment 13•1 year ago
|
||
Thank you! In this case actually it's fully about NotificationDB being slow, nothing to do with libnotify. Changing the component.
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 14•1 year ago
|
||
One more thing, if you do:
- Fully close Firefox and reopen
- Open
about:support - Open the profile folder
- Open
notificationstore.json
Is it empty like {} or is the file super big?
| Reporter | ||
Comment 16•1 year ago
|
||
| Assignee | ||
Comment 17•1 year ago
|
||
Gah. My fault. Patch coming soon.
| Assignee | ||
Comment 18•1 year ago
|
||
In the meantime please remove the file and restart Firefox, and then it should be fast again.
| Assignee | ||
Comment 19•1 year ago
|
||
Updated•1 year ago
|
| Reporter | ||
Comment 20•1 year ago
|
||
I see twitter notifications from 4 years ago! Are they not garbage-collected??
{
"https://twitter.com": {
"{f54d5fa3-219e-498a-9a4c-85d516746393}": {
"id": "{f54d5fa3-219e-498a-9a4c-85d516746393}",
"title": "Chris B - NSF",
"dir": "auto",
"lang": "",
"body": "RT @nextspaceflight: The Flight Termination System (FTS) has still not been installed on Starship SN15. The odds of a launch attempt tomorrow are deteriorating, but perhaps they plan to do it last minute.",
"tag": "tweet_with_badge-1387920630763376643",
"icon": "https://pbs.twimg.com/profile_images/1121126296086618116/XdSiqigA_reasonably_small.png",
"alertName": "https://twitter.com#tag:tweet_with_badge-1387920630763376643",
"timestamp": 1619741063036,
"origin": "https://twitter.com",
"data": "AgAAAAAA8f8AAAAACAD//wQAAIAEAP//bGFuZwAAAAACAACABAD//2VuAAAAAAAACwAAgAQA//9idW5kbGVfdGV4dAAAAAAAUwAAgAQA//97bnVtX3RvdGFsLCBudW1iZXJ9IG5ldyB7bnVtX3RvdGFsLCBwbHVyYWwsIG9uZSB7aW50ZXJhY3Rpb259IG90aGVyIHtpbnRlcmFjdGlvbnN9fQAAAAAABAAAgAQA//90eXBlAAAAABAAAIAEAP//dHdlZXRfd2l0aF9iYWRnZQMAAIAEAP//dXJpAAAAAAArAACABAD//y9uZXh0c3BhY2VmbGlnaHQvc3RhdHVzLzEzODc5MTM0OTYyNjQ3OTgyMTQAAAAAAA0AAIAEAP//aW1wcmVzc2lvbl9pZAAAACAAAIAEAP//ODA5ZjAwNzliNjMzNGZkMmFiZmY2ODAyM2Y5NDI1NDEFAACABAD//3RpdGxlAAAADQAAgAQA//9DaHJpcyBCIC0gTlNGAAAABAAAgAQA//9ib2R5AAAAAMwAAIAEAP//UlQgQG5leHRzcGFjZWZsaWdodDogVGhlIEZsaWdodCBUZXJtaW5hdGlvbiBTeXN0ZW0gKEZUUykgaGFzIHN0aWxsIG5vdCBiZWVuIGluc3RhbGxlZCBvbiBTdGFyc2hpcCBTTjE1LiBUaGUgb2RkcyBvZiBhIGxhdW5jaCBhdHRlbXB0IHRvbW9ycm93IGFyZSBkZXRlcmlvcmF0aW5nLCBidXQgcGVyaGFwcyB0aGV5IHBsYW4gdG8gZG8gaXQgbGFzdCBtaW51dGUuAAAAAAMAAIAEAP//dGFnAAAAAAAkAACABAD//3R3ZWV0X3dpdGhfYmFkZ2UtMTM4NzkyMDYzMDc2MzM3NjY0MwAAAAANAACABAD//3NjcmliZV90YXJnZXQAAAAFAACABAD//3R3ZWV0AAAACgAAgAQA//90b3RhbENvdW50AAAAAAAAAQAAAAMA//8AAAAAEwD//w==",
"mozbehavior": "{\"noclear\":false,\"noscreen\":false,\"showOnlyOnce\":false,\"soundFile\":\"\"}",
"serviceWorkerRegistrationScope": "https://twitter.com/"
},
"{5a7ca440-b68f-4905-97e4-268e15205c69}": {
"id": "{5a7ca440-b68f-4905-97e4-268e15205c69}",
"title": "Not the Bee",
"dir": "auto",
"lang": "",
"body": "As this \"pastor\" so colorfully illustrates, \"antiracism\" is nothing more than actual racists discovering a way to trumpet their racism in civil society notthebee.com/article/as-thiβ¦",
"tag": "tweet_with_badge-1387920045322510336",
"icon": "https://pbs.twimg.com/profile_images/1299007907623825411/Vo7e-cEQ_reasonably_small.jpg",
"alertName": "https://twitter.com#tag:tweet_with_badge-1387920045322510336",
"timestamp": 1619741063039,
"origin": "https://twitter.com",
"data": "AgAAAAAA8f8AAAAACAD//wQAAIAEAP//bGFuZwAAAAACAACABAD//2VuAAAAAAAACwAAgAQA//9idW5kbGVfdGV4dAAAAAAAUwAAgAQA//97bnVtX3RvdGFsLCBudW1iZXJ9IG5ldyB7bnVtX3RvdGFsLCBwbHVyYWwsIG9uZSB7aW50ZXJhY3Rpb259IG90aGVyIHtpbnRlc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erRegistrationScope": "https://twitter.com/"
},
"{b32870e3-7340-45b2-9691-8b1e44bb2ff3}": {
"id": "{b32870e3-7340-45b2-9691-8b1e44bb2ff3}",
"title": "OSINTtechnical",
"dir": "auto",
"lang": "",
"body": "Blinken says Russia has pulled back some of the troops it deployed over the past month. twitter.com/60Minutes/statβ¦",
"tag": "tweet_with_badge-1387921293706661893",
"icon": "https://pbs.twimg.com/profile_images/1191175818933932032/W4GF6Nbe_reasonably_small.jpg",
"alertName": "https://twitter.com#tag:tweet_with_badge-1387921293706661893",
"timestamp": 1619741197819,
"origin": "https://twitter.com",
"data": "AgAAAAAA8f8AAAAACAD//wQAAIAEAP//bGFuZwAAAAACAACABAD//2VuAAAAAAAACwAAgAQA//9idW5kbGVfdGV4dAAAAAAAUwAAgAQA//97bnVtX3RvdGFsLCBudW1iZXJ9IG5ldyB7bnVtX3RvdGFsLCBwbHVyYWwsIG9uZSB7aW50ZXJhY3Rpb259IG90aGVyIHtpbnRlcmFjdGlvbnN9fQAAAAAABAAAgAQA//90eXBlAAAAABAAAIAEAP//dHdlZXRfd2l0aF9iYWRnZQMAAIAEAP//dXJpAAAAAAAqAACABAD//y9Pc2ludHRlY2huaWNhbC9zdGF0dXMvMTM4NzkyMTI5MzcwNjY2MTg5MwAAAAAAAA0AAIAEAP//aW1wcmVzc2lvbl9pZAAAACAAAIAEAP//NDg4NDU1NGI3ZTMzNGExOGI4Mjg3OTg0NjIzM2RhOWQFAACABAD//3RpdGxlAAAADgAAgAQA//9PU0lOVHRlY2huaWNhbAAABAAAgAQA//9ib2R5AAAAAHMAAAAEAP//QgBsAGkAbgBrAGUAbgAgAHMAYQB5AHMAIABSAHUAcwBzAGkAYQAgAGgAYQBzACAAcAB1AGwAbABlAGQAIABiAGEAYwBrACAAcwBvAG0AZQAgAG8AZgAgAHQAaABlACAAdAByAG8AbwBwAHMAIABpAHQAIABkAGUAcABsAG8AeQBlAGQAIABvAHYAZQByACAAdABoAGUAIABwAGEAcwB0ACAAbQBvAG4AdABoAC4AIAB0AHcAaQB0AHQAZQByAC4AYwBvAG0ALwA2ADAATQBpAG4AdQB0AGUAcwAvAHMAdABhAHQAJiAAAAMAAIAEAP//dGFnAAAAAAAkAACABAD//3R3ZWV0X3dpdGhfYmFkZ2UtMTM4NzkyMTI5MzcwNjY2MTg5MwAAAAANAACABAD//3NjcmliZV90YXJnZXQAAAAFAACABAD//3R3ZWV0AAAACgAAgAQA//90b3RhbENvdW50AAAAAAAAAQAAAAMA//8AAAAAEwD//w==",
"mozbehavior": "{\"noclear\":false,\"noscreen\":false,\"showOnlyOnce\":false,\"soundFile\":\"\"}",
"serviceWorkerRegistrationScope": "https://twitter.com/"
},
"{e164d0a9-ea1c-40d4-928e-67601ded305a}": {
"id": "{e164d0a9-ea1c-40d4-928e-67601ded305a}",
"title": "Not the Bee",
"dir": "auto",
"lang": "",
"body": "Biden's Defense Department denies permit to \"Rolling to Remember,\" jeopardizing 32-year Memorial Day tradition honoring our veterans. notthebee.com/article/bidensβ¦",
"tag": "tweet_with_badge-1388562263074918403",
"icon": "https://pbs.twimg.com/profile_images/1299007907623825411/Vo7e-cEQ_reasonably_small.jpg",
"alertName": "https://twitter.com#tag:tweet_with_badge-1388562263074918403",
"timestamp": 1619894017052,
"origin": "https://twitter.com",
"data": "AgAAAAAA8f8AAAAACAD//wQAAIAEAP//bGFuZwAAAAACAACABAD//2VuAAAAAAAACwAAgAQA//9idW5kbGVfdGV4dAAAAAAAUwAAgAQA//97bnVtX3RvdGFsLCBudW1iZXJ9IG5ldyB7bnVtX3RvdGFsLCBwbHVyYWwsIG9uZSB7aW50ZXJhY3Rpb259IG90aGVyIHtpbnRlcmFjdGlvbnN9fQAAAAAABAAAgAQA//90eXBlAAAAABAAAIAEAP//dHdlZXRfd2l0aF9iYWRnZQMAAIAEAP//dXJpAAAAAAAnAACABAD//y9Ob3RfdGhlX0JlZS9zdGF0dXMvMTM4ODU2MjI2MzA3NDkxODQwMwANAACABAD//2ltcHJlc3Npb25faWQAAAAgAACABAD//2Y1NDNmZjIwZTdkZjRiYzE5NmU4ODEyOTk4YzNkODk4BQAAgAQA//90aXRsZQAAAAsAAIAEAP//Tm90IHRoZSBCZWUAAAAAAAQAAIAEAP//Ym9keQAAAACjAAAABAD//0IAaQBkAGUAbgAnAHMAIABEAGUAZgBlAG4AcwBlACAARABlAHAAYQByAHQAbQBlAG4AdAAgAGQAZQBuAGkAZQBzACAAcABlAHIAbQBpAHQAIAB0AG8AIAAiAFIAbwBsAGwAaQBuAGcAIAB0AG8AIABSAGUAbQBlAG0AYgBlAHIALAAiACAAagBlAG8AcABhAHIAZABpAHoAaQBuAGcAIAAzADIALQB5AGUAYQByACAATQBlAG0AbwByAGkAYQBsACAARABhAHkAIAB0AHIAYQBkAGkAdABpAG8AbgAgAGgAbwBuAG8AcgBpAG4AZwAgAG8AdQByACAAdgBlAHQAZQByAGEAbgBzAC4AIABuAG8AdAB0AGgAZQBiAGUAZQAuAGMAbwBtAC8AYQByAHQAaQBjAGwAZQAvAGIAaQBkAGUAbgBzACYgAAADAACABAD//3RhZwAAAAAAJAAAgAQA//90d2VldF93aXRoX2JhZGdlLTEzODg1NjIyNjMwNzQ5MTg0MDMAAAAADQAAgAQA//9zY3JpYmVfdGFyZ2V0AAAABQAAgAQA//90d2VldAAAAAoAAIAEAP//dG90YWxDb3VudAAAAAAAAAEAAAADAP//AAAAABMA//8=",
"mozbehavior": "{\"noclear\":false,\"noscreen\":false,\"showOnlyOnce\":false,\"soundFile\":\"\"}",
"serviceWorkerRegistrationScope": "https://twitter.com/"
},
| Reporter | ||
Comment 21•1 year ago
|
||
(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #17)
Gah. My fault. Patch coming soon.
Thanks so much!
| Assignee | ||
Comment 22•1 year ago
|
||
And thank you for reporting!
Comment 23•1 year ago
|
||
Comment 24•1 year ago
|
||
| bugherder | ||
Description
•