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

Crash in Xlib_xcb in release #376

Closed
kvark opened this issue Dec 29, 2017 · 14 comments · Fixed by #1517
Closed

Crash in Xlib_xcb in release #376

kvark opened this issue Dec 29, 2017 · 14 comments · Fixed by #1517
Assignees
Labels
B - bug Dang, that shouldn't have happened C - upstream It's not our fault for once C - waiting on author Waiting for a response or another PR D - hard Likely harder than most tasks here DS - x11

Comments

@kvark
Copy link
Contributor

kvark commented Dec 29, 2017

Repro case on Linux:

git clone https://github.com/gfx-rs/gfx -b pre-ll
cd gfx
cargo run --release --example terrain
@francesca64 francesca64 self-assigned this Dec 31, 2017
@francesca64
Copy link
Member

I'm not able to reproduce this. Can you give more information?

@kvark
Copy link
Contributor Author

kvark commented Dec 31, 2017

Interestingly, neither do I!

@kvark kvark closed this as completed Dec 31, 2017
@kvark
Copy link
Contributor Author

kvark commented Jan 2, 2018

Looks like another repro case here kvark/vange-rs#38

@ia0
Copy link

ia0 commented Jan 2, 2018

I had the same issue with cargo run --bin=triangle --release in https://github.com/vulkano-rs/vulkano-examples and ran cargo update which fixed the issue. Here is the output of cargo update:

    Updating registry `https://github.com/rust-lang/crates.io-index`
      Adding bitflags v1.0.1
    Updating byteorder v1.1.0 -> v1.2.1
    Updating cc v1.0.0 -> v1.0.3
    Updating cmake v0.1.26 -> v0.1.29
    Removing conv v0.3.3
    Updating core-foundation v0.4.4 -> v0.4.6
    Updating core-foundation-sys v0.4.4 -> v0.4.6
    Removing custom_derive v0.1.7
    Updating dwmapi-sys v0.1.0 -> v0.1.1
    Updating either v1.2.0 -> v1.4.0
    Updating fnv v1.0.5 -> v1.0.6
      Adding fuchsia-zircon v0.3.2
      Adding fuchsia-zircon-sys v0.3.2
    Removing futures v0.1.16
    Updating gdi32-sys v0.1.1 -> v0.1.2
    Removing lazy_static v0.2.8
      Adding lazy_static v0.2.11
      Adding lazy_static v1.0.0
    Updating libc v0.2.31 -> v0.2.34
    Removing magenta v0.1.1
    Removing magenta-sys v0.1.1
    Updating num-rational v0.1.39 -> v0.1.40
    Updating num-traits v0.1.40 -> v0.1.41
    Updating num_cpus v1.6.2 -> v1.8.0
    Updating rand v0.3.16 -> v0.3.19
    Updating rayon-core v1.2.1 -> v1.3.0
    Updating redox_syscall v0.1.31 -> v0.1.33
    Updating scoped_threadpool v0.1.7 -> v0.1.8
    Updating scopeguard v0.3.2 -> v0.3.3
    Updating shared_library v0.1.7 -> v0.1.8
    Updating shell32-sys v0.1.1 -> v0.1.2
    Updating user32-sys v0.1.2 -> v0.1.3
    Updating vk-sys v0.3.1 -> v0.3.2
    Updating vulkano v0.7.1 -> v0.7.2
    Updating vulkano-shader-derive v0.7.1 -> v0.7.2
    Updating vulkano-shaders v0.7.1 -> v0.7.2
    Updating vulkano-win v0.7.1 -> v0.7.2
    Updating x11-dl v2.15.0 -> v2.17.2

@francesca64
Copy link
Member

I've also had issues in the past with illegal instructions when running in release mode, which ended up going away after updating. Since multiple people have had this issue, and the solution is rather opaque, would it be good to document this in some way?

@kvark
Copy link
Contributor Author

kvark commented Jan 4, 2018

@francesca64 I think it's hard to make conclusions (and thus - recommendations) without full-on investigation on what was wrong and why it went away...

@pengowen123
Copy link

I had a problem with illegal instructions when using winit and gfx in release mode on nightly, so I use stable now to avoid it.

@ia0
Copy link

ia0 commented Jan 4, 2018

@kvark It depends conclusions about what. We don't have conclusions about the root cause of the issue. But we apparently have conclusions about the consequences and the frequency of the issue symptoms. I agree that it would be interesting to understand the root cause and properly fix the issue (which requires someone investing time in it). But in the meantime, if the issue is not anecdotal (which doesn't seem to be the case apparently), then I believe that a mitigation solution (like what @francesca64 suggests: documenting the cargo update trick in some troubleshooting section of the documentation) could be useful. Maybe this issue is actually enough if it gets highly ranked by search engines.

I don't know if there is enough information in my cargo update dump above to help someone reproduce the issue and investigate. But it could be a starting point.

@GabrielMajeri
Copy link
Contributor

GabrielMajeri commented Jan 5, 2018

@ia0 the only relevant crate in your cargo update is x11-dl, since that's what interacts with Xlib (the other crates are either Mac or Windows specific, or not related to windowing).

The only relevant change between v2.15.0 and v2.17.2 is this commit, which fixes some undefined behavior with library loading. That bug was causing crashes on nightly Rust.

The issue @kvark linked is about crashing when opening the library, so that is probably the cause.
@pengowen123 mentioned this was nightly-specific, this matches up with the bug mentioned above.

Best course of action is to update dependencies.

@ia0
Copy link

ia0 commented Jan 5, 2018

@GabrielMajeri Thanks for having taken the time to look into this issue!

@OvermindDL1
Copy link

Running the latest amethyst project example gave me this same issue on nightly in --release mode only, debug works and stable works for both debug and release. No amount of cargo update and so forth did anything to help the issue. I can probably still reliably replicate the issue if required, though considering it's nightly...

@mickvangelderen
Copy link

I ran into this issue again with winit 0.18.1, rust nightly-2019-07-19. The same code works on nightly-2019-07-03.

@goddessfreya goddessfreya reopened this Jul 22, 2019
@goddessfreya goddessfreya added D - hard Likely harder than most tasks here DS - x11 C - needs investigation Issue must be confirmed and researched B - bug Dang, that shouldn't have happened labels Jul 22, 2019
@jdm
Copy link
Contributor

jdm commented Jul 22, 2019

That is likely caused by AltF02/x11-rs#99.

@mateon1
Copy link

mateon1 commented Jul 22, 2019

I ran into this issue when manually building Servo, which uses winit 0.19.1. This seems to be caused by the mem::uninitialized() refactor in the rust stdlib (rust-lang/rust#62150).

See: AltF02/x11-rs#99

This seems to be caused by improper use of mem::uninitialized in x11-rs:

https://github.com/erlepereira/x11-rs/blob/8fb54869045a026dbe14f3c9710b86401eb3e2ef/x11-dl/src/link.rs#L58-L63

@goddessfreya goddessfreya added C - waiting on author Waiting for a response or another PR C - upstream It's not our fault for once and removed C - needs investigation Issue must be confirmed and researched labels Jul 22, 2019
matthew-russo added a commit to matthew-russo/winit that referenced this issue Mar 26, 2020
x11-dl was using std::mem::uninitialized incorrectly and when
rustlang added MaybeUninit and intrinsic panics on UB caused
by improper use of uninitialized (see rust-lang/rust/pull/69922)
it caused issues with X11 initialization. x11-dl pr
AltF02/x11-rs/pull/101 updated x11-dl to use MaybeUninit
correctly
murarth pushed a commit that referenced this issue Mar 26, 2020
x11-dl was using std::mem::uninitialized incorrectly and when
rustlang added MaybeUninit and intrinsic panics on UB caused
by improper use of uninitialized (see rust-lang/rust/pull/69922)
it caused issues with X11 initialization. x11-dl pr
AltF02/x11-rs/pull/101 updated x11-dl to use MaybeUninit
correctly
tmfink pushed a commit to tmfink/winit that referenced this issue Jan 5, 2022
…anovg`,

and `macos_app` examples.

`winit` does not create an autorelease pool, so the Metal backend had not taken
the presence of one into account. Now the Metal backend creates and flushes
autorelease pools as necessary.

Closes rust-windowing#334.
Closes rust-windowing#376.
tmfink pushed a commit to tmfink/winit that referenced this issue Jan 5, 2022
Fix Metal memory management and the `canvas_metal_minimal`, `canvas_nanovg`, and `macos_app` examples.

`winit` does not create an autorelease pool, so the Metal backend had not taken
the presence of one into account. Now the Metal backend creates and flushes
autorelease pools as necessary.

Closes rust-windowing#334.
Closes rust-windowing#376.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B - bug Dang, that shouldn't have happened C - upstream It's not our fault for once C - waiting on author Waiting for a response or another PR D - hard Likely harder than most tasks here DS - x11
Development

Successfully merging a pull request may close this issue.

10 participants