exokitxr / exokit

Native VR/AR/XR engine for JavaScript 🦖
MIT License
997 stars 118 forks source link

THREE.js Iframe-contained WebGL crashing #1328

Closed avaer closed 5 years ago

avaer commented 5 years ago

Repro:

node --experimental-vm-modules . "https://threejs.org/examples/#webgl_animation_cloth"

This results in a graphics driver stack crash:

 # Child-SP          RetAddr           Call Site
00 000000a7`228fe0d8 00007ff9`2707acf7 nvoglv64+0x9250a9
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for node.exe - 
01 000000a7`228fe0e0 00007ff7`fe128fcb exokit!Nan::imp::FunctionCallbackWrapper+0xe7 [c:\users\avaer\documents\github\exokit\node_modules\nan\nan_callbacks_12_inl.h @ 177] 
02 000000a7`228fe130 00007ff7`fe2ae0d8 node!v8::internal::StubCache::Set+0x65b
03 000000a7`228fe1d0 00007ff7`fe2ae428 node!v8::internal::Builtins::builtin_handle+0x52198
04 000000a7`228fe350 00007ff7`fe2ae22e node!v8::internal::Builtins::builtin_handle+0x524e8
05 000000a7`228fe3f0 00007ff7`fe3c170d node!v8::internal::Builtins::builtin_handle+0x522ee
06 000000a7`228fe430 00007ff7`fe335bbc node!v8::internal::SetupIsolateDelegate::SetupHeap+0x960cd
07 000000a7`228fe480 00007ff7`fe335bbc node!v8::internal::SetupIsolateDelegate::SetupHeap+0xa57c
08 000000a7`228fe518 00007ff7`fe335bbc node!v8::internal::SetupIsolateDelegate::SetupHeap+0xa57c
09 000000a7`228fe560 00007ff7`fe335bbc node!v8::internal::SetupIsolateDelegate::SetupHeap+0xa57c
0a 000000a7`228fe5e0 00007ff7`fe389fc2 node!v8::internal::SetupIsolateDelegate::SetupHeap+0xa57c
0b 000000a7`228fe630 00007ff7`fe354bb2 node!v8::internal::SetupIsolateDelegate::SetupHeap+0x5e982
0c 000000a7`228fe668 00007ff7`fe3333dc node!v8::internal::SetupIsolateDelegate::SetupHeap+0x29572
0d 000000a7`228fe6b8 00007ff7`fe1ddf24 node!v8::internal::SetupIsolateDelegate::SetupHeap+0x7d9c
0e 000000a7`228fe7d0 00007ff7`fe1de033 node!v8::internal::StackGuard::InitThread+0x484
0f 000000a7`228fe930 00007ff7`fe1de702 node!v8::internal::StackGuard::InitThread+0x593
10 000000a7`228fe990 00007ff7`fe0b6a05 node!v8::internal::Execution::TryCall+0x162
11 000000a7`228fea50 00007ff7`fe128fcb node!v8::internal::MicrotaskQueue::RunMicrotasks+0x205
12 000000a7`228feb80 00007ff7`fe2ae0d8 node!v8::internal::StubCache::Set+0x65b
13 000000a7`228fec20 00007ff7`fe2ae428 node!v8::internal::Builtins::builtin_handle+0x52198
14 000000a7`228feda0 00007ff7`fe2ae22e node!v8::internal::Builtins::builtin_handle+0x524e8
15 000000a7`228fee40 00007ff7`fe3c170d node!v8::internal::Builtins::builtin_handle+0x522ee
16 000000a7`228fee80 00007ff7`fe335bbc node!v8::internal::SetupIsolateDelegate::SetupHeap+0x960cd
17 000000a7`228feed0 00007ff7`fe3334f1 node!v8::internal::SetupIsolateDelegate::SetupHeap+0xa57c
18 000000a7`228fef70 00007ff7`fe3330dc node!v8::internal::SetupIsolateDelegate::SetupHeap+0x7eb1
19 000000a7`228fef98 00007ff7`fe1dde6c node!v8::internal::SetupIsolateDelegate::SetupHeap+0x7a9c
1a 000000a7`228ff0b0 00007ff7`fe1dcd86 node!v8::internal::StackGuard::InitThread+0x3cc
1b 000000a7`228ff210 00007ff7`fe2f7be2 node!v8::internal::Execution::Call+0xb6
1c 000000a7`228ff2d0 00007ff7`fdba4a6d node!v8::Function::Call+0x252
1d 000000a7`228ff3f0 00007ff7`fdba4d31 node!node::CallbackScope::~CallbackScope+0x2ed
1e 000000a7`228ff470 00007ff7`fdb9e423 node!node::CallbackScope::~CallbackScope+0x5b1
1f 000000a7`228ff510 00007ff7`fdafa3b7 node!napi_wrap+0x32bc3
20 000000a7`228ff580 00007ff7`fdbd07fb node!v8::internal::AsmJsScanner::GetIdentifierString+0x4d57
21 000000a7`228ff650 00007ff7`fdbcff9c node!uv_async_send+0x14b
22 000000a7`228ff680 00007ff7`fdbd0164 node!uv_loop_init+0x4bc
23 000000a7`228ff6c0 00007ff7`fdac6690 node!uv_run+0xf4
24 000000a7`228ff740 00007ff7`fdac2ac9 node!v8::internal::wasm::SignatureMap::Freeze+0x3b90
25 000000a7`228ffbc0 00007ff7`fdbc28dd node!v8::internal::ParseInfo::max_function_literal_id+0x166c9
26 000000a7`228ffbf0 00007ff7`fe864150 node!uv_poll_stop+0x2fd
27 000000a7`228ffc40 00007ff9`91ab7974 node!v8::internal::CodeStubAssembler::WordIsPowerOfTwo+0x5db00
28 000000a7`228ffc70 00007ff9`945aa271 KERNEL32!BaseThreadInitThunk+0x14
29 000000a7`228ffca0 00000000`00000000 ntdll!RtlUserThreadStart+0x21
avaer commented 5 years ago

This probably has to do with some GL state/framebuffer binding being out of sync in the child frame.

avaer commented 5 years ago

Current theory: the 2d iframe has no GL context, so waiting on the GLsync objects in that contextless window would crash the driver.

avaer commented 5 years ago

Indeed, skipping the GLsync processing in the context-less window fixes this bug.