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 · 11 comments
Open

Panic broken on Windows XP #34538

arcnmx opened this issue Jun 28, 2016 · 11 comments
Labels

Comments

@arcnmx
Copy link
Contributor

@arcnmx 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 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 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 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 notify-rs/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 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 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 steveklabnik commented Oct 31, 2018

Triage: no changes I'm aware of

@mbilker

This comment has been minimized.

Copy link

@mbilker 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 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.

@jonas-schievink

This comment has been minimized.

Copy link
Member

@jonas-schievink jonas-schievink commented Jul 29, 2019

Triage: #56410 will switch libstd to use parking_lot, but it's still got a long way to go

@mbilker

This comment has been minimized.

Copy link

@mbilker mbilker commented Jul 29, 2019

I've been using the changes from #56410 in a small program running on Windows XP Embedded machines for a few months now with working panic messages.

@arcnmx

This comment has been minimized.

Copy link
Contributor Author

@arcnmx arcnmx commented Jul 29, 2019

(I love that most of the interest in XP and the reason this issue was filed seems to stem from one certain company's use of XP Embedded in their arcade cabinets)

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