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

fix(http/metric): fix race condition for HTTP net traffic metric #5861

Merged

Conversation

halibobo1205
Copy link
Contributor

@halibobo1205 halibobo1205 commented Jun 19, 2024

What does this PR do?
Fix net traffic metric tracking for HTTP: change endpoint variable from member to local.
Why are these changes required?
The class HttpInterceptor is a singleton, so the member field endpoint is shared between users. The single instance is used and re-used to handle multiple requests processed simultaneously by different threads. The result is that one user could see another user's data. In other words, storing user data in Servlet member fields introduces a data access race condition.
image

The endpoint is used for the HTTP net traffic metric, so this statistic is probably wrong.
image

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@halibobo1205 halibobo1205 changed the title fix(http/metric): change endpoint variable from member to local fix(http/metric): fix race condition for HTTP net traffic metric tracking Jun 20, 2024
@halibobo1205 halibobo1205 changed the title fix(http/metric): fix race condition for HTTP net traffic metric tracking fix(http/metric): fix race condition for HTTP net traffic metric Jun 20, 2024
@lvs007 lvs007 merged commit 2df311a into tronprotocol:develop Jul 1, 2024
7 checks passed
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.

4 participants