spotify / pedalboard

🎛 🔊 A Python library for audio.
https://spotify.github.io/pedalboard
GNU General Public License v3.0
5.21k stars 260 forks source link

Python crashes when loading VST3 plugins with pedalboard version 0.9.7 or higher. #365

Open anvuew opened 3 months ago

anvuew commented 3 months ago

I tested Python versions 3.9, 3.10, and 3.11, along with various VST3 plugins. Python crashes when executing pedalboard.load_plugin() with pedalboard versions 0.9.7 or higher. pedalboard.load_plugin() functions correctly with pedalboard versions lower than 0.9.7.

psobot commented 3 months ago

Hi @anvuew!

Which platform and plugins are you experiencing these crashes with? What do the crashes look like? Are you able to use faulthandler to get more debug information about where the crash is occurring?

The only possible change I see that could impact v0.9.7+ is the switch to NumPy 2, which is supposed to be backwards compatible (and indeed works just fine in all tests and local development). Can you confirm which NumPy version you have installed?

anvuew commented 3 months ago

Which platform and plugins are you experiencing these crashes with

windows, fabfilter and valhalla

What do the crashes look like?

Just silently terminate the process. image

Are you able to use faulthandler to get more debug information about where the crash is occurring

Windows fatal exception: access violation

Current thread 0x00002918 (most recent call first):
  File "...Python310\site-packages\pedalboard\_pedalboard.py", line 808 in load_plugin

Can you confirm which NumPy version you have installed

I originally had NumPy version 1.26.4 installed. When I created new Python environments with Miniconda and installed pedalboard, it installed NumPy version 2.0.1

anvuew commented 3 months ago

Microsoft (R) Windows Debugger Version 10.0.17763.132 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

Loading Dump File [D:\python.exe.6032.dmp]
User Mini Dump File: Only registers, stack and portions of memory are available

Symbol search path is: srv*
Executable search path is: 
Windows 10 Version 19045 MP (12 procs) Free x64
Product: WinNt, suite: SingleUserTS
19041.1.amd64fre.vb_release.191206-1406
Machine Name:
Debug session time: Thu Aug  1 04:18:13.000 2024 (UTC + 8:00)
System Uptime: not available
Process Uptime: 0 days 0:00:05.000
....................................................
This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(1790.5b78): Access violation - code c0000005 (first/second chance not available)
ntdll!NtWaitForMultipleObjects+0x14:
00007ffe`8c24e0b4 c3              ret
0:000> !analyze -v
*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************

*** WARNING: Unable to verify checksum for pedalboard_native.cp312-win_amd64.pyd
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for pedalboard_native.cp312-win_amd64.pyd - 
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for python312.dll - 
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for python.exe - 
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for libscipy_openblas64_-fb1711452d4d8cee9f276fd1449ee5c7.dll - 
GetUrlPageData2 (WinHttp) failed: 12002.

KEY_VALUES_STRING: 1

STACKHASH_ANALYSIS: 1

TIMELINE_ANALYSIS: 1

Timeline: !analyze.Start
    Name: <blank>
    Time: 2024-07-31T20:24:16.797Z
    Diff: 363797 mSec

Timeline: Dump.Current
    Name: <blank>
    Time: 2024-07-31T20:18:13.0Z
    Diff: 0 mSec

Timeline: Process.Start
    Name: <blank>
    Time: 2024-07-31T20:18:08.0Z
    Diff: 5000 mSec

DUMP_CLASS: 2

DUMP_QUALIFIER: 400

CONTEXT:  (.ecxr)
rax=0000000000000000 rbx=0000021cff555720 rcx=00007ffe1a73aa78
rdx=0000000000000000 rsi=00007ffe1a73aa70 rdi=0000021cff51ad30
rip=00007ffe53693080 rsp=000000d180fee1f0 rbp=000000d180fee350
 r8=000000000000000b  r9=0000000000000040 r10=0000000000000000
r11=fffe7fffffffffef r12=00007ffe1a73aa70 r13=0666666666666666
r14=0000000000000000 r15=0000000000000000
iopl=0         nv up ei ng nz na po nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010286
msvcp140!mtx_do_lock+0x74:
00007ffe`53693080 488b00          mov     rax,qword ptr [rax] ds:00000000`00000000=????????????????
Resetting default scope

FAULTING_IP: 
msvcp140!mtx_do_lock+74 [D:\a\_work\1\s\src\vctools\crt\github\stl\src\mutex.cpp @ 103]
00007ffe`53693080 488b00          mov     rax,qword ptr [rax]

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 00007ffe53693080 (msvcp140!mtx_do_lock+0x0000000000000074)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 0000000000000000
   Parameter[1]: 0000000000000000
Attempt to read from address 0000000000000000

DEFAULT_BUCKET_ID:  NULL_POINTER_READ

FOLLOWUP_IP: 
msvcp140!mtx_do_lock+74 [D:\a\_work\1\s\src\vctools\crt\github\stl\src\mutex.cpp @ 103]
00007ffe`53693080 488b00          mov     rax,qword ptr [rax]

READ_ADDRESS:  0000000000000000 

ERROR_CODE: (NTSTATUS) 0xc0000005 - <Unable to get error code text>

EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - <Unable to get error code text>

EXCEPTION_CODE_STR:  c0000005

EXCEPTION_PARAMETER1:  0000000000000000

EXCEPTION_PARAMETER2:  0000000000000000

WATSON_BKT_PROCSTAMP:  6671a24d

WATSON_BKT_PROCVER:  3.12.4150.1013

PROCESS_VER_PRODUCT:  Python

WATSON_BKT_MODULE:  msvcp140.dll

WATSON_BKT_MODSTAMP:  653aa208

WATSON_BKT_MODOFFSET:  13080

WATSON_BKT_MODVER:  14.29.30153.0

MODULE_VER_PRODUCT:  Microsoft? Visual Studio?

BUILD_VERSION_STRING:  19041.1.amd64fre.vb_release.191206-1406

MODLIST_WITH_TSCHKSUM_HASH:  9b7d97813c8ce3e562dfafee9706c5ac8799d18e

MODLIST_SHA1_HASH:  10e735c428015e8ea12112fd0e7088d26db73792

NTGLOBALFLAG:  0

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS:  0

DUMP_FLAGS:  94

DUMP_TYPE:  1

PROCESS_NAME:  unknown

ANALYSIS_SESSION_HOST:  DESKTOP-53D3AJH

ANALYSIS_SESSION_TIME:  08-01-2024 04:24:16.0797

ANALYSIS_VERSION: 10.0.17763.132 amd64fre

THREAD_ATTRIBUTES: 
OS_LOCALE:  CHS

BUGCHECK_STR:  APPLICATION_FAULT_NULL_POINTER_READ_INVALID_POINTER_READ

PRIMARY_PROBLEM_CLASS:  APPLICATION_FAULT

PROBLEM_CLASSES: 

    ID:     [0n313]
    Type:   [@ACCESS_VIOLATION]
    Class:  Addendum
    Scope:  BUCKET_ID
    Name:   Omit
    Data:   Omit
    PID:    [Unspecified]
    TID:    [0x5b78]
    Frame:  [0] : msvcp140!mtx_do_lock

    ID:     [0n285]
    Type:   [INVALID_POINTER_READ]
    Class:  Primary
    Scope:  BUCKET_ID
    Name:   Add
    Data:   Omit
    PID:    [Unspecified]
    TID:    [0x5b78]
    Frame:  [0] : msvcp140!mtx_do_lock

    ID:     [0n300]
    Type:   [NULL_POINTER_READ]
    Class:  Primary
    Scope:  DEFAULT_BUCKET_ID (Failure Bucket ID prefix)
            BUCKET_ID
    Name:   Add
    Data:   Omit
    PID:    [0x1790]
    TID:    [0x5b78]
    Frame:  [0] : msvcp140!mtx_do_lock

LAST_CONTROL_TRANSFER:  from 00007ffe1a40b224 to 00007ffe53693080

STACK_TEXT:  
000000d1`80fee1f0 00007ffe`1a40b224 : 00000000`00000043 0000021c`f2870000 0000021c`ff555720 00000000`00000000 : msvcp140!mtx_do_lock+0x74
000000d1`80fee250 00007ffe`1a455003 : 0000021c`ff5445f0 0000021c`ff5445f0 0000021c`ff51ad30 00000000`00000000 : pedalboard_native_cp312_win_amd64!juce::GenericInterpolator<juce::Interpolators::ZeroOrderHoldTraits,1>::interpolate+0x644
000000d1`80fee3e0 00007ffe`1a3dddff : 000000d1`80fee748 00000000`00000000 0000021c`f2ae2660 0000021c`ff51ad20 : pedalboard_native_cp312_win_amd64!juce::GenericInterpolator<juce::Interpolators::ZeroOrderHoldTraits,1>::pushInterpolationSample+0x48593
000000d1`80fee5b0 00007ffe`1a432d2d : 000000d1`80fee778 000000d1`80fee6d0 0000021c`f2970000 000000d1`80fee740 : pedalboard_native_cp312_win_amd64!juce::PatchedFlacAudioFormat::getQualityOptions+0x3838f
000000d1`80fee6a0 00007ffe`1a45e10c : 0000021c`ffcdee40 000000d1`80fee8e0 000000d1`80fee8e0 000000d1`80fee770 : pedalboard_native_cp312_win_amd64!juce::GenericInterpolator<juce::Interpolators::ZeroOrderHoldTraits,1>::pushInterpolationSample+0x262bd
000000d1`80fee740 00007ffe`1a45e224 : 000000d1`80fee980 00000000`00000000 0000021c`f2d8b310 00000000`00000005 : pedalboard_native_cp312_win_amd64!juce::GenericInterpolator<juce::Interpolators::ZeroOrderHoldTraits,1>::pushInterpolationSample+0x5169c
000000d1`80fee830 00007ffe`1a3d3047 : 000000d1`80feea30 000000d1`80feea38 0000021c`ffcdf0c0 00000000`00000001 : pedalboard_native_cp312_win_amd64!juce::GenericInterpolator<juce::Interpolators::ZeroOrderHoldTraits,1>::pushInterpolationSample+0x517b4
000000d1`80fee860 00007ffe`1a920913 : 0000021c`ffcb90d0 0000021c`f2dc1f80 00000000`00000001 00007ffe`1aed3018 : pedalboard_native_cp312_win_amd64!juce::PatchedFlacAudioFormat::getQualityOptions+0x2d5d7
000000d1`80feee80 00007ffe`1a8d3f3d : 0000021c`f2d8b310 00007ffe`1aed3018 00000000`00000886 00000000`00000001 : python312!PyCFunction_GetFlags+0xda3
000000d1`80feeeb0 00007ffe`1a8d7192 : 0000021c`f2dc1d10 00007ffe`1a9208b0 0000021c`ffccd5d0 00000000`00000000 : python312!PyObject_MakeTpCall+0x12d
000000d1`80feef10 00007ffe`1a8d40d9 : 00007ffe`1ae756e8 00007ffe`1aed3018 00007ffe`1aed3018 0000021c`f2db74c0 : python312!PyMethod_Self+0xe2
000000d1`80feefc0 00007ffe`1a8d42f6 : 00007ffe`1ae756e8 0000021c`f2f25180 0000021c`ffc8b5f0 0000021c`f2db74c0 : python312!PyVectorcall_Function+0xb9
000000d1`80fef000 00007ffe`1a94d38f : 00000000`00000000 0000021c`ff4b72f0 0000021c`ffc8b5f0 0000021c`f2f25180 : python312!PyObject_Call+0x46
000000d1`80fef040 00007ffe`1a93e83f : 00000000`00000001 0000021c`ffc8b5f0 0000021c`f2f25180 00007ffe`1a8e6291 : python312!PyType_Ready+0x4e7f
000000d1`80fef0a0 00007ffe`1a3ce0b4 : 00007ffe`1ae756e8 00000000`00000000 00000000`00000000 00007ffe`1a8e5d32 : python312!PyType_Name+0x1b7f
000000d1`80fef0e0 00007ffe`1a8d3f3d : 0000021c`f287c278 00007ffe`1ae756e8 0000021c`f29f0120 00007ffe`1ae756e8 : pedalboard_native_cp312_win_amd64!juce::PatchedFlacAudioFormat::getQualityOptions+0x28644
000000d1`80fef170 00007ffe`1a8d4265 : 00000000`000000ab 00007ffe`1a3ce080 000000d1`80fef310 0000021c`ff57793e : python312!PyObject_MakeTpCall+0x12d
000000d1`80fef1d0 00007ffe`1aa0fcb3 : 0000021c`f2dafaf0 000000d1`80fef310 0000021c`f2db7840 00000000`00000000 : python312!PyObject_Vectorcall+0x35
000000d1`80fef210 00007ffe`1aa09606 : 0000021c`ffcc03f0 0000021c`f2baa160 0000021c`f2d84080 0000021c`f2d84080 : python312!PyEval_EvalFrameDefault+0x64e3
000000d1`80fef3d0 00007ffe`1aaa7026 : 0000021c`f2db74b0 00007ffe`1aed3018 0000021c`f2d84080 00000000`00000000 : python312!PyEval_EvalCode+0xe6
000000d1`80fef450 00007ffe`1aaa7133 : 0000021c`f2fcb2d0 0000021c`ffcc03f0 0000021c`f2d84080 0000021c`f2d84080 : python312!PyRun_FileExFlags+0x296
000000d1`80fef490 00007ffe`1aaa340e : 0000021c`f2d8b8d0 0000021c`f2aeb6f0 0000021c`f2bbb960 0000021c`f2d8b1b0 : python312!PyRun_FileExFlags+0x3a3
000000d1`80fef4d0 00007ffe`1aaa2f1e : 00007ffe`89cbf490 0000021c`f2d8b1b0 000000d1`80fef618 00000000`00000000 : python312!PyRun_InteractiveLoopFlags+0x3fe
000000d1`80fef570 00007ffe`1a84f70c : 0000021c`f2d8b1b0 ffffffff`ffffffff 0000000c`00000000 00000000`00000000 : python312!PyRun_InteractiveLoopObject+0x25e
000000d1`80fef5d0 00007ffe`1a84fe5a : 00007ffe`1ae3ec80 0000000c`00000000 00007ffe`1ae75768 000000d1`80feef50 : python312!Py_gitidentifier+0xae1c
000000d1`80fef610 00007ffe`1a850348 : 000000d1`80fef6e0 00007ffe`1ae68d00 00007ffe`1ae75768 0000021c`f287bf40 : python312!Py_gitidentifier+0xb56a
000000d1`80fef6b0 00007ffe`1a8503d2 : 0000021c`00000000 00007ffe`89bf1d56 00000000`00000000 0000021c`f287db60 : python312!Py_RunMain+0x18
000000d1`80fef6e0 00007ff6`333d1490 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : python312!Py_Main+0x52
000000d1`80fef750 00007ffe`8bb47374 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : python!OPENSSL_Applink+0x380
000000d1`80fef790 00007ffe`8c1fcc91 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0x14
000000d1`80fef7c0 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21

THREAD_SHA1_HASH_MOD_FUNC:  74b0dee5da9a7517ced74a7f29197bbd4f70091a

THREAD_SHA1_HASH_MOD_FUNC_OFFSET:  e5db3789bcfc8cbbdfd481b121b46b361a59ad8d

THREAD_SHA1_HASH_MOD:  6b164cd78d560d6b11d34595885794fb9e43d014

FAULT_INSTR_CODE:  ff008b48

FAULTING_SOURCE_LINE:  D:\a\_work\1\s\src\vctools\crt\github\stl\src\mutex.cpp

FAULTING_SOURCE_FILE:  D:\a\_work\1\s\src\vctools\crt\github\stl\src\mutex.cpp

FAULTING_SOURCE_LINE_NUMBER:  103

SYMBOL_STACK_INDEX:  0

SYMBOL_NAME:  msvcp140!mtx_do_lock+74

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: msvcp140

IMAGE_NAME:  msvcp140.dll

DEBUG_FLR_IMAGE_TIMESTAMP:  653aa208

STACK_COMMAND:  dt ntdll!LdrpLastDllInitializer BaseDllName ; dt ntdll!LdrpFailureData ; ~0s ; .ecxr ; kb

FAILURE_BUCKET_ID:  NULL_POINTER_READ_c0000005_msvcp140.dll!mtx_do_lock

BUCKET_ID:  APPLICATION_FAULT_NULL_POINTER_READ_INVALID_POINTER_READ_msvcp140!mtx_do_lock+74

FAILURE_EXCEPTION_CODE:  c0000005

FAILURE_IMAGE_NAME:  msvcp140.dll

BUCKET_ID_IMAGE_STR:  msvcp140.dll

FAILURE_MODULE_NAME:  msvcp140

BUCKET_ID_MODULE_STR:  msvcp140

FAILURE_FUNCTION_NAME:  mtx_do_lock

BUCKET_ID_FUNCTION_STR:  mtx_do_lock

BUCKET_ID_OFFSET:  74

BUCKET_ID_MODTIMEDATESTAMP:  653aa208

BUCKET_ID_MODCHECKSUM:  923b1

BUCKET_ID_MODVER_STR:  14.29.30153.0

BUCKET_ID_PREFIX_STR:  APPLICATION_FAULT_NULL_POINTER_READ_INVALID_POINTER_READ_

FAILURE_PROBLEM_CLASS:  APPLICATION_FAULT

FAILURE_SYMBOL_NAME:  msvcp140.dll!mtx_do_lock

WATSON_STAGEONE_URL:  http://watson.microsoft.com/StageOne/unknown/3.12.4150.1013/6671a24d/msvcp140.dll/14.29.30153.0/653aa208/c0000005/00013080.htm?Retriage=1

