Research and find potential fix for long running and large data processing Snaps that become unresponsive
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 853
- Forks
- 662
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 8
Description
This ticket is derived from large Snap bundle research: https://github.com/MetaMask/snaps-monorepo/issues/947
When there is a need for large data processing Snap can become frozen if the data is large enough and it takes a lot of time to complete the processing.
In such cases it is determined that Snap would get stuck and never return any response nor it will react/respond to another call.
Use cases where something like this might be required are potentially Zero Knowledge Proofs and keys used for that which can be large in size.
Here is the table representing different scenarios of testing and outcome:
|Bundle size|Installs?|Snap is running?|Can do long processing of data?|endowment:long-running enabled?|
|------------|--------|----------------|---------------------------------|----------------------------------|
| 50 MB | Yes | Yes | Yes| No |
| 75 MB | Yes | Yes | Yes| No |
| 100 MB | Yes | Yes | No (timed-out and terminated) | No |
| 100 MB | Yes | Yes | No (no response, snap crashed) | Yes |
| 225 MB | Yes | Yes | No (no response, snap crashed) | Yes |
**Note about the way of running tests:**
- [Template Snap](https://github.com/MetaMask/template-snap-monorepo) is used as the starter Snap template and environment for this testing.
- Each of the tests is performed using `base64` imported data and wrapped up into a bundle.
- For long data processing decoding of `base64` string is used (`Uint8Array.from(atob(base64String), (c) => c.charCodeAt(0));`)
- Long data processing is started on RPC request and response from the snap have been awaited.
- Files and some testing ideas are taken from these repos: https://github.com/piotr-roslaniec/snap-large-files https://github.com/piotr-roslaniec/large-files
**Details about environment on which tests have been performed:**
- Operating system: MAC OS 12.6
- Chip (CPU): Apple M1 Pro
- Memory (RAM): 16GB
- Storage: 512GB SSD
- Web browser: Google Chrome (Version 107.0.5304.110 (Official Build) (arm64))
- MetaMask Flask version 10.22.0 (local build from `develop` branch)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported behavior in the Template Snap environment using the listed bundle sizes and base64 decoding during an RPC request. Compare whether processing times out, crashes, or leaves the Snap unresponsive, including with endowment:long-running enabled. Done means identifying the failure boundary and documenting a concrete fix direction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100