Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • S Snowflake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 91
    • Issues 91
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • The Tor Project
  • Anti-censorship
  • Pluggable Transports
  • Snowflake
  • Merge requests
  • !43

Fix stats collection bug

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Cecylia Bocovich requested to merge cohosh/snowflake:stats_bug into main Jun 19, 2021
  • Overview 3
  • Commits 1
  • Pipelines 1
  • Changes 4

Okay I found the cause of the stats bug and it's unrelated to the memory bug. It happens because we're calling the clientAddr function twice:

  • first on the string extracted from the "client_ip" parameter
  • second on the string we save in the clientMap

The first time we call this function, it turns 1.1.1.1 into a ClientMapAddr that wraps a net.TCPAddr. When we call String() on this, it produces something like 1.1.1.1:1 (note the port). Then when we call clientAddr(1.1.1.1:1) it returns an empty string because the call to net.ParseIP(1.1.1.1:1) returns nil because it's not an IP address.

There are multiple ways to solve this issue. I opted to just store values in the clientIDMap as net.Addr instead of strings, since we convert them to net.Addr before storing them in the map, and after we take them out of the map we convert them back into a net.Addr anyway. However, we could solve this by changing how the clientAddr function works instead.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: stats_bug