TARGET_TIME:  2024-07-31T20:18:13.000Z

OSBUILD:  19045

OSSERVICEPACK:  4597

SERVICEPACK_NUMBER: 0

OS_REVISION: 0

SUITE_MASK:  256

PRODUCT_TYPE:  1

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

OSEDITION:  Windows 10 WinNt SingleUserTS

USER_LCID:  0

OSBUILD_TIMESTAMP:  1991-04-07 11:33:26

BUILDDATESTAMP_STR:  191206-1406

BUILDLAB_STR:  vb_release

BUILDOSVER_STR:  10.0.19041.1.amd64fre.vb_release.191206-1406

ANALYSIS_SESSION_ELAPSED_TIME:  f568

ANALYSIS_SOURCE:  UM

FAILURE_ID_HASH_STRING:  um:null_pointer_read_c0000005_msvcp140.dll!mtx_do_lock

FAILURE_ID_HASH:  {f7938165-b4af-ccbf-11b4-f442616c9ba8}

Followup:     MachineOwner
---------

0:000> k
 # Child-SP          RetAddr           Call Site
00 000000d1`80fecc98 00007ffe`89d34030 ntdll!NtWaitForMultipleObjects+0x14
01 000000d1`80fecca0 00007ffe`89d33f2e KERNELBASE!WaitForMultipleObjectsEx+0xf0
02 000000d1`80fecf90 00007ffe`8bba1f5a KERNELBASE!WaitForMultipleObjects+0xe
03 000000d1`80fecfd0 00007ffe`8bba1996 kernel32!WerpReportFaultInternal+0x58a
04 000000d1`80fed0f0 00007ffe`89dfdcb9 kernel32!WerpReportFault+0xbe
05 000000d1`80fed130 00007ffe`8c255898 KERNELBASE!UnhandledExceptionFilter+0x3d9
06 000000d1`80fed250 00007ffe`8c23ce56 ntdll!RtlUserThreadStart$filt$0+0xa2
07 000000d1`80fed290 00007ffe`8c25292f ntdll!_C_specific_handler+0x96
08 000000d1`80fed300 00007ffe`8c202554 ntdll!RtlpExecuteHandlerForException+0xf
09 000000d1`80fed330 00007ffe`8c25143e ntdll!RtlDispatchException+0x244
0a 000000d1`80feda40 00007ffe`53693080 ntdll!KiUserExceptionDispatch+0x2e
0b 000000d1`80fee1f0 00007ffe`1a40b224 msvcp140!mtx_do_lock+0x74 [D:\a\_work\1\s\src\vctools\crt\github\stl\src\mutex.cpp @ 103] 
0c 000000d1`80fee250 00007ffe`1a455003 pedalboard_native_cp312_win_amd64!juce::GenericInterpolator<juce::Interpolators::ZeroOrderHoldTraits,1>::interpolate+0x644
0d 000000d1`80fee3e0 00007ffe`1a3dddff pedalboard_native_cp312_win_amd64!juce::GenericInterpolator<juce::Interpolators::ZeroOrderHoldTraits,1>::pushInterpolationSample+0x48593
0e 000000d1`80fee5b0 00007ffe`1a432d2d pedalboard_native_cp312_win_amd64!juce::PatchedFlacAudioFormat::getQualityOptions+0x3838f
0f 000000d1`80fee6a0 00007ffe`1a45e10c pedalboard_native_cp312_win_amd64!juce::GenericInterpolator<juce::Interpolators::ZeroOrderHoldTraits,1>::pushInterpolationSample+0x262bd
10 000000d1`80fee740 00007ffe`1a45e224 pedalboard_native_cp312_win_amd64!juce::GenericInterpolator<juce::Interpolators::ZeroOrderHoldTraits,1>::pushInterpolationSample+0x5169c
11 000000d1`80fee830 00007ffe`1a3d3047 pedalboard_native_cp312_win_amd64!juce::GenericInterpolator<juce::Interpolators::ZeroOrderHoldTraits,1>::pushInterpolationSample+0x517b4
12 000000d1`80fee860 00007ffe`1a920913 pedalboard_native_cp312_win_amd64!juce::PatchedFlacAudioFormat::getQualityOptions+0x2d5d7
13 000000d1`80feee80 00007ffe`1a8d3f3d python312!PyCFunction_GetFlags+0xda3
14 000000d1`80feeeb0 00007ffe`1a8d7192 python312!PyObject_MakeTpCall+0x12d
15 000000d1`80feef10 00007ffe`1a8d40d9 python312!PyMethod_Self+0xe2
16 000000d1`80feefc0 00007ffe`1a8d42f6 python312!PyVectorcall_Function+0xb9
17 000000d1`80fef000 00007ffe`1a94d38f python312!PyObject_Call+0x46
18 000000d1`80fef040 00007ffe`1a93e83f python312!PyType_Ready+0x4e7f
19 000000d1`80fef0a0 00007ffe`1a3ce0b4 python312!PyType_Name+0x1b7f
1a 000000d1`80fef0e0 00007ffe`1a8d3f3d pedalboard_native_cp312_win_amd64!juce::PatchedFlacAudioFormat::getQualityOptions+0x28644
1b 000000d1`80fef170 00007ffe`1a8d4265 python312!PyObject_MakeTpCall+0x12d
1c 000000d1`80fef1d0 00007ffe`1aa0fcb3 python312!PyObject_Vectorcall+0x35
1d 000000d1`80fef210 00007ffe`1aa09606 python312!PyEval_EvalFrameDefault+0x64e3
1e 000000d1`80fef3d0 00007ffe`1aaa7026 python312!PyEval_EvalCode+0xe6
1f 000000d1`80fef450 00007ffe`1aaa7133 python312!PyRun_FileExFlags+0x296
20 000000d1`80fef490 00007ffe`1aaa340e python312!PyRun_FileExFlags+0x3a3
21 000000d1`80fef4d0 00007ffe`1aaa2f1e python312!PyRun_InteractiveLoopFlags+0x3fe
22 000000d1`80fef570 00007ffe`1a84f70c python312!PyRun_InteractiveLoopObject+0x25e
23 000000d1`80fef5d0 00007ffe`1a84fe5a python312!Py_gitidentifier+0xae1c
24 000000d1`80fef610 00007ffe`1a850348 python312!Py_gitidentifier+0xb56a
25 000000d1`80fef6b0 00007ffe`1a8503d2 python312!Py_RunMain+0x18
26 000000d1`80fef6e0 00007ff6`333d1490 python312!Py_Main+0x52
27 000000d1`80fef750 00007ffe`8bb47374 python!OPENSSL_Applink+0x380
28 000000d1`80fef790 00007ffe`8c1fcc91 kernel32!BaseThreadInitThunk+0x14
29 000000d1`80fef7c0 00000000`00000000 ntdll!RtlUserThreadStart+0x21
Gdalik commented 2 months ago

Something weird happens on Windows 10 (64 bit) when upgrading to pedalboard v0.9.7+, when an app/script uses some other C-based libraries as well. My app crashes on startup with code -1073741819 (0xC0000005) at the point where it tries to open and read any audio file. No problems on macOS, though. Still works with the same codebase after downgrading to pedalboard<=0.9.6 ... I couldn't reproduce this with a simple test script which uses only pedalboard as the single dependency. Can this be caused by the windows default integer issue in numpy?

psobot commented 2 months ago

Thanks @Gdalik and @anvuew for the report - I've tried to reproduce this segfault on Windows 10 with Python 3.12, but I'm unable to reproduce the same crash with either NumPy 2+ or NumPy 1:

Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug  6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pedalboard
>>> pedalboard.load_plugin(pedalboard.VST3Plugin.installed_plugins[0])
<pedalboard.VST3Plugin "ValhallaSupermassive" at 0000024D57253120>

Gdaliy, I see you import a number of other native dependencies in EarQuiz - any chance you can reproduce this on your end by importing each of those in the same process?

Also interesting: the native stack trace posted by @anvuew above doesn't seem to make sense (although thank you for it); certain stack frames are listed back-to-back despite those functions having no relationship with each other, which would imply some sort of memory corruption or an invalid pointer somewhere.

