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 on macOS 10.14.2 (18C54) at debug_assert!(backend.is_current()); #1721

Closed
TakWolf opened this issue Jan 22, 2019 · 4 comments
Closed

Comments

@TakWolf
Copy link

TakWolf commented Jan 22, 2019

/glium-0.23.0/src/context/mod.rs:647:17

I use edition = "2018" and glium = "0.23.0"

It seems that unsafe { backend.make_current() }; not effect.

full stacks:

/Users/takwolf/.cargo/bin/cargo run --color=always --package foo --bin foo
   Compiling khronos_api v3.0.0
   Compiling cfg-if v0.1.6
   Compiling core-foundation-sys v0.6.2
   Compiling libc v0.2.47
   Compiling xml-rs v0.8.0
   Compiling foreign-types-shared v0.1.1
   Compiling bitflags v1.0.4
   Compiling block v0.1.6
   Compiling autocfg v0.1.2
   Compiling lazy_static v1.2.0
   Compiling void v1.0.2
   Compiling rustc-demangle v0.1.13
   Compiling fnv v1.0.6
   Compiling log v0.4.6
   Compiling foreign-types v0.3.2
   Compiling unreachable v1.0.0
   Compiling backtrace v0.3.13
   Compiling smallvec v0.6.8
   Compiling core-foundation v0.6.3
   Compiling malloc_buf v0.0.6
   Compiling shared_library v0.1.9
   Compiling objc v0.2.5
   Compiling gl_generator v0.10.0
   Compiling core-graphics v0.17.3
   Compiling cocoa v0.18.4
   Compiling gleam v0.6.8
   Compiling glutin v0.19.0
   Compiling glium v0.23.0
   Compiling winit v0.18.1
   Compiling cgl v0.2.3
   Compiling foo v0.1.0 (/Users/takwolf/Develop/workspace/foo)
warning: unused variable: `event`
  --> src/main.rs:27:34
   |
27 |         events_loop.poll_events(|event| {
   |                                  ^^^^^ help: consider using `_event` instead
   |
   = note: #[warn(unused_variables)] on by default

    Finished dev [unoptimized + debuginfo] target(s) in 52.49s
     Running `target/debug/foo`
thread 'main' panicked at 'assertion failed: backend.is_current()', /Users/takwolf/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/context/mod.rs:647:17
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:70
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:58
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
             at src/libstd/panicking.rs:478
   5: core::ptr::swap_nonoverlapping_bytes
             at /rustc/7164a9f151a56316a382d8bc2b15ccf373e129ca/src/libstd/panicking.rs:412
   6: glium::context::Context::new::{{closure}}
             at /Users/takwolf/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/context/mod.rs:647
   7: glium::context::default_debug_callback::{{closure}}
             at /Users/takwolf/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/context/mod.rs:951
   8: <glium::version::Api as core::cmp::PartialEq>::eq
             at /Users/takwolf/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/context/mod.rs:217
   9: glium::backend::glutin::Display::new_inner
             at /Users/takwolf/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/backend/glutin/mod.rs:115
  10: <&'b str as core::str::pattern::Pattern<'a>>::into_searcher
             at /Users/takwolf/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/backend/glutin/mod.rs:94
  11: <&'b str as core::str::pattern::Pattern<'a>>::into_searcher
             at /Users/takwolf/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/backend/glutin/mod.rs:79
  12: <&'b str as core::str::pattern::Pattern<'a>>::into_searcher
             at /Users/takwolf/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glium-0.23.0/src/backend/glutin/mod.rs:71
  13: foo::main
             at src/main.rs:17
  14: std::rt::lang_start::{{closure}}
             at /rustc/7164a9f151a56316a382d8bc2b15ccf373e129ca/src/libstd/rt.rs:64
  15: std::panicking::try::do_call
             at src/libstd/rt.rs:49
             at src/libstd/panicking.rs:297
  16: panic_unwind::dwarf::eh::read_encoded_pointer
             at src/libpanic_unwind/lib.rs:92
  17: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
             at src/libstd/panicking.rs:276
             at src/libstd/panic.rs:388
             at src/libstd/rt.rs:48
  18: std::rt::lang_start
             at /rustc/7164a9f151a56316a382d8bc2b15ccf373e129ca/src/libstd/rt.rs:64
  19: foo::main

Process finished with exit code 101

source code is:

use glium::{
    glutin:: {
        EventsLoop,
        WindowBuilder,
        ContextBuilder,
    },
    Display,
    Surface,
};

fn main() {
    let mut events_loop = EventsLoop::new();
    let window_builder = WindowBuilder::new()
        .with_dimensions((800.0, 600.0).into())
        .with_resizable(false);
    let context_builder = ContextBuilder::new();
    let display = Display::new(window_builder, context_builder, &events_loop).unwrap();

    let running = true;
    while running {

        let mut target = display.draw();
        target.clear_color(0.0, 0.0, 1.0, 1.0);
        target.finish().unwrap();
        
        events_loop.poll_events(|event| {

        });

    }

}
@TakWolf
Copy link
Author

TakWolf commented Jan 23, 2019

@OtaK
Copy link

OtaK commented Jan 24, 2019

The deprecation seems unrelated, seems it's related to glutin's make_current or is_current methods of the Context.

In the meantime you can compile with --release, the debug assertion will compile away and it seems to work perfectly well. Can it be a race condition on the time the context becomes current and when the assertion is performed?

Can you give us a bit a guidance here @mitchmindtree?

@michael-p
Copy link

Seems that the root cause of this is now fixed in Glutin 0.20.0 (Changelog, so once Glium upgrades that dependency this should be ok.

@TakWolf
Copy link
Author

TakWolf commented Apr 28, 2019

The upstream library glutin have finished this.

Please update glium to 0.24.0

I will close this issues.

Please see:
https://github.com/rust-windowing/glutin/blob/v0.20.0/CHANGELOG.md#version-0200-2019-03-09
rust-windowing/glutin#1099

@TakWolf TakWolf closed this as completed Apr 28, 2019
yvt added a commit to yvt/ngspades that referenced this issue Apr 25, 2020
The old work-around had a serious performance issue because every draw
call triggered a redundant call to `Context::make_current`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants