-
Notifications
You must be signed in to change notification settings - Fork 320
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
procfs has data consistency issues when reading /proc/net/tcp #576
Comments
We essentially just parse net/tcp, can you provide the relevant /proc/net/tcp content in this situation? |
@shaohk Are you implying that you suspect the contents of |
I couldn't reproduce this with the aforementioned snippet running for a thousand times. @shaohk Are you still able to reproduce this with the latest release? |
``` TCP, TCP6, UDP, and UDP6 are dynamically changing, and when we read these files, we should read them all at once. there will be data consistency issues if using line by lin reading fix: #576 ``` Signed-off-by: weidongkl <weidong@uniontech.com>
``` TCP, TCP6, UDP, and UDP6 are dynamically changing, and when we read these files, we should read them all at once. there will be data consistency issues if using line by lin reading fix: prometheus#576 ``` Signed-off-by: weidongkl <weidong@uniontech.com>
procfs/net_tcp.go
Line 28 in ff0ad85
I read tcp connections by procfs like this
When I execute multiple times, I find that the same TCP connection appears twice. eg:
But, When I execute multiple netstat command, there won't be the phenomenon mentioned above. eg:
And I find netstat source code, find the code that
netstat sets the setvbuf to _IOFBF mode when opening the net/tcp file. But golang procfs doesn't set this.
How can we ensure consistency when reading net/tcp in Golang?
The text was updated successfully, but these errors were encountered: