-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hang when closing related to WinMM MIDI driver #3920
Comments
I can confirm the findings. It looks like it might be related to the M-Audio MIDI drivers. I have two sound devices that I can use for testing:
During the tests I have varied what device is set as the default sound device in Windows 8.1 and the MIDI driver that's used by LMMS:
Unfortunately I don't have the means to debug under Windows. Perhaps we can create a build that logs some info for LMMS' WinMM driver? |
Then LMMS should hang in
|
I am not a programmer, but I wonder if this could be relevant (found on MSDN and related to WinMM and MIDI—even better, the person having the problem was using an M-Audio card). The symptoms certainly sound similar. |
@vwren thanks for the research and the hint. It appears we're attempting to call that in the The major difference is that the article you've posted closed by handle whereas we loop over all devices and close. Also, the Microsoft API says that problems can occur if buffers are still busy.
This likely exposes a leak, but to patch it we may benefit from calling |
So something like:
|
This should also be done for midiOut, I'm thinking, to ensure that all buffers are freed before closing.
|
Yes. PS. I'm not hacking this by the way. I'm not anywhere near a Windows computer. |
|
@PhysSong i will install and see if i can get mem-leaks on win 32 |
@musikBear Thank you for testing. I'll test it and see if I can reproduce the crash. |
@PhysSong Unfortunately I am still getting the hanging processes with your patched executables. |
@PhysSong i ran into even more issues. The test-release cant load all factory-instruments. Trying to load free-boy a not found error pop-up, and then the application crash completely. This time with orphans. |
Ardour stopped using midiOutReset() after getting hangs: Ardour/ardour@d10913e |
It's possible that midiOutReset() is unstable. I know that SimplePiano uses the Reset/Close destructor for MIDI out, and for MIDI in, uses midiInStop(), midiInReset(), midiInClose(). I have never had it hang on me when closing, but it would take a larger sample size to have more confidence in it. (on further testing, I was wrong—the MIDI is unstable and it does hang, but the image is only 1.3MB and didn't cause much memory loss. So the destructor might be to blame) Another issue might be caused by the Midi Stream manager. http://mastersonicarts.uniroma2.it/wp-content/uploads/2016/01/MIDI-Specification-11.pdf (search for "midiOutReset" and read the WARNING paragraph after it). I kind of doubt that Ardour is using the stream manager, but I have no evidence one way or the other. It would appear that midiOutReset() is useful mainly for shutting down stuck notes, so its function is not orthogonal to midiInReset() which frees up buffer space. I'm finding differing opinions, but there seems to be some consensus around the idea that midiOutReset() is broken and unnecessary, especially if there's another mechanism for handling stuck notes. |
@vwren @michaelgregorius Here's a new build without |
@PhysSong, with version RC51 I now get a crash when I close LMMS (but the process is gone 😉). Here's some more information:
|
I found that I did something wrong with iterators. I've fixed the iterator issue and created new builds. |
@PhysSong, I have installed the 64 bit version of LMMS 1.2.0-RC52 and I am still getting a crash when I close the application even if I do not switch to the M-Audio interface. Steps are:
Additional info (does not look like it will help much though):
|
@michaelgregorius |
@PhysSong With lmms-1.2.0-rc6.14-win64.exe the crashes are gone and I also do not get any hanging processes anymore when I close the application. Looks like we can close this issue. 👍 🎉 @vwren Can you please test with the latest RC if the issue is fixed for you as well? |
I'll just upload 32bit binary and open a pull request. Good to hear that's working! |
Configuration: Windows 7 SP1 32-bit, LMMS V1.2.0RC4, M-Audio MIDISport 2+2, driver version 6.1.3
When closing LMMS, a "zombie" LMMS process is left in the Task Manager which cannot be killed. These chew up about 40MB at a time. If LMMS is started and stopped repeatedly, more copies of the process will show up in the Task Manager. In testing, I found that changing the audio back-end to "Dummy" did not make a difference in this issue, but changing the MIDI back-end to "Dummy" enabled LMMS to close successfully. If I changed it back to WinMM, LMMS left a dead process running. There are no error messages displayed, and it leaves no entries in the Windows system logs.
I have other applications that I use with MIDI (OpenMPT, saVihoST, SimplePiano) which use the MIDISport 2+2 driver directly, and they don't seem to have any difficulty with my setup. I would be curious about other MIDI USB devices and WinMM, but I don't have any others to test. Anybody with USB keyboard controllers might want to have a look at your task manager!
The text was updated successfully, but these errors were encountered: