extensions: [Browser Bookmarks] Crashes when there are too many bookmarks

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

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 22

Most upvoted comments

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 🙂

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

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 😊

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.