bparli / fastping-rs

ICMP ping library in Rust inspired by go-fastping and AnyEvent::FastPing Perl module
MIT License
78 stars 12 forks source link

Allow adjusting pnet transport_channel buffer sizes #31

Closed djahandarie closed 2 years ago

djahandarie commented 2 years ago

When using fastping-rs with a high number of targets (10k+), the hard-coded transport_channel buffer sizes are too small and one hits the following issue:

 ERROR fastping_rs::ping > Failed to send ping to 208.127.100.128: No buffer space available (os error 105)
 ERROR fastping_rs::ping > Failed to send ping to 208.127.100.157: No buffer space available (os error 105)
 ERROR fastping_rs::ping > Failed to send ping to 208.127.100.161: No buffer space available (os error 105)
 ERROR fastping_rs::ping > Failed to send ping to 208.127.101.128: No buffer space available (os error 105)
 ERROR fastping_rs::ping > Failed to send ping to 208.127.101.142: No buffer space available (os error 105)
 ERROR fastping_rs::ping > Failed to send ping to 208.127.101.155: No buffer space available (os error 105)
 ERROR fastping_rs::ping > Failed to send ping to 208.127.101.157: No buffer space available (os error 105)
 ERROR fastping_rs::ping > Failed to send ping to 208.127.117.131: No buffer space available (os error 105)
 ERROR fastping_rs::ping > Failed to send ping to 208.127.124.241: No buffer space available (os error 105)

Ideally this would be configurable: https://github.com/bparli/fastping-rs/blob/be5ed3ad5a07fd2490b2d15239d2720349e761c3/src/lib.rs#L82

djahandarie commented 2 years ago

My mistake, this was actually an OS-level issue.

Resolved by

sysctl -w net.core.wmem_default=4194304

(That's 4MiB, for my payload, the lowest power of two that worked).

Closing this issue, but feel free to reopen/rename if you want to make fastping-rs back off of OS buffers (dunno if that is desired behavior or not).