Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: MetaMask stays loading indefinetly and get error StreamProvider - Unknown response id for response: [object Object] when doing *some* contract interactions #17467

Closed
seaona opened this issue Jan 27, 2023 · 15 comments · Fixed by #18129

Comments

@seaona
Copy link
Contributor

seaona commented Jan 27, 2023

Describe the bug

Problem: when I call the function for mint an ERC1155 token, MetaMask stays loading indefinetly and I get the console error Error in event handler: Error: StreamProvider - Unknown response id for response: [object Object] .

mint-erc1155-streamprovider.mp4

This also happens when I call another contract function.

streamprovider-error.mp4

[EDITED] It seems the error could start whenever we deploy a contract. It's not 100% deterministic, so further investigation needs to be done.

Steps to reproduce [EDITED]

  1. Go to Remix https://remix.ethereum.org/
  2. Create a contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

contract Fallback {
    event Log(string func, uint gas);
    fallback() external payable {
        emit Log("fallback", gasleft());
    }
    receive() external payable {
        emit Log("receive", gasleft());
    }
    function getBalance() public view returns (uint) {
        return address(this).balance;
    }
}
  1. Deploy this contract on Goerli - see error on console // if not, deploy another contract
  2. Create another contract
contract SendToFallback {
    uint val = 0;
    function transferToFallback(address payable _to) public payable {
        _to.transfer(msg.value);
    }

    function callFallback(address payable _to) public payable {
        (bool sent, ) = _to.call{value: msg.value}("");
        require(sent, "Failed to send Ether");
    }
    function count(uint _val) public {
        val = _val;
    }
}
  1. Deploy this contract on Goerli - see error on console

After this, we are into a broken state, shown in the videos above.

Error messages or log output

No response

Version

develop [EDITED]

Build type

None

Browser

Chrome

Operating system

Linux

Hardware wallet

No response

Additional context

No response

@seaona seaona changed the title [Bug]: MetaMask stays loading indefinetly and get error StreamProvider - Unknown response id for response: [object Object] when minting an ERC1155 [Bug]: MetaMask stays loading indefinetly and get error StreamProvider - Unknown response id for response: [object Object] when doing *some* contract interactions Jan 30, 2023
@bschorchit bschorchit added the team-confirmations-secure-ux DEPRECATED: please use "team-confirmations" label instead label Jan 30, 2023
@wbt
Copy link
Contributor

wbt commented Feb 20, 2023

This looks like a duplicate of #17154 though this one has much more detail in the description, so it might be fair to close that one as a duplicate of this.
I am seeing the same issue on calls to custom contracts on a private network and even non-transaction signature requests.
In each case, the signature or transaction confirmation appears to go through just fine, but the interface remains with the forever-loading spinner and gray overlay indefinitely (tested >1 hour). Leaving DevTools open, after a bit over an hour and a half, I see "Paused before potential out-of-memory crash" on common-1.js:12 (part of regenerator-runtime);

image
Resuming does produce the out of memory crash, though the console doesn't show anything new:
image

To get to the next confirmation, you have to close out of MetaMask and ignore any "MetaMask Notification" popup window (because clicking X on that will be treated as a rejection), then re-open MetaMask from the button on the browser toolbar.
I'm also seeing high CPU usage due to an apparent bug in Windows Explorer, which slows down the computer performance somewhat and may make this bug more likely to be observed, but don't have any particular reason to think that's the cause.

@DimasikS12
Copy link

Hi! I have this problem too. Can you please tell me what is causing this error and how to solve it?

@wbt
Copy link
Contributor

wbt commented Mar 8, 2023

The cause is unclear; it appears to be a bug in MetaMask.

You can get a short term solution by clicking in some blank area in your browser, then clicking on the MetaMask pinned icon extension to get it to reload and hopefully display the next confirmation prompt, though it sometimes crashes then too (just keep trying). Do NOT click the X on the crashed "Metamask Notification" popup as this is treated as a signature rejection.

For the medium term, the only way to really solve it seems to be to use an alternative (see whatthefox.com as an example listing; no endorsement of their proposed alternative implied).

For a long term fix, someone will have to take a deep dive into MetaMask code, ideally after being able to reliably reproduce the issue. That's easier said than done though.

@DimasikS12
Copy link

DimasikS12 commented Mar 8, 2023

I can reproduce this error, it occurs after running certain contract methods on my site. When calling certain functions on my site that call certain methods on my contract, this error appears in MetaMask. I think that this is not a problem in MetaMask, but in the contract method call

@wbt
Copy link
Contributor

wbt commented Mar 8, 2023

Do you have (or can you make) clear steps for reproduction that don't cost real-world money? (e.g. something on a test network).

@Samclay8
Copy link

Samclay8 commented Mar 8, 2023

I get this performing most actions. I have around 10 wallets in my metamask and simply switching between them presents me with this infinite loading issue. Extremely annoying and have resulted in performing my day to day activities on firefox rather than chrome whilst this persists. Has anyone found a fix?

@DimasikS12
Copy link

Do you only have this problem in Chrome browser?

@DimasikS12
Copy link

And please tell me which MacOS, Linux or Windows system do you use? It's just that I'm currently testing on Windows and don't see this error. By the way, if you have error, you can remove it. You just need to go to the MetaMask settings and reset the account, after that the error disappears.

@Samclay8
Copy link

Samclay8 commented Mar 9, 2023

Windows 11, chrome version 111.0.5563.65, metamask 10.25.0.

