Repository navigation
libcontainer: read /proc/net/udp queues as tx:rx - #3979
Open
AnujYamdagni wants to merge 1 commit into
Open
AnujYamdagni wants to merge 1 commit into
AnujYamdagni wants to merge 1 commit into
Conversation
The queue column of /proc/net/udp and /proc/net/udp6 is tx_queue:rx_queue, as the file header and the kernel's udp4_format_sock show, but scanUDPStats reads it as rx:tx. The rxqueued and txqueued values of container_network_udp_usage_total and container_network_udp6_usage_total are therefore swapped. Scan the column in the right order. The test fixture already has the right header; fix its expected values, which matched the bug.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
scanUDPStatsreads the queue column of/proc/net/udpasrx:tx, but the kernel writestx_queue:rx_queue(the file header says so, andudp4_format_sockprints the write queue first). Socontainer_network_udp_usage_totalandcontainer_network_udp6_usage_totalreport the transmit queue asudp_state="rxqueued"and the receive queue astxqueued, and the API'sRxQueued/TxQueuedfields are swapped the same way. The udp metric is off by default, so only users who enable it see this.The fix swaps the scan order. The test fixture already has the
tx_queue rx_queueheader, but its expected values matched the bug, so this change corrects them too.Test plan (Go 1.27.4, linux/amd64, master at cacca25), in
lib/:go test -count=1 -run TestScanUDPStats ./container/libcontainer/: with the corrected expectations, master fails (RxQueued:0xa, TxQueued:0xb, want0xb,0xa); with this change it passes.go test -race -count=1 ./container/libcontainer/ ./metrics/: ok.Not tested: a live container with non-empty UDP queues.