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

Segmentation fault #300

Closed
1 task done
omarandlorraine opened this issue Jul 5, 2023 · 14 comments
Closed
1 task done

Segmentation fault #300

omarandlorraine opened this issue Jul 5, 2023 · 14 comments
Labels
bug Something isn't working Linux Something related to Linux operating system renderer Problem related to the renderer used by the GUI library

Comments

@omarandlorraine
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

What's the problem?

I am experiencing a segmentation fault shortly after the application starts.

The big window opens, and then a fraction of a second later, I get the segmentation fault.

If I run strace sniffnet:

uname({sysname="Linux", nodename="debian", ...}) = 0
openat(AT_FDCWD, "/dev", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=3720, ...}) = 0
getdents64(3, 0x556f1be004b0 /* 186 entries */, 32768) = 5376
getdents64(3, 0x556f1be004b0 /* 0 entries */, 32768) = 0
close(3)                                = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER) = 3
close(3)                                = 0
write(10, "\1\0\0\0\0\0\0\0", 8)        = 8
write(12, "\1\0\0\0\0\0\0\0", 8)        = 8
futex(0x556f1bdba794, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x556f1bdba740, FUTEX_WAKE_PRIVATE, 1) = 1
clock_nanosleep(CLOCK_MONOTONIC, 0, {tv_sec=0, tv_nsec=100000},  <unfinished ...>
+++ killed by SIGSEGV +++
Segmentation fault

If I'm reading this right, the segfault is happening inside clock_nanosleep 🤔

How did you install the app?

installed from crates.io

Operating System

Linux

Additional context

I'm running debian bullseye which is oldstable.

While installing, (cargo install sniffnet), I had to sudo apt install libasound2-dev libfontconfig-dev for the build to complete.

@GyulyVGC
Copy link
Owner

GyulyVGC commented Jul 5, 2023

Could you also post the output after simply running sniffnet?

@omarandlorraine
Copy link
Author

Could you also post the output after simply running sniffnet?

$ sniffnet

  /---------------------------------------------------------\
 |     _____           _    __    __                  _      |
 |    / ____|         (_)  / _|  / _|                | |     |
 |   | (___    _ __    _  | |_  | |_   _ __     ___  | |_    |
 |    \___ \  | '_ \  | | |  _| |  _| | '_ \   / _ \ | __|   |
 |    ____) | | | | | | | | |   | |   | | | | |  __/ | |_    |
 |   |_____/  |_| |_| |_| |_|   |_|   |_| |_|  \___|  \__|   |
 |                                                           |
 |                   ___________                             |
 |                  /___________\                            |
 |                 | ___________ |                           |
 |                 | |         | |                           |
 |                 | | v1.2.1  | |                           |
 |                 | |_________| |________________________   |
 |                 \_____________/   by Giuliano Bellini  )  |
 |                 / ''''''''''' \                       /   |
 |                / ::::::::::::: \                  =D-'    |
 |               (_________________)                         |
  \_________________________________________________________/
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
Segmentation fault

@GyulyVGC
Copy link
Owner

GyulyVGC commented Jul 5, 2023

I think the problem is with your graphical adapter.
The library I use for the GUI uses wgpu as default graphical renderer, but sometimes it may be incompatible.
I think you'll likely solve this problem by building the app from the glow-renderer branch, which uses an alternative graphical renderer.

@GyulyVGC GyulyVGC added bug Something isn't working renderer Problem related to the renderer used by the GUI library labels Jul 6, 2023
@GyulyVGC
Copy link
Owner

GyulyVGC commented Jul 8, 2023

News?
Are you able to build from the branch I mentioned?
Do you prefer being provided a ready made deb/rpm package?

@omarandlorraine
Copy link
Author

Apologies, I hope to get back to you on Monday or Tuesday

@omarandlorraine
Copy link
Author

Apologies for late reply,

I built sniffnet on the glow-renderer branch, and there's progress. But the program still does not start. Here's the backtrace:

$ RUST_BACKTRACE=1 cargo run   
warning: unused manifest key: target.cfg(windows).rustflags
    Finished dev [unoptimized + debuginfo] target(s) in 0.43s
     Running `target/debug/sniffnet`

  /---------------------------------------------------------\
 |     _____           _    __    __                  _      |
 |    / ____|         (_)  / _|  / _|                | |     |
 |   | (___    _ __    _  | |_  | |_   _ __     ___  | |_    |
 |    \___ \  | '_ \  | | |  _| |  _| | '_ \   / _ \ | __|   |
 |    ____) | | | | | | | | |   | |   | | | | |  __/ | |_    |
 |   |_____/  |_| |_| |_| |_|   |_|   |_| |_|  \___|  \__|   |
 |                                                           |
 |                   ___________                             |
 |                  /___________\                            |
 |                 | ___________ |                           |
 |                 | |         | |                           |
 |                 | | v1.2.1  | |                           |
 |                 | |_________| |________________________   |
 |                 \_____________/   by Giuliano Bellini  )  |
 |                 / ''''''''''' \                       /   |
 |                / ::::::::::::: \                  =D-'    |
 |               (_________________)                         |
  \_________________________________________________________/
Xlib: sequence lost (0x10083 > 0x85) in reply type 0x0!
Xlib: sequence lost (0x10088 > 0x8a) in reply type 0x0!
Xlib: sequence lost (0x1008d > 0x8f) in reply type 0x0!
Xlib: sequence lost (0x10092 > 0x94) in reply type 0x0!
Xlib: sequence lost (0x10097 > 0x99) in reply type 0x0!
thread 'main' panicked at '0:23(17): error: no function with name 'texture'
', /home/sam/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_glow-0.8.0/src/program.rs:77:17
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/panicking.rs:64:14
   2: core::panicking::panic_display
             at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/panicking.rs:147:5
   3: iced_glow::program::Shader::compile
             at /home/sam/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_glow-0.8.0/src/program.rs:77:17
   4: iced_glow::program::Shader::fragment
             at /home/sam/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_glow-0.8.0/src/program.rs:103:9
   5: iced_glow::image::Pipeline::new
             at /home/sam/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_glow-0.8.0/src/image.rs:51:35
   6: iced_glow::backend::Backend::new
             at /home/sam/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_glow-0.8.0/src/backend.rs:40:30
   7: <iced_glow::window::compositor::Compositor<Theme> as iced_graphics::window::gl_compositor::GLCompositor>::new
             at /home/sam/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_glow-0.8.0/src/window/compositor.rs:53:38
   8: iced_glutin::application::run
             at /home/sam/.cargo/registry/src/github.com-1ecc6299db9ec823/iced_glutin-0.8.0/src/application.rs:130:9
   9: iced::application::Application::run
             at /home/sam/.cargo/registry/src/github.com-1ecc6299db9ec823/iced-0.9.0/src/application.rs:209:12
  10: sniffnet::main
             at ./src/main.rs:100:5
  11: core::ops::function::FnOnce::call_once
             at /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I suppose this is a separate issue though? What do you think?

Do you prefer being provided a ready made deb/rpm package?
I have no preference really; I can easily do building from source if it saves you a job.

@GyulyVGC
Copy link
Owner

The problem is still related to Iced and I wouldn't be surprised if it's again the renderer, even if in other circumstances problems were solved by glow.

I think the best thing to do is waiting that Iced releases the new version (should happen shortly).
They are releasing a new software renderer and I hope this solves the problem.

In the meantime, if you are interested in troubleshooting, you could run Iced examples from their repo to see if they work.
If they work on the master branch but not on the 0.9 release, then the new software renderer will be the solution.

@omarandlorraine
Copy link
Author

In the meantime, if you are interested in troubleshooting, you could run Iced examples from their repo to see if they work. If they work on the master branch but not on the 0.9 release, then the new software renderer will be the solution.

Thanks for that advice!

For me, the iced examples do not work on the master branch, so I guess the bug is with them.

@GyulyVGC
Copy link
Owner

Damn... this means that your system is incompatible with wgpu, glow, and the new software renderer..

Or maybe there is another problem with Iced I'm not aware of.

I doubt it could be related to the fact that you are running from oldstable.

Thanks for having tried anyway!

@GyulyVGC GyulyVGC added the Linux Something related to Linux operating system label Jul 22, 2023
@GyulyVGC
Copy link
Owner

GyulyVGC commented Aug 8, 2023

A new release of Sniffnet has been published today.
By default, it still uses wgpu but should fall back to the new software renderer if wgpu crashes.

However, since the master branch of iced didn't work for you, I also provide you a link to a Sniffnet version that uses directly the new renderer (tiny-skia): https://github.com/GyulyVGC/sniffnet/suites/14909529200/artifacts/849640693

Please let me know if at least one between the artifact from the release page or from this link work @omarandlorraine

@joshuamegnauth54
Copy link
Contributor

joshuamegnauth54 commented Sep 6, 2023

I recently found out (as in five minutes ago) that iced has a backend environmental variable which makes it really easy to use Tiny Skia.

Instead of this branch, users can launch Sniffnet with ICED_BACKEND=tiny-skia. I'm not sure if this is still relevant with the new fallback feature, but it might be useful information anyway.

I'm working on a small bug fix for iced where I've been recompiling it with default-features=false each time to test Tiny Skia. It turns out I didn't have have to do that, oops. Iced's maintainer mentions the env var there.

@GyulyVGC
Copy link
Owner

GyulyVGC commented Sep 9, 2023

Thanks for pointing out.
I could add info about this in the README maybe.
However, I still plan to leave that branch because binaries built against it are also distributed for people to avoid them to set the env var.
And yes, it's still relevant even if the fallback feature exists: sometimes wgpu doesn't crash but it has glitches and those are not detected and therefor fallback doesn't always occur when it should (only in case of crash).

@omarandlorraine
Copy link
Author

For unrelated reasons, I have upgraded to Debian 12.1, which is bookworm. Well, I have retried iced's master branch examples, and they run just fine.

A new release of Sniffnet has been published today.

I installed this from Cargo (needed to sudo apt install libpcap-dev libasound2-dev first!) and it solved my problem as well. So I guess I'll close this issue. It must have been the oldstable at fault, but I am no longer able to pinpoint why that would be.

@GyulyVGC
Copy link
Owner

That's amazing, thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Linux Something related to Linux operating system renderer Problem related to the renderer used by the GUI library
Projects
None yet
Development

No branches or pull requests

3 participants