sniffnet icon indicating copy to clipboard operation
sniffnet copied to clipboard

Sniffnet 1.3.2 crashes with error: `user-provided comparison function does not correctly implement a total order`

Open koshikas opened this issue 1 year ago โ€ข 19 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

What's the problem?

Sniffnet 1.3.2 crashes after selecting the network adapter and starting the analysis, the application crashes. i get following stack trace;

thread 'main' panicked at core/src/slice/sort/shared/smallsort.rs:865:5: user-provided comparison function does not correctly implement a total order stack backtrace: 0: 0x5f7b55bb4af9 - 1: 0x5f7b55511183 - 2: 0x5f7b55b7f302 - 3: 0x5f7b55bb9f32 - 4: 0x5f7b55bb9c7b - 5: 0x5f7b55bb99cf - 6: 0x5f7b55a5d001 - 7: 0x5f7b55bba1f9 - 8: 0x5f7b55bb9fd5 - 9: 0x5f7b55bb9f69 - 10: 0x5f7b55bb9f5c - 11: 0x5f7b553cf0ff - 12: 0x5f7b553cf77a - 13: 0x5f7b555b150f - 14: 0x5f7b555b37ff - 15: 0x5f7b555b2fc0 - 16: 0x5f7b555b2fc0 - 17: 0x5f7b555b26f4 - 18: 0x5f7b55b487fe - 19: 0x5f7b5542d8fb - 20: 0x5f7b554399da - 21: 0x5f7b55b5787a - 22: 0x5f7b55ada978 - 23: 0x5f7b554379f4 - 24: 0x5f7b55a5ab86 - 25: 0x5f7b5544c386 - 26: 0x5f7b55a5840e - 27: 0x794584f2ce08 - 28: 0x794584f2cecc - __libc_start_main 29: 0x5f7b554250d5 - 30: 0x0 -

after downgrading to Sniffnet 1.3.1, everything works as it should.

How did you install the app?

downloaded one of the provided packages

Operating System

Linux

Additional context

System: Kernel: 6.12.8-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 14.2.1 clocksource: tsc avail: hpet,acpi_pm parameters: BOOT_IMAGE=/boot/vmlinuz-6.12-x86_64 root=UUID=e0d878c7-******* rw lsm=landlock,lockdown,yama,apparmor,bpf quiet rd.udev.log_level=3 i915.fastboot=1 audit=0 ipv6.disable=1 i8042.nomux=1 nowatchdog Desktop: KDE Plasma v: 6.2.5 tk: Qt v: N/A info: frameworks v: 6.9.0 wm: kwin_x11 tools: avail: xtrlock vt: 2 dm: SDDM Distro: Manjaro base: Arch Linux Machine: Type: Portable System: Dell product: Inspiron 5520 v: A14 serial: Chassis: type: 8 v: A14 serial: Mobo: Dell model: 0XWH1P v: A00 serial: CPU: Info: model: Intel Core i7-3612QM bits: 64 type: MT MCP arch: Ivy Bridge gen: core 3 level: v2 built: 2012-15 process: Intel 22nm family: 6 model-id: 0x3A (58) stepping: 9 microcode: 0x21 Topology: cpus: 1x dies: 1 clusters: 4 cores: 4 threads: 8 tpc: 2 smt: enabled cache: L1: 256 KiB desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB L3: 6 MiB desc: 1x6 MiB Speed (MHz): avg: 1200 min/max: 1200/2100 scaling: driver: intel_cpufreq governor: schedutil cores: 1: 1200 2: 1200 3: 1200 4: 1200 5: 1200 6: 1200 7: 1200 8: 1200 bogomips: 33536 Flags: avx ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx Graphics: Device-1: Intel 3rd Gen Core processor Graphics vendor: Dell driver: i915 v: kernel arch: Gen-7 process: Intel 22nm built: 2012-13 ports: active: LVDS-1 empty: DP-1,HDMI-A-1,VGA-1 bus-ID: 00:02.0 chip-ID: 8086:0166 class-ID: 0300 Device-2: Advanced Micro Devices [AMD/ATI] Thames [Radeon HD 7500M/7600M Series] vendor: Dell driver: radeon v: kernel alternate: amdgpu arch: TeraScale-2 code: Evergreen process: TSMC 32-40nm built: 2009-15 pcie: gen: 1 speed: 2.5 GT/s lanes: 8 link-max: gen: 2 speed: 5 GT/s lanes: 16 bus-ID: 01:00.0 chip-ID: 1002:6840 class-ID: 0300 temp: 48.0 C Device-3: Microdia Laptop_Integrated_Webcam_HD driver: uvcvideo type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 4-1.5:7 chip-ID: 0c45:644a class-ID: 0e02 Display: x11 server: X.Org v: 21.1.15 with: Xwayland v: 24.1.4 compositor: kwin_x11 driver: X: loaded: intel,radeon unloaded: modesetting alternate: fbdev,vesa dri: i965,r600 gpu: i915 display-ID: :0 screens: 1 Screen-1: 0 s-res: 1366x768 s-dpi: 96 s-size: 361x203mm (14.21x7.99") s-diag: 414mm (16.31") Monitor-1: LVDS-1 mapped: LVDS1 model: LG Display 0x033a built: 2012 res: 1366x768 hz: 60 dpi: 102 gamma: 1.2 size: 340x190mm (13.39x7.48") diag: 395mm (15.5") ratio: 16:9 modes: 1366x768 API: EGL v: 1.5 hw: drv: intel crocus drv: amd r600 platforms: device: 0 drv: crocus device: 1 drv: r600 device: 2 drv: swrast gbm: drv: crocus surfaceless: drv: crocus x11: drv: crocus inactive: wayland API: OpenGL v: 4.5 compat-v: 4.2 vendor: intel mesa v: 24.2.7-arch1.1 glx-v: 1.4 direct-render: yes renderer: Mesa Intel HD Graphics 4000 (IVB GT2) device-ID: 8086:0166 memory: 1.46 GiB unified: yes API: Vulkan v: 1.4.303 layers: N/A device: 0 type: integrated-gpu name: Intel HD Graphics 4000 (IVB GT2) driver: N/A device-ID: 8086:0166 surfaces: xcb,xlib Audio: Device-1: Intel 7 Series/C216 Family High Definition Audio vendor: Dell driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:1e20 class-ID: 0403 API: ALSA v: k6.12.8-1-MANJARO status: kernel-api with: aoss type: oss-emulator tools: alsactl,alsamixer,amixer Server-1: PipeWire v: 1.2.7 status: active with: 1: pipewire-pulse status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl Network: Device-1: Realtek RTL810xE PCI Express Fast Ethernet vendor: Dell driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: 2000 bus-ID: 07:00.0 chip-ID: 10ec:8136 class-ID: 0200 IF: enp7s0 state: down mac: Device-2: Intel Centrino Wireless-N 2230 driver: iwlwifi v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 bus-ID: 08:00.0 chip-ID: 8086:0887 class-ID: 0280 IF: wlp8s0 state: up mac: Info: services: NetworkManager, sshd, systemd-timesyncd, wpa_supplicant Bluetooth: Device-1: Intel Centrino Bluetooth Wireless Transceiver driver: btusb v: 0.8 type: USB rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 2-1.5:3 chip-ID: 8087:07da class-ID: e001 Report: btmgmt ID: hci0 rfk-id: 1 state: down bt-service: enabled,running rfk-block: hardware: no software: yes address: bt-v: 4.0 lmp-v: 6 status: discoverable: no pairing: no Info: Memory: total: 8 GiB available: 7.63 GiB used: 3.23 GiB (42.3%) Processes: 244 Power: uptime: 2h 14m states: freeze,mem,disk suspend: deep avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot, suspend, test_resume image: 3.03 GiB services: org_kde_powerdevil, thermald, upowerd Init: systemd v: 257 default: graphical tool: systemctl Packages: pm: pacman pkgs: 1812 libs: 387 tools: octopi,pamac,yay Compilers: gcc: 14.2.1 Shell: Bash v: 5.2.37 running-in: konsole inxi: 3.3.36

koshikas avatar Jan 08 '25 09:01 koshikas

It seems something related to Rust 1.81 new sorting implementations.

Unfortunately I'm not able to reproduce this on any of my machines, but I'll try to find a fix.

GyulyVGC avatar Jan 08 '25 11:01 GyulyVGC

It seems something related to Rust 1.81 new sorting implementations.

Unfortunately I'm not able to reproduce this on any of my machines, but I'll try to find a fix.

no issues, i've reverted to 1.3.1, and it is functioning fine. let me know if i can help with more debugging from my end.

Thanks!

koshikas avatar Jan 08 '25 11:01 koshikas

Yes, I'll need your help to test once I come up with a potential fix.

Thanks very much ๐Ÿ‘

GyulyVGC avatar Jan 08 '25 12:01 GyulyVGC

Same thing experienced on my system, FWIW.

Because of issue #635 I launched sniffnet as:

ICED_BACKEND=tiny-skia sniffnet

and then it failed with

thread 'main' panicked at core/src/slice/sort/shared/smallsort.rs:865:5:
user-provided comparison function does not correctly implement a total order

as per above.

My OS is Pop!_OS 22.04.

v1.3.1 doesn't experience the error.

neogeographica avatar Feb 04 '25 04:02 neogeographica

Hey guys when does this error happen? In which screen of the application?

I'm asking this to understand where is the comparison function to fix.

GyulyVGC avatar Feb 04 '25 07:02 GyulyVGC

As soon as it launches and tries to create a GUI window. I don't remember seeing much of what that window was supposed to be, but judging from the behavior of 1.3.1 when it launches, it's either an initial "no traffic has been detect yet" message or else the Overview window for the main/default adapter.

neogeographica avatar Feb 04 '25 07:02 neogeographica

Oh ok, if it's happening before you see anything, then it is the page where you have to select network adapters an filters.

GyulyVGC avatar Feb 04 '25 07:02 GyulyVGC

This is even more strange now as @koshikas is having this issue in the overview page instead.

GyulyVGC avatar Feb 04 '25 07:02 GyulyVGC

As mentioned above it could well be the overview page since that seems to be the first page it launches into. It doesn't explicitly ask me to choose an adapter first. The "no traffic yet" message displays for a split second then it goes straight to overview.

neogeographica avatar Feb 04 '25 07:02 neogeographica

Oh ok sorry there was a misunderstanding. I thought it was happening as soon as you started the app.

Ok so the problem is in the overview page for you as well. I'm guessing it's because of the way hosts are being sorted. I'll check again for possible fixes, and I hope to find an OS where I'm able to replicate the issue.

GyulyVGC avatar Feb 04 '25 07:02 GyulyVGC

I've built a new binary for you guys to test, find the links here (at the bottom of the page).

This is using the latest dependencies and Rust version. I didn't change sort strategy since it already seems correct to me, I hope this was a problem solved with the newest Rust release.


For reference this is the piece of code used to sort items:

pub fn compare(&self, other: &Self, sort_type: SortType, chart_type: ChartType) -> Ordering {
    match chart_type {                                                                       
        ChartType::Packets => match sort_type {                                              
            SortType::Ascending => self.tot_packets().cmp(&other.tot_packets()),             
            SortType::Descending => other.tot_packets().cmp(&self.tot_packets()),            
            SortType::Neutral => other.final_timestamp.cmp(&self.final_timestamp),           
        },                                                                                   
        ChartType::Bytes => match sort_type {                                                
            SortType::Ascending => self.tot_bytes().cmp(&other.tot_bytes()),                 
            SortType::Descending => other.tot_bytes().cmp(&self.tot_bytes()),                
            SortType::Neutral => other.final_timestamp.cmp(&self.final_timestamp),           
        },                                                                                   
    }                                                                                        
}                                                                                            

As you can see I'm using cmp which implements total ordering, so I can't seem to find the root of the issue.

GyulyVGC avatar Feb 04 '25 09:02 GyulyVGC

I've built a new binary for you guys to test, find the links here (at the bottom of the page).

just tried small issue on archlinux we are running libpcap 1.10.5. and the build you provided seems to be looking for libpcap 0.8.x. is there any way get libpcap further upstream to build at your end

error i get with your build; ./sniffnet: error while loading shared libraries: libpcap.so.0.8: cannot open shared object file: No such file or directory

koshikas avatar Feb 04 '25 10:02 koshikas

Unfortunately the package I build aren't for Arch Linux. However you can try checking the required dependencies, but not sure it'll work on Arch since there you have to install via pacman.

GyulyVGC avatar Feb 04 '25 10:02 GyulyVGC

Unfortunately the package I build aren't for Arch Linux. However you can try checking the required dependencies, but not sure it'll work on Arch since there you have to install via pacman.

not a issue let me try compile libpcap myself, can yo confirm me the exect version of libpcap required here

koshikas avatar Feb 04 '25 10:02 koshikas

libpcap0.8

GyulyVGC avatar Feb 04 '25 10:02 GyulyVGC

libpcap0.8

sorry i'm running into issues building that old of libcap build, all its dependecies have moved on since (sh of all things)

koshikas avatar Feb 04 '25 10:02 koshikas

Same issue for me, with that build.

It is definitely on the overview page, after getting past the "No traffic has been observed yet" message.

edit: Not a Rust-knower myself, but perhaps the match statements need default match-everything-else patterns to satisfy the analysis?

neogeographica avatar Feb 04 '25 18:02 neogeographica

In this case it's not needed since I'm just matching against all the variants of an enum. So there are no other cases possible.

GyulyVGC avatar Feb 04 '25 19:02 GyulyVGC

Today I've found out that this might be due to https://github.com/iced-rs/iced/issues/2650, which was already fixed in https://github.com/iced-rs/iced/pull/2651.

As soon as Iced gets updated I will provide you guys a new binary so that we can verify if the problem is solved.

GyulyVGC avatar Mar 23 '25 14:03 GyulyVGC

I can reproduce this:

thread 'main' panicked at library/core/src/slice/sort/shared/smallsort.rs:860:5: user-provided comparison function does not correctly implement a total order note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

nemoralis avatar Jul 05 '25 11:07 nemoralis

I'm seeing similar with the latest docker container on Ubuntu 22.04 host and starting with the example Wayland instructions.

$ docker run -it   --net=host   -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY   -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY   -e XDG_RUNTIME_DIR=/tmp   -e RUST_BACKTRACE=full   -e ICED_BACKEND=tiny-skia   --cap-add=NET_ADMIN   --cap-add=NET_RAW   ghcr.io/gyulyvgc/sniffnet:latest

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                                    โ”‚
โ”‚                           Sniffnet 1.4.0                           โ”‚
โ”‚                                                                    โ”‚
โ”‚           โ†’ Website: https://sniffnet.net                          โ”‚
โ”‚           โ†’ GitHub:  https://github.com/GyulyVGC/sniffnet          โ”‚
โ”‚                                                                    โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ


thread 'main' panicked at library/core/src/slice/sort/shared/smallsort.rs:860:5:
user-provided comparison function does not correctly implement a total order
stack backtrace:
   0:     0x5a9e20a9d786 - <unknown>
   1:     0x5a9e20250dc3 - <unknown>
   2:     0x5a9e20a9d1af - <unknown>
   3:     0x5a9e20a9d4c3 - <unknown>
   4:     0x5a9e20a9ce8e - <unknown>
   5:     0x5a9e20ad8da5 - <unknown>
   6:     0x5a9e20ad8d39 - <unknown>
   7:     0x5a9e20ad982c - <unknown>
   8:     0x5a9e2011f7af - <unknown>
   9:     0x5a9e2011ff0a - <unknown>
  10:     0x5a9e2039b0e5 - <unknown>
  11:     0x5a9e20393393 - <unknown>
  12:     0x5a9e20392def - <unknown>
  13:     0x5a9e20392def - <unknown>
  14:     0x5a9e2039c104 - <unknown>
  15:     0x5a9e209a1fbb - <unknown>
  16:     0x5a9e2018cb70 - <unknown>
  17:     0x5a9e201993dd - <unknown>
  18:     0x5a9e209b558d - <unknown>
  19:     0x5a9e20a18ff2 - <unknown>
  20:     0x5a9e20197f7b - <unknown>
  21:     0x5a9e2096a70e - <unknown>
  22:     0x5a9e20a038d3 - <unknown>
  23:     0x5a9e20967d3d - <unknown>
  24:     0x7150823fe24a - <unknown>
  25:     0x7150823fe305 - __libc_start_main
  26:     0x5a9e2017b3b1 - <unknown>
  27:                0x0 - <unknown>
$ 

Appears to fail after selecting an interface showing the overview page, time to failure varies, have seen it when trying to return from fingernail mode.

hardillb avatar Jul 06 '25 13:07 hardillb

installed with pacman -S sniffnet on arch sniffnet GUI opens I click start button โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ โ”‚ Sniffnet 1.4.0 โ”‚ โ”‚ โ”‚ โ”‚ โ†’ Website: https://sniffnet.net โ”‚ โ”‚ โ†’ GitHub: https://github.com/GyulyVGC/sniffnet โ”‚ โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete

thread 'main' panicked at library/core/src/slice/sort/shared/smallsort.rs:860:5: user-provided comparison function does not correctly implement a total order note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

giri256 avatar Aug 21 '25 20:08 giri256

small update, based on the comment above, i have a feeling this has some thing to do with the graphics stack.

i have 2 laptops both running archlinux. the one having AMD GPU runs sniffnet 11.4.0 with no issues. it is the one with Ivy bridge (intel 3rd gen CPU) with integrated graphics that i get the same error.

koshikas avatar Aug 22 '25 08:08 koshikas

Yes, I'm also pretty sure it has to do with the graphics stack, particularly I believe this is related with iced as I mentioned:

Today I've found out that this might be due to iced-rs/iced#2650, which was already fixed in iced-rs/iced#2651.

As soon as Iced gets updated I will provide you guys a new binary so that we can verify if the problem is solved.

I hope for a new version of the library coming soon from them

GyulyVGC avatar Aug 22 '25 08:08 GyulyVGC

Hey guys, I'm migrating (#1032) to the new version of Iced that possibly fixed this issue. I need your help to verify that the problem is gone.

Here you can find the packages built on top of #1032.

@neogeographica tagging you since you were the only one that was able to download and test a DEB package from my workflows I think.

GyulyVGC avatar Dec 23 '25 16:12 GyulyVGC

@GyulyVGC that does seem to fix things... I can launch and use it without any issues now.

Also it looks like I no longer need to use this: ICED_BACKEND=tiny-skia

neogeographica avatar Dec 23 '25 17:12 neogeographica

Awesome ๐Ÿคฉ

This means that Sniffnet v1.5.0 will finally fix this issue!

Thanks for the confirmation.

GyulyVGC avatar Dec 23 '25 21:12 GyulyVGC

Hey guys, I'm migrating (#1032) to the new version of Iced that possibly fixed this issue. I need your help to verify that the problem is gone.

Verified issue is resolved with amd64 AppImage for following environment:

Void Linux wayland GNOME DE Intelยฎ UHD Graphics 620 (KBL GT2)

sysfu avatar Jan 01 '26 18:01 sysfu

Finally! ๐ŸŽ‰

GyulyVGC avatar Jan 01 '26 20:01 GyulyVGC