-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Comments
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) |
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. |
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.
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! |
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. |
Alternatively all of Rust's synchronization primitives could be replaced by versions from |
Triage: no changes I'm aware of |
I found that this happens to me too. I may go and modify the panic handler to use a |
Would there be too much of a performance hit if Mutexes work on XP since it falls back to using |
Triage: #56410 will switch libstd to use |
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. |
(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) |
An alternative would be to make |
In a previous issue regarding Windows XP fallback implementations, MrAlert did this a little bit lower-level so it is definitely possible [1]. [1] #26654 (comment) |
Though, after looking at that implementation again, I would not use it because the keyed events APIs are undocumented. |
@RalfJung I decided to follow your advise and threw together a PoC using a wrapper around https://github.com/mbilker/rust/tree/srwlock-compat-mutex |
@mbilker nice, that is somewhat like what I had in mind. :) I imagine the underlying "reentrant mutex" can be shared with the |
@RalfJung It is using the rust/src/libstd/sys/windows/mutex.rs Lines 152 to 184 in 57e1da5
|
What I meant is that all of this code is now essentially duplicated: rust/src/libstd/sys/windows/mutex.rs Lines 48 to 150 in 57e1da5
|
Ah yeah true. I now have |
Sorry for the delay. Are there any testing project out there for testing the Rust synchronization APIs? |
Well as a start there is the |
So testing my changes would be with EDIT: It was |
On Linux I'd do |
Considering the nature of this issue, if a panic occurs and the |
This was after some testing, if I copied a slightly newer |
There's also some other functions that are not available so I am in the middle of putting in the necessary changes into backtrace-rs so it doesn't attempt to |
Hi all, I would like to build a binary for librsvg that can run on Windows 2008 (Vista). I am going to try to build a custom version of rust just to accomplish this. Currently on Vista/2008 we get the rust dll error that about missing SetThreadErrorMode in the system api. Would a patch like this solve the issue? https://github.com/jeroen/rust/pull/1 |
@jeroen This bug here is about Windows XP specifically, because it lacks SRW (slim reader writer) locks. Vista+ have SRW locks so your problem is likely unrelated. Please open a new issue. |
Closing as Windows XP is no longer supported rust-lang/compiler-team#378 |
On Windows XP, the program
fn main() { panic!() }
will fail to run with the following: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:The text was updated successfully, but these errors were encountered: