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

Using PkarrPublisher on the macOS platform in release mode causes a segmentation fault. #2844

Open
zh522130 opened this issue Oct 28, 2024 · 6 comments
Labels
bug Something isn't working c-iroh-net MacOS

Comments

@zh522130
Copy link
Contributor

zh522130 commented Oct 28, 2024

Environment:

  • Operating System: macOS
  • Architecture: x64_64
  • Rust Version: 1.82.0 (This probably doesn't matter, as the issue existed before the upgrade)

How to reproduce?

Use .discovery_n0() in Endpoint::builder() for any iroh-net example, and run the example in release mode on macOS.

Commenting out the following code in discovery_n0 avoids the segmentation fault:

self.discovery.push(Box::new(|secret_key| {
    Some(Box::new(PkarrPublisher::n0_dns(secret_key.clone())))
}));

Log

Log information when a segmentation fault occurs while running with lldb:

Process 14835 stopped
* thread #15, name = 'tokio-runtime-worker', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #0: 0x000000010091c30f listen`_$LT$simple_dns..dns..rdata..RData$u20$as$u20$simple_dns..dns..packet_part..PacketPart$GT$::parse::hf633f606481706d4 at macros.rs:172:13 [opt]
   169                  TYPE::Unknown(rdatatype) => RData::NULL(rdatatype, NULL::parse(data, position)?),
   170              };
   171 
-> 172              Ok(rdata)
   173          }
   174 
   175 
Target 0: (listen) stopped.
warning: listen was compiled with optimization - stepping may behave oddly; variables may not be available.
@zh522130
Copy link
Contributor Author

I tested it on macOS based on Apple Silicon (M4), and the results were consistent with x64.

@dignifiedquire
Copy link
Contributor

you are saying it segfaults on arm as well? that’s very surprising, as I am using this actively on macos arm and we run full ci on that

@dignifiedquire
Copy link
Contributor

are you by any chance cross compiling? or are you building on the target machines directly?

@zh522130
Copy link
Contributor Author

segfaults

I apologize for the confusion. After retesting on the M4, I realized there was no issue. My initial mistake was due to wrapping iroh-net for Flutter, where Rust segfaults don't crash the app. Seeing errors on the M4 from iroh-net led to my incorrect judgment. The issue might be related to my own code, and I need to investigate further.

@dignifiedquire
Copy link
Contributor

no worries, appreciate the update. let us know what you find

@zh522130
Copy link
Contributor Author

I tested with the latest master code on x64 macos, and the segmentation fault still occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c-iroh-net MacOS
Projects
Status: No status
Development

No branches or pull requests

2 participants