-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Segmentation fault when using spmc:::channel #63256
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
Comments
cc #39364 Looks like another bug in channels. IIRC, we had loosely discussed that we might want to deprecate std channels at the all hands, but I don't recall specific conclusions. Maybe @alexcrichton remembers better? |
However, even deprecated APIs are covered by our "no UB in safe code" promise. |
|
Sorry for the title confusion. I do actually mean Single Producer Multiple Receiver, spmc, as per my code example. I do hope a sweet channel solution can be found. It would be nice to reference Tony Hoare in the channels documentation, given his work on Communicating Sequential Processes. |
This issue should then be filed against https://github.com/seanmonstar/spmc, as this issue tracker is for Rust itself only. As such, I'm going to close this bug. |
OK. Understood. |
By the way it looks to me you are using WSL which has many more or less serious bugs. Right now I only have access to Windows GNU environment but I downloaded https://packages.ubuntu.com/disco/wbritish-insane and ran your example:
If it works in proper x86_64 Linux environment (no compatibility layers or emulators) and doesn't work in armv7 Linux then it's Rust bug. |
That, or the code has UB. We've seen UB-induced ARM-only SIGILLs before, for example. |
I have built so much software under WSL without issue that it never occurred to me that might be an problem. But the same issue exists on a real native Debian x86-64 box and on a Pi running 64 bit Debian. On a real native Debian PC:
On a Raspberry Pi running 64 bit Debian:
I would try it under Windows in the DOS box but that requires installing Visual Studio which is not going to happen here. Being a Rust newbie I have no idea what goes on in the spmc source but I see it has a lot of "unsafe". I have reported the issue on the spmc github repo. Thanks everybody. |
It means glibc detected bug in the software, Windows isn't that good in that regard.
Windows MSVC requires additional steps but Windows GNU toolchain may work without out of the box. But since glibc error is legit there is no need to test it on Windows.
Rust example: #60475 |
After a few days studying Rust I have come to a road block with segmentation faults and other errors when running a simple program using an mpsc channel.
This code should simply read all the lines of a Debian dictionary file and forward them to four threads. The expected result is like:
But mostly I get seg faults and other errors like so:
I get similar errors on a Raspberry Pi 3.
The text was updated successfully, but these errors were encountered: