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

segfault on macos #137

Closed
blinsay opened this issue Apr 13, 2023 · 7 comments
Closed

segfault on macos #137

blinsay opened this issue Apr 13, 2023 · 7 comments
Labels
duplicate This issue or pull request already exists macOS Something related to macOS operating system renderer Problem related to the renderer used by the GUI library
Milestone

Comments

@blinsay
Copy link

blinsay commented Apr 13, 2023

Describe the bug

I just learned about sniffnet through the accelerator program (congrats!) and tried installing it on macos through homebrew and Cargo. I get a segfault after the welcome banner. Happy to help diagnose more if you let me know what is useful to look at.

To Reproduce

$ sniffnet

  /---------------------------------------------------------\
 |     _____           _    __    __                  _      |
 |    / ____|         (_)  / _|  / _|                | |     |
 |   | (___    _ __    _  | |_  | |_   _ __     ___  | |_    |
 |    \___ \  | '_ \  | | |  _| |  _| | '_ \   / _ \ | __|   |
 |    ____) | | | | | | | | |   | |   | | | | |  __/ | |_    |
 |   |_____/  |_| |_| |_| |_|   |_|   |_| |_|  \___|  \__|   |
 |                                                           |
 |                   ___________                             |
 |                  /___________\                            |
 |                 | ___________ |                           |
 |                 | |         | |                           |
 |                 | | v1.1.2  | |                           |
 |                 | |_________| |________________________   |
 |                 \_____________/   by Giuliano Bellini  )  |
 |                 / ''''''''''' \                       /   |
 |                / ::::::::::::: \                  =D-'    |
 |               (_________________)                         |
  \_________________________________________________________/
[1]    13150 segmentation fault  sniffnet
$ brew info sniffnet
==> sniffnet: stable 1.1.2 (bottled), HEAD
Cross-platform application to monitor your network traffic
https://github.com/GyulyVGC/sniffnet
/opt/homebrew/Cellar/sniffnet/1.1.2 (9 files, 11.7MB) *
  Poured from bottle using the formulae.brew.sh API on 2023-04-13 at 00:52:28
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/sniffnet.rb
License: Apache-2.0 or MIT

Desktop (please complete the following information):

$ sw_vers
ProductName:		macOS
ProductVersion:		13.3.1
BuildVersion:		22E261
@GyulyVGC
Copy link
Owner

I think this is a duplicate of #109.
It's weird tho because in that case only Homebrew installation was affected.
However, as I mentioned in #109, the problem will hopefully be solved with the next release of iced.

@GyulyVGC GyulyVGC added the bug Something isn't working label Apr 13, 2023
@GyulyVGC
Copy link
Owner

Are you sure you launched sniffnet also from the cargo binary?

@blinsay
Copy link
Author

blinsay commented Apr 13, 2023

I get the segfault with cargo install and if I build from source in release mode. If I build in debug mode I don't hit it.

I tried a build in release mode with debug symbols and got a backtrace:

diff --git a/Cargo.toml b/Cargo.toml
index 9f78094..3ff104f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ icon = ["./resources/logos/icon.ico"]
 [profile.release]
 opt-level = 3
 lto = true
-strip = true
+debug = true


 [dependencies]
(lldb) run
Process 21206 launched: '/Users/benl/src/sniffnet/target/release/sniffnet' (arm64)

  /---------------------------------------------------------\
 |     _____           _    __    __                  _      |
 |    / ____|         (_)  / _|  / _|                | |     |
 |   | (___    _ __    _  | |_  | |_   _ __     ___  | |_    |
 |    \___ \  | '_ \  | | |  _| |  _| | '_ \   / _ \ | __|   |
 |    ____) | | | | | | | | |   | |   | | | | |  __/ | |_    |
 |   |_____/  |_| |_| |_| |_|   |_|   |_| |_|  \___|  \__|   |
 |                                                           |
 |                   ___________                             |
 |                  /___________\                            |
 |                 | ___________ |                           |
 |                 | |         | |                           |
 |                 | | v1.1.3  | |                           |
 |                 | |_________| |________________________   |
 |                 \_____________/   by Giuliano Bellini  )  |
 |                 / ''''''''''' \                       /   |
 |                / ::::::::::::: \                  =D-'    |
 |               (_________________)                         |
  \_________________________________________________________/
Process 21206 stopped
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3)
    frame #0: 0x000000019e63285c libsystem_platform.dylib`_platform_memmove + 444
libsystem_platform.dylib`:
->  0x19e63285c <+444>: ldrb   w6, [x1], #0x1
    0x19e632860 <+448>: strb   w6, [x3], #0x1
    0x19e632864 <+452>: subs   x2, x2, #0x1
    0x19e632868 <+456>: b.ne   0x19e63285c               ; <+444>
Target 0: (sniffnet) stopped.
(lldb) bt
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3)
  * frame #0: 0x000000019e63285c libsystem_platform.dylib`_platform_memmove + 444
    frame #1: 0x00000001003c8c88 sniffnet`_$LT$$RF$mut$u20$W$u20$as$u20$core..fmt..Write$GT$::write_str::heabd73f5f238cf2f + 68
    frame #2: 0x0000000100046eec sniffnet`core::fmt::write::hb60cc483d75d6594 + 412
    frame #3: 0x00000001003c8bf0 sniffnet`_$LT$std..panicking..begin_panic_handler..PanicPayload$u20$as$u20$core..panic..BoxMeUp$GT$::get::h18b263a946b91ce7 + 84
    frame #4: 0x00000001003c89e0 sniffnet`std::panicking::rust_panic_with_hook::h9ed2a7a45efbd034 + 456
    frame #5: 0x00000001003c8800 sniffnet`std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h535244d6186e3534 + 144
    frame #6: 0x00000001003c8770 sniffnet`std::sys_common::backtrace::__rust_end_short_backtrace::ha542aa49031c5cb5 + 36
    frame #7: 0x00000001003c874c sniffnet`rust_begin_unwind + 64
    frame #8: 0x00000001004e190c sniffnet`core::panicking::panic_fmt::hc1e7b11add95109d + 52
    frame #9: 0x00000001004b2170 sniffnet`core::panicking::panic_display::had00118f3957688f(x=<unavailable>) at panicking.rs:147:5 [opt]
    frame #10: 0x00000001004bf2e8 sniffnet`wgpu_hal::metal::AdapterShared::new::h7c158947cef29384 at adapter.rs:485:13 [opt]
    frame #11: 0x00000001004bf2c8 sniffnet`wgpu_hal::metal::AdapterShared::new::h7c158947cef29384(device=Device @ scalar) at mod.rs:263:28 [opt]

The full thing is here.

@GyulyVGC
Copy link
Owner

As suspected the problem probably resides in wgpu.
Thanks for having shared those info with me, they are really useful.
As a last thing to do, if you could try the dmg and let me know if that works for you.
Thanks again 🙏

@GyulyVGC GyulyVGC added the renderer Problem related to the renderer used by the GUI library label Apr 13, 2023
@GyulyVGC
Copy link
Owner

@blinsay can you kindly try the main branch now?
Iced has been updated together with wgpu and this may have solved the issue.

@blinsay
Copy link
Author

blinsay commented Apr 14, 2023

No more segfault! Thanks!

@blinsay blinsay closed this as completed Apr 14, 2023
@GyulyVGC GyulyVGC added the duplicate This issue or pull request already exists label Apr 14, 2023
@GyulyVGC GyulyVGC added this to the v1.1.4 milestone Apr 15, 2023
@GyulyVGC GyulyVGC added macOS Something related to macOS operating system and removed bug Something isn't working labels May 24, 2023
@GyulyVGC
Copy link
Owner

GyulyVGC commented Jun 6, 2023

Hey @blinsay could you kindly tell me if you are using an Apple Silicon macOS?

We are now building two separate version of the installer (Intel & Silicon), but I have no way of testing the Silicon one.
Perviously, we only built the Intel one which is not optimised for Apple Silicon.

In case you are using an Apple Silicon, it'd be amazing if you could test it.

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists macOS Something related to macOS operating system renderer Problem related to the renderer used by the GUI library
Projects
None yet
Development

No branches or pull requests

2 participants