Gdalik commented 2 months ago

@psobot I have the same issue with the new version branch (with Python 3.10 and Python 3.11), which uses fewer dependencies. The only C/C++-based libraries here are pedalboard, NumPy and PyQt6. The other ones are written in Python... I couldn't recreate this issue by importing them to a simple script.

Gdalik commented 2 months ago

I have just tested it with Python 3.12. The same issue...

psobot commented 2 months ago

Thanks @Gdalik! When you say:

I couldn't recreate this issue by importing them to a simple script.

Just to confirm, you mean just importing all three of these native dependencies (pedalboard, numpy, and PyQt6) wasn't enough to trigger the segfault? That seems to point to some incompatibility that only shows up after certain functions have been called in each library. 🤔

Gdalik commented 2 months ago

Yes, I also imported the rest Python-based libraries. And I also wrote some lines of code, calling each of these libraries. BTW: In EarQuiz Frequencies, I use multiprocessing, which is not used in my test script. I don't know if this is important or not...

anvuew commented 2 months ago

After testing in a freshly installed Windows 10 VM, I found that the issue is related to Miniconda, Specifically Miniconda3-py310's base environment. It’s strange because previously, it didn’t work in any environment, but now it works in environments other than the base environment.

Gdalik commented 2 months ago

@psobot, I have finally made the minimal reproducible example, and I have created the separate issue for that.

Thanks!