HoerTech-gGmbH / openMHA

The open Master Hearing Aid (openMHA)
http://www.openmha.org
GNU Affero General Public License v3.0
252 stars 74 forks source link

Problem in Windows 10 with 4.13.0 and JACK 1.9.16 win64. #45

Closed apasanen closed 3 years ago

apasanen commented 3 years ago

Hi,

I'm having issue with version 4.13.0 (2609ffdf215b) / JACK 1.9.16 win64 in Windows 10.

mha is working normally in windows after compiled according to the instructions in https://github.com/HoerTech-gGmbH/openMHA/blob/master/COMPILATION.md#iii-compilation-on-64-bit-windows-advanced. gain_getting_started.cfg works normally, but gain_live_getting_started.cfg exits abnormally.

F:\examples\00-gain>mha --interactive
The Open Master Hearing Aid (openMHA) server version 4.13.0 (2609ffdf215b)
Copyright (c) 2005-2020 HoerTech gGmbH, D-26129 Oldenburg, Germany

This program comes with ABSOLUTELY NO WARRANTY; for details see file COPYING.
This is free software, and you are welcome to redistribute it
under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE, Version 3;
for details see file COPYING.

mha [1] ?read:gain_getting_started.cfg
(MHA:success)
mha [2] cmd=start
(MHA:success)
mha [3] cmd=quit
(MHA:success)

F:\examples\00-gain>mha --interactive
The Open Master Hearing Aid (openMHA) server version 4.13.0 (2609ffdf215b)
Copyright (c) 2005-2020 HoerTech gGmbH, D-26129 Oldenburg, Germany

This program comes with ABSOLUTELY NO WARRANTY; for details see file COPYING.
This is free software, and you are welcome to redistribute it
under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE, Version 3;
for details see file COPYING.

mha [1] ?read:gain_live_getting_started.cfg
(MHA:success)
mha [2] cmd=start

F:\examples\00-gain>echo %errorlevel%
-1073741819
hendrikkayser commented 3 years ago

Hi, thanks for reporting. Another user with a comparable setup also reported an issue that seems to be related to the same Jack version. She described her workaround (downgrading Jack to an older version) in our user forum: https://forum.openmha.org/viewtopic.php?t=7&p=186#p186

If that is an option for you, can you try and confirm if that helps? We will definetly look into that issue, but it may take a while...

tobiasherzke commented 3 years ago

Jack2 has seen multiple updates on Windows this year. We have not updated the version on our build server in some time. Maybe we are seeing a DLL incompatibility. Trying to reproduce the error while doing some analysis:

1) I have a windows installation with jackd2 version 1.9.11 and openMHA version 4.12.0.

Starting a Jack server with 44100/1024 and then starting openMHA with mha ?read:gain_live_getting_started.cfg cmd=start sleep=1 cmd=quit succeeds. The configuration file uses MHAIOJackdb, which links against C:\WINDOWS\libjack64.dll which is part of the Jack2 1.9.11 installation.

2) Updating openMHA to version 4.13.0 by downloading and executing the openMHA windows installer.

After the openMHA update, the example still runs the same without error. MHAIOJackdb still links against C:\WINDOWS\libjack64.dll which is part of the Jack2 1.9.11 installation.

