jackaudio / jack2

jack2 codebase
GNU General Public License v2.0
2.22k stars 377 forks source link

jack2 windows crash #332

Open jcelerier opened 6 years ago

jcelerier commented 6 years ago

Just doing the following:

#include <windows.h>
#include <iostream>

int main(int argc, char *argv[])
{
  LoadLibraryA("libjack64.dll");
  return 0;
}

crashes on windows with a weird stacktrace :

1 jack_ringbuffer_get_write_vector libjack64  0x69a2f26b     
2                                             0x169f6beae00  
3                                             0x7ffd00000004 
4 jack_ringbuffer_get_write_vector libjack64  0x69a2ed00     
5                                             0x4a7c2ff430   
6                                             0x169f6beae00  
7                                             0x1f           
8 jack_ringbuffer_get_write_vector libjack64  0x69ab62b0     
9 libjack64                                   0x69a00000

using MSVC2017 64 bit.

Apparently someone had the same issue here: http://jack-audio.10948.n7.nabble.com/Jack-Devel-Does-Jack-Server-work-in-win8-1-x64-td18191.html

jcelerier commented 6 years ago

found it: it's necessary to add /DYNAMICBASE:NO to the linker flags.

EvanBalster commented 6 years ago

This issue affects JACK's own ASIO driver, last I checked. Thus the crash can happen for applications that don't link JACK at all. Seems a little unreasonable to ask those applications to change their link configuration to dodge a crash like this.

jcelerier commented 6 years ago

you're right, I'll reopen to keep the issue visible/

hlolli commented 5 years ago

Also getting this with MSVC2017 64 bit when loading libjack64.dll

from the windows debugger

ModLoad: 00000000`69a00000 00000000`69ef2000   C:\Windows\libjack64.dll
ModLoad: 00007ffe`b3110000 00007ffe`b31b1000   C:\Windows\System32\ADVAPI32.dll
ModLoad: 00007ffe`b0b50000 00007ffe`b0bab000   C:\Windows\System32\sechost.dll
ModLoad: 00007ffe`b0c60000 00007ffe`b0c68000   C:\Windows\System32\PSAPI.DLL
ModLoad: 00007ffe`b0eb0000 00007ffe`b22e6000   C:\Windows\System32\SHELL32.dll
ModLoad: 00007ffe`afc50000 00007ffe`afc9a000   C:\Windows\System32\cfgmgr32.dll
ModLoad: 00007ffe`b0bb0000 00007ffe`b0c56000   C:\Windows\System32\shcore.dll
ModLoad: 00007ffe`aff10000 00007ffe`b0657000   C:\Windows\System32\windows.storage.dll
ModLoad: 00007ffe`b2730000 00007ffe`b2781000   C:\Windows\System32\shlwapi.dll
ModLoad: 00007ffe`af970000 00007ffe`af981000   C:\Windows\System32\kernel.appcore.dll
ModLoad: 00007ffe`af900000 00007ffe`af94c000   C:\Windows\System32\powrprof.dll
ModLoad: 00007ffe`af950000 00007ffe`af96b000   C:\Windows\System32\profapi.dll
ModLoad: 00007ffe`aca90000 00007ffe`acab3000   C:\Windows\SYSTEM32\WINMM.dll
ModLoad: 00007ffe`aca60000 00007ffe`aca8a000   C:\Windows\SYSTEM32\WINMMBASE.dll
(854.1434): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
libjack64!jack_ringbuffer_get_write_vector+0x189cb:
00000000`69a2f26b 8b08            mov     ecx,dword ptr [rax] ds:ffffffff`f2e01bb3=????????
davidebeatrici commented 5 years ago

MSVC 2019, 64 bit:

DLL Loaded: 0000000069A00000 C:\Windows\libjack64.dll
DLL Loaded: 00007FFDEB410000 C:\Windows\System32\psapi.dll
EXCEPTION_DEBUG_INFO:
           dwFirstChance: 1
           ExceptionCode: C0000005 (EXCEPTION_ACCESS_VIOLATION)
          ExceptionFlags: 00000000
        ExceptionAddress: 0000000069A2F26B libjack64.0000000069A2F26B
        NumberParameters: 2
ExceptionInformation[00]: 0000000000000000 Read
ExceptionInformation[01]: 000000001BCBBAC0 Inaccessible Address
First chance exception on 0000000069A2F26B (C0000005, EXCEPTION_ACCESS_VIOLATION)!
0000000069A2F244 | 48:8B05 954D0A00         | mov rax,qword ptr ds:[69AD3FE0]
0000000069A2F24B | 48:897424 30             | mov qword ptr ss:[rsp+30],rsi
0000000069A2F250 | 48:895C24 28             | mov qword ptr ss:[rsp+28],rbx
0000000069A2F255 | 48:89CE                  | mov rsi,rcx
0000000069A2F258 | 48:897C24 38             | mov qword ptr ss:[rsp+38],rdi
0000000069A2F25D | 48:896C24 40             | mov qword ptr ss:[rsp+40],rbp
0000000069A2F262 | 48:85C0                  | test rax,rax
0000000069A2F265 | 0F84 E5000000            | je libjack64.69A2F350
0000000069A2F26B | 8B08                     | mov ecx,dword ptr ds:[rax]