trust-wallet-ios icon indicating copy to clipboard operation
trust-wallet-ios copied to clipboard

[failed listen ethereum event] warning: possible EventEmitter memory leak detected.

Open huahuayu opened this issue 6 years ago • 6 comments

Hi, we spend whole day debugging an issue in our Dapp (etherwow.io), and finally, find the issue may be related to trust wallet. We add debug icon on the page and found error as below: image

Our dapp has two versions, one on testnet(gaowenbao.net , do not support https), one on mainnet (etherwow.io). The frontend & smart contract is exactly same for both versions.

Now the problem is: in testnet(gaowenbao.net): our dapp works well both in metamask(pc) and in trust wallet. in mainnet(etherwow.io): our dapp works in metamask(pc), BUT not work in trust wallet. Or, to be more accurate, in mainnet we can't listen to LogBet event from solidity and got issue as the picture shows.

How to reproduce: step1: try gaowenbao.net in testnet(ropsten) by metamask and trust wallet(since it's in Chinese please use google translate for your convenience). Just choose one option and bet. Waiting for a while to generate the random num. You will find metamask & trust wallet both works fine. step2: try etherwow.io in mainnet by metamask, it cost real eth, just bet 0.1 eth will be fine. You will find
metamsk works fine. step3: try etherwow.io/_debug(mainnet ) in trust wallet. Choose to bet 0.1 eth, and wait for a while, click the setting button to see the logs image you will get a warning like this "warning: possible EventEmitter memory leak detected. ", for this reason, our dapp can't listen to LogBet event. We do lots of tests and confirm it's trust wallet's problem, please check what's the problem.

our js code for your investigation: https://github.com/hs-tqb/ethergo/blob/master/pages/index.vue smart contact: https://etherscan.io/address/0x2d05359a51ca13c4ac5f4437585afaf5bf2050f9#code

Thank you!

huahuayu avatar May 12 '18 13:05 huahuayu

Use web3 provider only sign transactions and messages, the rest use your provide to interact with a blockchain, that’s the best practice

vikmeup avatar May 12 '18 16:05 vikmeup

@vikmeup thank you for your suggestion, but with the same front-end code and same smart contract, testnet works great in trust wallet. When comes to mainnet, the problem occurs, If you have tried, you may see the issue. what's the difference on earth?

huahuayu avatar May 13 '18 03:05 huahuayu

@huahuayu can you telegram me @vikmeup? let's figure this out

vikmeup avatar May 13 '18 03:05 vikmeup

@huahuayu take a look at deep linking with Trust!: https://medium.com/@trustwallet/mobile-dapps-with-deep-linking-and-trust-wallet-6a4712b9b9a4

vikmeup avatar May 13 '18 03:05 vikmeup

@mishfit do you think this fixes this issue as well?

vikmeup avatar Jun 28 '18 03:06 vikmeup

It's possible, when the trust web3 provider is running wss (websockets) it emits data events and behaves like an EventEmitter...when it is using https it doesn't emit those events.

I'd have to run it (or even better, we can add a test for this to the provider test suite)

mishfit avatar Jun 28 '18 04:06 mishfit