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

Websocket subscription creates the same subscription ID for new connection from the same client #2926

Closed
simsonraj opened this issue Sep 2, 2024 · 1 comment · Fixed by #2929
Assignees
Labels
bug Something isn't working
Milestone

Comments

@simsonraj
Copy link
Contributor

Description

when making new subscription requests from the same client, Hedera creates the same Subscription ID, whereas it should be creating a new one every time similar to other chains. this is critical because our nodes are not able to handle multiple RPC connections in a single node, causing tons of errors

Steps to reproduce

make multiple new subscription requests to

    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_subscribe",
  "params": ["newHeads"]
}

when tried to connect with multiple connections for parallelisation, the existing context gets hung due to the same subscription ID
a new subscription request

Additional context

image

Hedera network

testnet

Version

latest

Operating system

None

@simsonraj simsonraj added the bug Something isn't working label Sep 2, 2024
@Neurone
Copy link
Contributor

Neurone commented Sep 2, 2024

This is intended behavior:

it('Subscribing to the same event and filters should return the same subscription id', async function () {

As a temporary solution to make the relay work as you expect, comment this test and the implementation:

// Check if the connection is already subscribed to this event
const existingSub = this.subscriptions[tag].find((sub) => sub.connection.id === connection.id);
if (existingSub) {
this.logger.debug(`Connection ${connection.id}: Attempting to subscribe to ${tag}; already subscribed`);
return existingSub.subscriptionId;
}

Waiting for the engineering team to make a decision here, my suggestion is to introduce an env variable to let choose this behavior.

Neurone added a commit to InternetOfPeers/hedera-json-rpc-relay that referenced this issue Sep 2, 2024
Signed-off-by: Giuseppe Bertone <[email protected]>
@natanasow natanasow added this to the 0.56.0 milestone Sep 3, 2024
@ebadiere ebadiere modified the milestones: 0.56.0, 0.55.0 Sep 3, 2024
ebadiere pushed a commit that referenced this issue Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
4 participants