Yes the error is specific to chrome and unfortunately resetting account data does not remove the issue. I have reset the account, and even completely uninstalled and reinstalled and the issue persists.

@wbt
Copy link
Contributor

wbt commented Mar 10, 2023

I'm also seeing it on Windows 10 w/Chrome.

@DimasikS12
Copy link

DimasikS12 commented Mar 10, 2023

Screenshot 2023-03-09 at 20 39 06

Screenshot 2023-03-09 at 20 40 10

Yes, that is right. This bug appeared in the latest version of MetaMask v10.25.0. I installed the previous version of MetaMask 10.24.2 and everything works fine. I also put debuggers in the MetaMask v10.25.0 code and noticed that when calling certain methods of my smart-controct, this error starts to appear, because MetaMask stops receiving id, as far as I understand, this is a store id, which is constantly generated. In general, this bug is due to updating MetaMask to version 10.25.0. The second screenshot shows that the id was not generated and it simply does not exist, although it should be.

@DimasikS12
Copy link

I also noticed that in the previous version of MetaMask this function is not called when the contract method is called, and in the latest version of MetaMask this function is called for some reason when I call the contract method, but no id is generated and an object without an id comes in response.

@jpuri jpuri self-assigned this Mar 10, 2023
@Samclay8
Copy link

Screenshot 2023-03-09 at 20 39 06 Screenshot 2023-03-09 at 20 40 10

Yes, that is right. This bug appeared in the latest version of MetaMask v10.25.0. I installed the previous version of MetaMask 10.24.2 and everything works fine. I also put debuggers in the MetaMask v10.25.0 code and noticed that when calling certain methods of my smart-controct, this error starts to appear, because MetaMask stops receiving id, as far as I understand, this is a store id, which is constantly generated. In general, this bug is due to updating MetaMask to version 10.25.0. The second screenshot shows that the id was not generated and it simply does not exist, although it should be.

Life saver, thank you. Confirmed an issue with 10.25.0

@DimasikS12
Copy link

But unfortunately, I still cannot figure out why MetaMask v10.25.0 cannot generate this id and why this happens. I also noticed that not all methods of my smart contract cause this error, only some.

@jpuri jpuri removed their assignment Mar 10, 2023
@jpuri jpuri removed team-confirmations-secure-ux DEPRECATED: please use "team-confirmations" label instead needs-triage labels Mar 13, 2023
Gudahtt added a commit that referenced this issue Mar 13, 2023
This reverts commit 6f6984f. That
commit was an RPC middleware refactor intended to move the subscribe
and filter middleware into the network controller, to simplify the
process of sharing this middleware between clients.

This refactor resulted in `eth_subscribe` notifications being sent on
the wrong connections, causing the UI to break in some cases (the UI
`provider` connection does not support notifications). This happened
because the `setupProviderEngine` function runs per-connection,
whereas the engine setup inside the network controller is global. The
global network client cannot support notifications because it has no
way to route them; they'll need to stay in the per-connection provider
engine.

Closes #17467
@seaona
Copy link
Contributor Author

seaona commented Mar 14, 2023

@DimasikS12 @wbt @Samclay8 thank you all for your contributions. We have identified the issue and have a fix for it. It will take a couple of weeks in order to be released in production. You should see it fixed once it is released 👍

Gudahtt added a commit that referenced this issue Mar 14, 2023
This reverts commit 6f6984f. That
commit was an RPC middleware refactor intended to move the subscribe
and filter middleware into the network controller, to simplify the
process of sharing this middleware between clients.

This refactor resulted in `eth_subscribe` notifications being sent on
the wrong connections, causing the UI to break in some cases (the UI
`provider` connection does not support notifications). This happened
because the `setupProviderEngine` function runs per-connection,
whereas the engine setup inside the network controller is global. The
global network client cannot support notifications because it has no
way to route them; they'll need to stay in the per-connection provider
engine.

Closes #17467
Gudahtt added a commit that referenced this issue Mar 15, 2023
…18129)

* Revert "Moved subscribe and filter into network controller (#16693)"

This reverts commit 6f6984f. That
commit was an RPC middleware refactor intended to move the subscribe
and filter middleware into the network controller, to simplify the
process of sharing this middleware between clients.

This refactor resulted in `eth_subscribe` notifications being sent on
the wrong connections, causing the UI to break in some cases (the UI
`provider` connection does not support notifications). This happened
because the `setupProviderEngine` function runs per-connection,
whereas the engine setup inside the network controller is global. The
global network client cannot support notifications because it has no
way to route them; they'll need to stay in the per-connection provider
engine.

Closes #17467

* Add e2e test

An e2e test has been added that confirms subscriptions are only
broadcast to the site that registered them. This test fails on
`develop`.
PeterYinusa pushed a commit that referenced this issue Mar 30, 2023
…18129)

* Revert "Moved subscribe and filter into network controller (#16693)"

This reverts commit 6f6984f. That
commit was an RPC middleware refactor intended to move the subscribe
and filter middleware into the network controller, to simplify the
process of sharing this middleware between clients.

This refactor resulted in `eth_subscribe` notifications being sent on
the wrong connections, causing the UI to break in some cases (the UI
`provider` connection does not support notifications). This happened
because the `setupProviderEngine` function runs per-connection,
whereas the engine setup inside the network controller is global. The
global network client cannot support notifications because it has no
way to route them; they'll need to stay in the per-connection provider
engine.

Closes #17467

* Add e2e test

An e2e test has been added that confirms subscriptions are only
broadcast to the site that registered them. This test fails on
`develop`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants