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

/proc/net/sockstat #14

Closed
ktsaou opened this issue Sep 29, 2015 · 6 comments · Fixed by #2975
Closed

/proc/net/sockstat #14

ktsaou opened this issue Sep 29, 2015 · 6 comments · Fixed by #2975

Comments

@ktsaou
Copy link
Member

ktsaou commented Sep 29, 2015

Support:

/proc/net/sockstat and /proc/net/sockstat6

@andyshinn
Copy link

When this is implemented, I would love if it supported the mem and orphan numbers from /proc/net/sockstat. This would be very helpful in tracking TCP: out of memory -- consider tuning tcp_mem errors for tuning /proc/sys/net/ipv4/tcp_mem.

@ktsaou
Copy link
Member Author

ktsaou commented Nov 1, 2017

These files are pretty simple to parse. I am not sure I know how to use this information though.

Can you find any reliable sources for each of the numbers in these files?

# cat /proc/net/sockstat
sockets: used 2152
TCP: inuse 66 orphan 0 tw 9 alloc 77 mem 6
UDP: inuse 17 mem 17
UDPLITE: inuse 0
RAW: inuse 0
FRAG: inuse 0 memory 0

This post says mem in TCP and UDP are in pages, while memory in FRAG is in bytes.

This post discusses about orphan, but I am not sure I understand. This one says that orphan sockets, are connections that are not attached to any user file handle.

This post describes out of memory errors and orphans, much better.

This is indeed very useful info!

@andyshinn
Copy link

I agree, it is a little hazy. I was using http://blog.tsunanet.net/2011/03/out-of-socket-memory.html as a reference which is helpful.

The TCP mem is in pages and directly correlates to /proc/sys/net/ipv4/tcp_mem (which is also in pages). I'll see if i can dig up information on FRAG, orphan, tw, and alloc as well.

ktsaou added a commit to ktsaou/netdata that referenced this issue Nov 6, 2017
@ktsaou ktsaou mentioned this issue Nov 6, 2017
10 tasks
@ktsaou
Copy link
Member Author

ktsaou commented Nov 6, 2017

here is the /proc/net/sockstat plugin.
Next is /proc/net/sockstat6.
I'll also try to implement the alarm.

@ktsaou ktsaou added the fixed label Nov 6, 2017
@ktsaou
Copy link
Member Author

ktsaou commented Nov 6, 2017

screenshot from 2017-11-07 01-44-05

ktsaou added a commit to ktsaou/netdata that referenced this issue Nov 7, 2017
@marcelmfs
Copy link

By the way my netdata aggregator server is showing the TCP: out of memory -- consider tuning tcp_mem in dmesg. RAM usage and the number of used sockets (not a huge sudden increase) during these error messages seem normal, maybe there's something else leaking TCP memory?

underhood referenced this issue in underhood/netdata May 19, 2021
vkalintiris pushed a commit to vkalintiris/netdata that referenced this issue Jan 11, 2024
vkalintiris added a commit that referenced this issue Jan 11, 2024
* initial version

* basic GitHub Actions CI

* Create README.md

* run GitHub Action at least once weekly
to check test pass if distro was updated but project doesn't get
any change for long time

* add test for rbuf_find_bytes

* minor - add .vscode to .gitignore

* minor - add CFLAGS to makefile

* minor - silence unused var warning

* minor - update readme

* add submodules

* initial commit

* add README

* allow setting MQTT LWT

* allow setting LWT QOS

* handle MQTT keep-alives properly

* allow choosing keep alive time

* handle WS_OP_CONNECTION_CLOSE

* allow sending other frames than WS_OP_BINARY_FRAME

* minor readability improvements

* work on graceful disconnect

* reset ws_client state on subsequent connections

* implement mqtt_wss_destroy

* more descriptive RC for mqtt_wss_service

* properly free/destroy SSL

* work on reconnect

* set return code for WS disconnect

* Less logging under normal operation

* readme point to `test.c` as how-to for now

* OpenSSL certificate checking by default

* reset poll_fds on reconnect

* fix older SSL versions

* empty install and dist targets

* fix LGTM warning

* add rbuf_get_capacity

* gh actions test

* ws_ping impl

* test.c - port as cmd line param

* properly handle WebSocket disconnect packet

* initial HTTPS proxy support

* remove base64 submodule, use OpenSSL

* change to urandom

* ws_client_process WS_RAW retval fix

* coverity fixes

* CID 1448838

* CID 1448836

* CID 1448829

* test check for error on init

* make it play nicer with automake projects

* MQTT-C coverity fixes

* Create codeql-analysis.yml

* Make typedef introduce a new name for struct. (#2)

* add autotools related files to gitignore

* minor - silence -Wmaybe-uninitialized warning

* reinit on MQTT clean session connect

* fix apple endianness functions

* add libcrypto for macos

* MacOS compatibility

* fix FreeBSD build

* use TLS SNI

* propagate buffer full EC to app layer

* store buffer sizes in mqtt_wss_client

* allow auto buffer growth on buffer too small

* quicker connection drop on BUFFER FULL

* always clear last_ec on connect

* parse all HTTP headers

* minor - rename constant for clarity

* rename idx and idx2 for code readability

* limit response header field count

* flush not needed, replace with descriptive err msg

* bump MQTT-C

* Blocking publish and inflight MQTT-C buffer growth

* update obsolete comment

* add missing unlock in error case

* fix EINTR

* initial MQTT 5 implementation

Implements minimal MQTT 5 features. Up to QoS1

* fixes for bugs in initial MQTT5 implementation

* initial statistics support

* fix vbi parser

* initial base http proxy auth support

* fix base64 helper for longer credentials

* minor - create with single allocation

* allow defining custom alloc functions for user

* Allow custom memory fncs and macros by user (#5)

* update crbuf module
* allow custom malloc, free, strdup, calloc ...

* use long long for till_next_keep_alive

* dont send PUBACK on QOS0 (#6)

* fix publish parser (#7)

* mark QoS0 as GC on send (#8)

* log extra info in case of OpenSSL error (#9)

* log extra info in case of SSL error

* fix build error with older SSL (#10)

* adds possibility to decrypt traffic with wireshark for debugging (#13)

* initial commit

* add fncs key:uint64 and data:opaque ptr

* add uint64_t key iterator

* add github test runner

* start working on proper tests

* Initial support for topic aliases (#12)

Add support for topic alias functionality for PUBLISH packets
also adds support for parsing all MQTT properties as opposed to just skipping and ignoring them (what we did previously)

* implement c_rhash_iter_str_keys + tests

* Fixes of Topic Alias implementation (#14)

* initial removal of mqtt-c support (#15)

* honor max msglen for server (#19)

* Update README.md (#20)

* memory align fragments (#21)

* Remove mqtt_websocket submodule

* Remove c-rbuf and c_rhash submodules

* Exclude mqtt_websockets from Codacy

It seems that it was excluded before merging
the mqtt_websockets submodule.

---------

Co-authored-by: Timotej Šiškovič <timotejs@gmail.com>
Co-authored-by: Timotej S <6674623+underhood@users.noreply.github.com>
Co-authored-by: Emmanuel Vasilakis <mrzammler@mm.st>
thiagoftsm pushed a commit that referenced this issue May 14, 2024
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2.3.1 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v2.3.1...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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 a pull request may close this issue.

3 participants