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

Panic broken on Windows XP #34538

Open
arcnmx opened this Issue Jun 28, 2016 · 8 comments

Comments

Projects
None yet
6 participants
@arcnmx
Copy link
Contributor

arcnmx commented Jun 28, 2016

On Windows XP, the program fn main() { panic!() } will fail to run with the following:

thread panicked while processing panic. aborting.

I understand that XP isn't necessarily supported by the standard library, and certain sync implementations are stubbed out (probably the root cause of this issue?), but panicking seems like an operation that should really work if at all possible...

Tested with i686-pc-windows-gnu target and mingw-w64 on:

rustc 1.11.0-nightly (ad7fe6521 2016-06-23)
binary: rustc
commit-hash: ad7fe6521b8a59d84102113ad660edb21de2cba6
commit-date: 2016-06-23
host: x86_64-unknown-linux-gnu
release: 1.11.0-nightly
@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jun 28, 2016

Indeed this should definitely work! Would you be able to debug a bit and explore why the double panic is happening? (e.g. the panic messages that were printed or the stack traces)

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jun 28, 2016

I'm also not sure I've ever heard of pc-windows-gnu working on XP, so MSVC may work better. Even then though we don't regularly test so it may still have regressed.

@arcnmx

This comment has been minimized.

Copy link
Contributor Author

arcnmx commented Jun 28, 2016

@alexcrichton

Hm, I can try to see if I can install a debugger and get more info, but I did find passcod/notify#79 (comment) which seems to include a stack trace of the same issue happening with a double panic.

I'm also not sure I've ever heard of pc-windows-gnu working on XP, so MSVC may work better

It seems to work well enough here, besides the aforementioned issue. If I don't trigger a panic most basic functionality seems fine! I don't have a MSVC Rust dev setup, but if anyone wants to compile the minimal test program and attach an exe I can try running it!

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jun 29, 2016

Aha, that'd do it. When a thread panics it attempts to run its panic hook, but that panic hook is protected by an RwLock which is in turn not implemented on XP. That means that when panicking you'll panic immediately as you attempt to acquire an rwlock.

We could change this to use a mutex somehow perhaps which I believe is implemented on XP at least.

@retep998

This comment has been minimized.

Copy link
Member

retep998 commented Jun 29, 2016

Alternatively all of Rust's synchronization primitives could be replaced by versions from parking_lot which works on XP (and is faster). cc @Amanieu

@steveklabnik

This comment has been minimized.

Copy link
Member

steveklabnik commented Oct 31, 2018

Triage: no changes I'm aware of

@mbilker

This comment has been minimized.

Copy link

mbilker commented Nov 9, 2018

I found that this happens to me too. I may go and modify the panic handler to use a Mutex rather than an RWLock so I can find out why this program I am writing is panic-ing on Windows XP Embedded.

@mbilker

This comment has been minimized.

Copy link

mbilker commented Nov 9, 2018

Would there be too much of a performance hit if RWLock checks for SRW lock support at runtime like Mutex? Could always implement it and do a crater run to find out myself.

Mutexes work on XP since it falls back to using CriticalSection* functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.