node-3d / glfw-raub

GLFW for Node.js
https://github.com/node-3d/node-3d
MIT License
57 stars 12 forks source link

Segfault random time after window creation #10

Closed leon-marzahn closed 3 years ago

leon-marzahn commented 3 years ago

I really love this library, but the problem is after creating a window, after some time it throws a segfault. I can theoretically ignore the segfault as it doesn't happen again and doesn't affect the application as far as i can, but it's kind of weird to ignore a segfault.

Segfault:

PID 9732 received SIGSEGV for address: 0x7fffe9d03b29
00007FFFE4751D29 (segfault): (#unknown_file): (#unknown_function)
00007FFFEC8985B6 (ntdll): (#unknown_file): RtlIsGenericTableEmpty
00007FFFEC88A056 (ntdll): (#unknown_file): RtlRaiseException
00007FFFEC889FC3 (ntdll): (#unknown_file): RtlRaiseException
00007FFFE9D03B29 (KERNELBASE): (#unknown_file): RaiseException
00007FFF86C1AE17 (OWExplorer): (#unknown_file): base::CriticalSection::TryLock
00007FFF86C19D8B (OWExplorer): (#unknown_file): base::CriticalSection::TryLock
00007FFFEB2E7BD4 (KERNEL32): (#unknown_file): BaseThreadInitThunk
00007FFFEC88CE51 (ntdll): (#unknown_file): RtlUserThreadStart

Code:

import glfw from 'glfw-raub';

if (glfw.init()) {
  const callback = (error, description) => console.log(error, description);
  const window = glfw.createWindow(640, 480, callback, '123', null);

  if (window) {
    glfw.makeContextCurrent(window);
    glfw.swapInterval(1);

    while (!glfw.windowShouldClose(window)) {
      const size = glfw.getFramebufferSize(window);
      glfw.testScene(size.width, size.height);

      glfw.swapBuffers(window);
      glfw.pollEvents();
    }
  }

  glfw.destroyWindow(window);
}

glfw.terminate();

Running on Windows x64 - Node 12.16.1 x64 - ES6

raub commented 3 years ago

Hello. Can you try disabling the "Overwolf" program? That is, OWExplorer.dll per given segfault log.

Is Overwolf essential for your project? How do you use it?

See if turning it off will change the situation, or at least the stack log.

leon-marzahn commented 3 years ago

Oh my god, i didn't know OWExplorer is Overwolf. Yes, turning it off fixed it actually. So Overwolf hooks into games to give information on it, i just didn't expect it to hook into a random glfw context. And also why it would segfault it, i have no idea.

raub commented 3 years ago

Also which version of the module do you use? Your glfw.createWindow call looks odd to me, it should be more like

const emitter = { emit: (t, e) => this.emit(t, e) };
const window = glfw.createWindow(640, 480, emitter, 'some title');

in case you use the latest version.

There is class Window that handles a lot of window-related stuff for you, like fullscreen switching for instance.

leon-marzahn commented 3 years ago

I think i am using the latest version, and yeah i used th emitter incorrectly, i just noticed thanks! And also i just used low level to see if it's an issue in the Window class.

raub commented 3 years ago

To be honest, this hook-related segfault issue is not the first one I heard of. So there might be a bigger picture or some low-level issue behind it.

The other known hook problem was with Nahimic A-Volume, and I have no idea what is wrong with these hooks...

May be one day I might find an answer.

leon-marzahn commented 3 years ago

Alright, good luck on that, keep it up :)