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

WebSocketProvider.destroy() trigger an error #4678

Closed
VladimirDiamandi opened this issue Apr 2, 2024 · 1 comment
Closed

WebSocketProvider.destroy() trigger an error #4678

VladimirDiamandi opened this issue Apr 2, 2024 · 1 comment
Assignees
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published. v6 Issues regarding v6

Comments

@VladimirDiamandi
Copy link

Ethers Version

6.11.1

Search Terms

No response

Describe the Problem

If there are active subscriptions, the error will be thrown after some time after calling the provider.destroy() method.
As I understand the cause of the error is this line, because this.#destoyed is set to true before the asynchronous function "this.removeAllListeners()" is executed, as a consequence, an exception is thrown in the send method.

Code Snippet

No response

Contract ABI

No response

Errors

Error: provider destroyed; cancelled request (operation="eth_unsubscribe", code=UNSUPPORTED_OPERATION, version=6.11.1)
    at makeError (/node_modules/ethers/lib.commonjs/utils/errors.js:129:21)
    at WebSocketProvider.send (/node_modules/ethers/lib.commonjs/providers/provider-jsonrpc.js:742:60)
    at /node_modules/ethers/lib.commonjs/providers/provider-socket.js:51:28 {
  code: 'UNSUPPORTED_OPERATION',
  operation: 'eth_unsubscribe',
  shortMessage: 'provider destroyed; cancelled request'
}

Environment

No response

Environment (Other)

No response

@VladimirDiamandi VladimirDiamandi added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Apr 2, 2024
@ricmoo ricmoo added on-deck This Enhancement or Bug is currently being worked on. next-patch Issues scheduled for the next arch release. labels Apr 16, 2024
@ricmoo ricmoo added bug Verified to be an issue. and removed investigate Under investigation and may be a bug. labels Apr 17, 2024
@ricmoo
Copy link
Member

ricmoo commented Apr 17, 2024

Fixed in v6.12.0. Let me know if you have any further issues.

Thanks! :)

@ricmoo ricmoo closed this as completed Apr 17, 2024
@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. next-patch Issues scheduled for the next arch release. labels Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

2 participants