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

Ensure msgId in CDP requests are unique at the connection scope #984

Merged
merged 4 commits into from
Jul 28, 2023

Conversation

ankur22
Copy link
Collaborator

@ankur22 ankur22 commented Jul 27, 2023

Description of changes

A detailed description as to why we're doing this can be found here.

Currently the msgIds clash from one session to another as well as withmsgIds that are sent without a session on the connection event loop.

Generally this isn't an issue, but recently we have found that chrome sometimes returns an error without the sessionId that was in the original request msg. When this occurs, we route those error responses to handlers that are waiting on the connection event loop. If there's a clash in msgId then the wrong handler will work with the wrong response, which could result in incorrect behaviour. The other issue with routing the response to the wrong handler is that the correct handler could end up waiting indefinitely (or timeout) which could pause the whole test iteration/vu.

This change will enforce a unique msgId at the connection level, which should avoid such scenarios.

Linked issue: #861

Checklist

Currently the msgIds clash from one session to another as well as with
messages that are sent without a session on the connection event loop.

Generally this isn't an issue, but recently we have found that chrome
sometimes returns an error without the sessionId that was in the
original request msg. When this occurs, we route those error responses
to handlers that are waiting on the connection event loop. If there's
a clash in msgId then the wrong handler will work with the wrong
response, which could result in incorrect behaviour.

This change will enforce a unique msgId at the connection level, which
should avoid such scenarios.
Work with the previously defined msgId in connection. This is the first
step in ensuring that all msgIds are unique at the connection scope.
Currently this doesn't fix the original problem though and we need to
work with this same msgId in the session too.
The last piece of the puzzle in ensuring that all msgIds are unique at
the connection scope level is to ensure that same msgId type is used
in the session that is associated to the connection.
Copy link
Collaborator

@ka3de ka3de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👏 Just a small consideration.

common/connection.go Outdated Show resolved Hide resolved
This will avoid accidental use of id when newID should be used.

Resolves: #984 (comment)
Copy link
Member

@inancgumus inancgumus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@ka3de ka3de merged commit b762a08 into main Jul 28, 2023
@ka3de ka3de deleted the fix/861-unique-msg-id branch July 28, 2023 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants