WalletConnect / walletconnect-utils

Javascript Utilities for WalletConnect
MIT License
113 stars 77 forks source link

safe-json Memory Leak/Infinite Execution #153

Open Mostafatalaat770 opened 12 months ago

Mostafatalaat770 commented 12 months ago

We are facing an issue on random devices on specific browsers that can be related to the safe-json package.

Basically, it keeps trying to set them on the storage but it fails(maybe) and keeps trying till it runs out of memory

image

This only happened after upgrading to the latest web3modal v2, and it still happens on v3.

Steps to reproduce?

It happens for random users so we don't know what the problem is, it happens locally for some dev members and doesn't happen on production for the same devs with the same config (browser).

Versions

Working: "@walletconnect/modal": "^2.5.7", "@web3modal/ethereum": "2.6.0", "viem": "1.0.7", "wagmi": "1.3.3"

Problematic: V2: "@web3modal/ethereum": "2.7.1", "viem": "1.19.6", "wagmi": "1.4.7"

V3: "@web3modal/wagmi": "^3.3.2", "viem": "1.19.6", "wagmi": "1.4.7"

Mostafatalaat770 commented 12 months ago

might be related: https://github.com/WalletConnect/walletconnect-monorepo/issues/3860

Mostafatalaat770 commented 11 months ago

any update?

ganchoradkov commented 11 months ago

hey @Mostafatalaat770, do you have any steps to reproduce it? The storage, while persistent, keeps data in memory during its lifecycle and reads from file/storage when its launched. This means that if your implementation has some circular/looping setItem calls, the memory would increasing with that. For example this might happen if you're creating new pairings all the time for some reason or similar. We had previous reports where react components were repainted constantly causing similar issue I would check first if that is the case