3) Updating jack2 to version 1.9.16: Before updating Jack2, I collect the files of the existing 1.9.11 installation in a tar archive for later comparisons ($ tar cvzf ~/jack2.1.9.11.tgz /c/Program\ Files\ \(x86\)/Jack /c/Windows/*jack*). Then I stop and quit the running Jack server and download and execute the 1.9.16 64bit windows installer.

After this, my Jack installation is broken: Starting a jack server with qjackctl hangs, rebooting does not improve things. I see that I have now two jack directories, C:\Program Files (x86)\Jack which probably still has the previous Jack installation and C:\Program Files\Jack2 which seems to have the new installation. I remove both installations with Add/Remove programs -> uninstall and reinstall the 1.9.16 version. Starting Jack with qjackctl works again after this.

Starting a Jack server with 44100/1024 and then starting openMHA with mha ?read:gain_live_getting_started.cfg cmd=start sleep=1 cmd=quit now fails.

MHAIOJackdb finds the Jack DLL still at C:\WINDOWS\libjack64.dll.

But comparing the .def files between both versions shows that 4 additional DATA symbols have been added to 1.9.16 version that were not present in the 1.9.11 version which cause a shift of all function symbols by 4 indexes: jackdiff. Our IO plugins depending on libjack, when they call functions in libjack while linked against libjack 1.9.11, will call completely unrelated functions when the libjack dll for 1.9.16 is available, because the jack2 project chose to not preserve dll def index numbers. That choice, I want to point out, is completely acceptable for open-source projects like jack2 in my opinion. I believe that we do similar changes for openMHA windows releases. Because it is open-source, you can expect users to upgrade to latest versions (it does not cost anything).

In this case, because we have not been aware of the recent compatibility-breaking changes in Jack2 for windows, we have not upgraded jack on our build server before releasing openMHA 4.13.0. This is something that we can fix before our 4.13.1 or 4.14.0 release. We should include in our INSTALLATION.md documentation that on windows we require jack2 in version 1.9.16 or later so that users know to update any old jack installations on windows that they may have installed.

apasanen commented 3 years ago

Perfect. That explains. Thans, Antti

tobiasherzke commented 3 years ago

I have made my tests with Jack 1.9.16 with the "dummy" Jack driver because I was not able to start Jack 1.9.16 on that windows installation with a real sound card.

I am currently testing an openMHA fix for this issue on another windows PC with Jack 1.9.16, and also there, I am not able to start Jack with a real sound card.

Because of this second occurrence, I get the suspicious if Jack 1.9.16 is able to start on Windows at all with a real sound card. Have you had success? Maybe we need to stick with an earlier Jack version instead, and file a bug report against Jack. With qjackctl so far, I always get "unable to connect to Jack as a client", or a hang when trying to start a Jack 1.9.16 server with a real sound card on windows.

apasanen commented 3 years ago

I've been using Jack 1.9.16 with portaudio / ASIO interface and real hardware successfully. However Jack server is crashing with the other laptop when using embedded audio hw.

tobiasherzke commented 3 years ago

Thanks for the hint to use an ASIO driver. However, 1.9.16 exhibits the same behaviour for me with ASIO: hangs until killed by the task manager. After uninstalling 1.9.16 and installing 1.9.11, Jack works and can be started, both with a single ASIO interface as well as with separately selected input and output devices.

We need to check with a third, clean windows system, but the most likely outcome of this that I can forsee is that we should recommend an older version of Jack2 for Windows (1.9.11), describe how to download it, and file a bug against Jack2.

apasanen commented 3 years ago

ok, sounds good.

apasanen commented 3 years ago

Actually JACK 1.9.16 is working without issues from command line.

JACK2\qjackctl\QjackCtl.exe shows Version: 0.6.3, which is outdated.

tobiasherzke commented 3 years ago

Thanks for the additional input, which will be considered. From what I've seen, the problem is not limited to qjackctl: jack_lsp also hung for me when invoked after starting jackd from the command line (all in 1.9.16). We will perform some checks on a fresh windows installation next year.

tobiasherzke commented 3 years ago

On a fresh windows installation, Jack 1.9.16 (and also Jack 1.9.17) seem to work fine with the onboard sound card (tested with Virtualbox). However, due to the unreliability issues that we have found in Jackd 1.9.16 on Windows with sytems that had a previous installation of Jack 1.9.11, we have decided that openMHA will continue to depend on Jack 1.9.11 (only on Windows) for now and have documented this in file INSTALLATION.md in commit 8496cd2, together with a pointer to a download location for Jack 1.9.11.

We will revisit this decision in the future, but at least the upcoming 4.14.0 release will still depend on Jack 1.9.11.