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

Windows build fails to create graphics context #24627

Closed
saschanaz opened this issue Nov 3, 2019 · 9 comments
Closed

Windows build fails to create graphics context #24627

saschanaz opened this issue Nov 3, 2019 · 9 comments

Comments

@saschanaz
Copy link
Contributor

@saschanaz saschanaz commented Nov 3, 2019

> ./mach run
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.3.2
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
Failed to create graphics context!: NoCurrentContext (thread main, at src\libcore\result.rs:1165)
stack backtrace:
   0: backtrace::backtrace::trace_unsynchronized<closure-0>
             at C:\Users\sasch\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.38\src\backtrace\mod.rs:66
   1: backtrace::backtrace::trace<closure-0>
             at C:\Users\sasch\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.38\src\backtrace\mod.rs:53
   2: backtrace::capture::Backtrace::create
             at C:\Users\sasch\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.38\src\capture.rs:164
   3: backtrace::capture::Backtrace::new
             at C:\Users\sasch\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.38\src\capture.rs:128
   4: servo::main::{{closure}}
             at ports\glutin\main2.rs:142
   5: std::panicking::rust_panic_with_hook
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\/src\libstd\panicking.rs:472
   6: std::panicking::continue_panic_fmt
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\/src\libstd\panicking.rs:375
   7: std::panicking::rust_begin_panic
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\/src\libstd\panicking.rs:302
   8: core::panicking::panic_fmt
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\/src\libcore\panicking.rs:84
   9: core::result::unwrap_failed
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\/src\libcore\result.rs:1165
  10: core::result::Result<(surfman::platform::windows::angle::device::Device, surfman::platform::windows::angle::context::Context), surfman::error::Error>::expect<(surfman::platform::windows::angle::device::Device, surfman::platform::windows::angle::context::C
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\src\libcore\result.rs:960
  11: servo::create_webgl_threads<WindowPortsMethods>
             at components\servo\lib.rs:1038
  12: servo::Servo<WindowPortsMethods>::new<WindowPortsMethods>
             at components\servo\lib.rs:464
  13: servo::app::App::run
             at ports\glutin\app.rs:73
  14: servo::main
             at ports\glutin\main2.rs:170
  15: std::rt::lang_start::{{closure}}<()>
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\src\libstd\rt.rs:61
  16: std::panicking::try::do_call<closure-0,i32>
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\/src\libstd\panicking.rs:287
  17: panic_unwind::__rust_maybe_catch_panic
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\/src\libpanic_unwind\lib.rs:80
  18: std::rt::lang_start_internal
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\/src\libstd\rt.rs:47
  19: std::rt::lang_start<()>
             at /rustc/246be7e1a557b8ac8287c6842379a0db67770be6\src\libstd\rt.rs:61
  20: main
  21: __scrt_common_main_seh
             at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  22: BaseThreadInitThunk
  23: RtlUserThreadStart

Servo exited with return value 101

The window opens and shortly after that it crashes. Both the local and nightly build show the same error.

@jdm
Copy link
Member

@jdm jdm commented Nov 3, 2019

Does it run if you use mach run --angle?

@saschanaz
Copy link
Contributor Author

@saschanaz saschanaz commented Nov 3, 2019

It does.

@jdm
Copy link
Member

@jdm jdm commented Nov 3, 2019

This code uses the default surfman device, which is the ANGLE device. When --angle is not specified, we should be using the wgl device from surfman instead.

@jdm jdm added the I-panic label Nov 5, 2019
@asajeffrey
Copy link
Member

@asajeffrey asajeffrey commented Nov 5, 2019

OK, we have a problem here, because we use the universal device throughout servo and webxr, which for windows is always the angle device. Fixing this to allow non-angle windows would probably require rewriting the code to be generic in the device, which is something we should do at some point, but is non-trivial. For the moment we could just make --angle the default?

@rasviitanen
Copy link
Contributor

@rasviitanen rasviitanen commented Nov 8, 2019

I also have this issue. mach run --angle works for me. However, I can not run mach test-wpt test/path -- --angle. Is there any fix to this, so I can run my tests before this is resolved?

@jdm
Copy link
Member

@jdm jdm commented Nov 8, 2019

mach test-wpt --binary-arg=--angle test/path should do the trick.

@fwcd
Copy link

@fwcd fwcd commented Nov 18, 2019

I am having a similar issue, running the nightly build from https://download.servo.org on Windows 10:

Failed to create graphics context!: NoCurrentContext (thread main, at src\libcore\result.rs:1187)
stack backtrace:
   0: HeapFree
   1: JS::RealmBehaviors::discardSource
   2: JS::ubi::Concrete<JSScript>::coarseType
   3: JSAutoNullableRealm::operator=
   4: JSAutoNullableRealm::operator=
   5: JSAutoNullableRealm::operator=
   6: JSTracer::asCallbackTracer
   7: JSTracer::asCallbackTracer
   8: JS::AutoRequireNoGC::~AutoRequireNoGC
   9: JS::AutoRequireNoGC::~AutoRequireNoGC
  10: JS::ubi::Concrete<JSScript>::coarseType
  11: JS::AutoRequireNoGC::~AutoRequireNoGC
  12: JSAutoNullableRealm::operator=
  13: JSTracer::asCallbackTracer
  14: JSAutoNullableRealm::operator=
  15: JS::ubi::Concrete<JSScript>::coarseType
  16: MozFormatCodeAddress
  17: BaseThreadInitThunk
  18: RtlUserThreadStart

The application crashes immediately after startup.

@jdm
Copy link
Member

@jdm jdm commented Nov 18, 2019

You should be able to work around that by starting it from a terminal window and passing --angle.

@atouchet
Copy link
Contributor

@atouchet atouchet commented Nov 21, 2019

For the moment we could just make --angle the default?

This would be nice to have. The current situation with Servo crashing at launch by default is not great.

@jdm jdm mentioned this issue Nov 25, 2019
4 of 4 tasks complete
bors-servo added a commit that referenced this issue Nov 26, 2019
Don't panic if surfman initialization fails.

Since WebGL is only one component of the web platform, there's no reason that failing to initialize surfman for webgl support should take down the entire browser.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24642 (in that the browser will now start up) and fix #24627
- [x] These changes do not require tests because tests for graphics acceleration? don't make me laugh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants
You can’t perform that action at this time.