Skip to content

Fix stats collection bug

Cecylia Bocovich requested to merge cohosh/snowflake:stats_bug into main

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:

The first time we call this function, it turns into a ClientMapAddr that wraps a net.TCPAddr. When we call String() on this, it produces something like (note the port). Then when we call clientAddr( it returns an empty string because the call to net.ParseIP( 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.

Merge request reports