valpackett / systemstat

Rust library for getting system information | also on https://codeberg.org/valpackett/systemstat
https://crates.io/crates/systemstat
The Unlicense
610 stars 71 forks source link

Invoking networks() results in STATUS_ACCESS_VIOLATION #95

Closed Snazzie closed 1 year ago

Snazzie commented 2 years ago
fn main() {
   let sys_stat = systemstat::System::new();
   do_something(&sys_stat);
}

fn do_something(sys_stat: &systemstat::System) {
    let net = sys_stat.networks(); // crash (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
}

platform: windows 11 version: 0.1.10

valpackett commented 1 year ago

In the current version, networks do work for me on Windows 11.

Snazzie commented 1 year ago

Just tested again, it doesnt for me 🤷 this time with 0.1.11

https://github.com/Snazzie/systemstat-access-violation-bug

George-Strike commented 1 year ago

I'm getting the same issue. (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

valpackett commented 1 year ago

I guess this only happens when there are enough network adapters to trigger it. I think I see the bug from a quick look at the code, can someone test db66afe0fd804?

Snazzie commented 1 year ago

@unrelentingtech yes, that fixed it 🎊 . I have 14 adapters on my machine (loads of virtual ones)