raycast / extensions

Everything you need to extend Raycast.
https://developers.raycast.com
MIT License
5.09k stars 2.81k forks source link

[Browser Bookmarks] Crashes when there are too many bookmarks #6810

Open sauron918 opened 1 year ago

sauron918 commented 1 year ago

Extension

https://www.raycast.com/raycast/browser-bookmarks

Description

Error:

Error: Worker terminated due to reaching memory limit: JS heap out of memory

NodeError:errors:393:5
[kOnExit]:worker:277:26
Worker.<computed>.onexit:worker:199:20

Steps To Reproduce

  1. Activate extension

Default browser: Chrome Amount of bookmarks ~10k

Current Behaviour

No response

Expected Behaviour

No response

raycastbot commented 1 year ago

Thank you for opening this issue!

🔔 @sasivarnan @ahpatel @danulqua @chupi33 @tleo19 @jum8ys you might want to have a look.

💡 Author and Contributors commands The author and contributors of `raycast/browser-bookmarks` can trigger bot actions by commenting: - `@raycastbot close this issue` Closes the issue. - `@raycastbot rename this issue to "Awesome new title"` Renames the issue. - `@raycastbot reopen this issue` Reopen the issue.
thomaslombart commented 1 year ago

This shouldn't happen since the number of bookmarks rendered can't be greater than 100. Could you fork the extension, change this line to 50 and let me know if it fixes the issue for you?

sauron918 commented 1 year ago

Updating the slice limit doesn't do the job. I hardly believe the problem relay to how many list items do we show 50 vs 100.

Adding console.log(process.memoryUsage()) here shows the following increase in memory usage:

image
sauron918 commented 1 year ago

Just for the reference: cd ~/Library/Application\ Support/Google/Chrome/Default && du -h Bookmarks 8.5M Bookmarks

sauron918 commented 1 year ago

Any updates on this? I've significantly reduced the amount of bookmarks but still getting errors.

I'm curious if there are some other reports about the problem or if it's just a local case.

thomaslombart commented 1 year ago

Hey @sauron918, it's probably linked to an internal bug in Raycast. It may get fixed in the next release, I'll let you know.

thomaslombart commented 1 year ago

Hi @sauron918, are you still having the bug with the 1.54.0 release?

sauron918 commented 1 year ago

Unfortunately, yes. In Raycast v1.54.0 I still getting:

Error: Worker terminated due to reaching memory limit: JS heap out of memory

NodeError:errors:399:5
[kOnExit]:worker:287:26
Worker.<computed>.onexit:worker:209:20

when running "Search Browser Bookmarks" command.

I've tried to re-install the extension. I also tried "Clear Local Storage & Cache" action (which helps somehow till the next command run).

image
raycastbot commented 11 months ago

This issue has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊

sauron918 commented 11 months ago

The problem is still actual. The only solution so far is to use an old deprecated extension which works perfectly fine

jing2si commented 10 months ago

Same issue:

Error: Worker terminated due to reaching memory limit: JS heap out of memory

NodeError:errors:399:5
[kOnExit]:worker:287:26
Worker.<computed>.onexit:worker:209:20
lesschar commented 9 months ago

Upgrade raycast today, met this issue: [Browser Bookmarks] JS heap out of memory.

sauron918 commented 9 months ago

Probably you shouldn't deprecate old version of extension while the bug is still opened.

image
thomaslombart commented 9 months ago

We indeed overlooked this issue, sorry about that. Part of it is because we maintain a growing list of extensions (Asana, Google Workspace, Linear, GitHub, Jira, Zoom, Notion, Browser Bookmarks), which makes it challenging to stay on top of all issues. Another part is our inability to reproduce bugs, which ultimately makes them harder to fix. The extensions are open source because we want to give back to the community, allowing everyone to have enough room to improve them. So, feel free to also take a look at it and submit a PR, it'll be greatly appreciated and we can help you in the process 😊

raycastbot commented 7 months ago

This issue has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊

sauron918 commented 7 months ago

up

thomaslombart commented 6 months ago

I've investigated this issue and Id like to give a quick explainer for those interested in fixing it:

This issue occurs when you have too many bookmarks installed. Under the hood, the extension reads certain files (/Library/Application Support/Google/Chrome/{profile}/Bookmarks), but if the file is too large, the extension crashes.

The solution to this problem would be to implement JSON streaming, which would allow the file to be read line by line instead of all at once. A similar approach has already been used in the brew extension (extensions/brew/src/utils.ts). However, the situation here is more complex because the data is not just a large list of bookmarks, but rather a root object with multiple folders that can also contain nested folders. Also, you have to take into account that searching for bookmarks should search for the entire dataset so this is likely to be implemented in the streaming logic as well.

I will take a look at that at some point, but I never properly took the time to fix it. So, to anyone who is interested in that, feel free to tackle this issue 😊

raycastbot commented 4 months ago

This issue has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊

thomaslombart commented 4 months ago

FYI, we are working internally on a way to reduce out-of-memory errors for various extensions. We don't have a timeline for that yet, but hopefully, we will soon have tools to fix this issue 🙂

binbjz commented 3 months ago

I sincerely hope that our team can resolve this issue as soon as possible. Actions like searching for bookmarks and opening searched bookmarks through a browser are regular operations when using Raycast. Such routine operations should not be crashing so frequently; this feature is almost unusable.

binbjz commented 3 months ago

I sincerely hope that our team can resolve this issue as soon as possible. Actions like searching for bookmarks and opening searched bookmarks through a browser are regular operations when using Raycast. Such routine operations should not be crashing so frequently; this feature is almost unusable.

$ cd ~/Library/Application\ Support/Google/Chrome/Default && du -hs Bookmarks 3.5M Bookmarks

binbjz commented 3 months ago

I sincerely hope that our team can resolve this issue as soon as possible. Actions like searching for bookmarks and opening searched bookmarks through a browser are regular operations when using Raycast. Such routine operations should not be crashing so frequently; this feature is almost unusable.

$ cd ~/Library/Application\ Support/Google/Chrome/Default && du -hs Bookmarks 3.5M Bookmarks

I have installed "Google Chrome" to replace "Browser Bookmarks"。