MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by StroggVorbis »

I was playing Silentzorah's Doom Gaiden, MAP13: Villa de Rais (the secret level) and at the end of the level there's a red-keyed door. It's set to repeatable action and triggers ACS_Execute to change the track D_VILLAD to D_NULL, an empty one second MIDI, essentially stopping the music. From then on, opening the door again results in one of three outcomes, depending on the selected MIDI Device.

#1 OPL Synth & GUS: Opening the door works fine.

#2 FluidSynth & Microsoft GS Wavetable Synth: Each time the door is opened (try spamming 'Use') causes a hiccup, lag or delay, while the former Device has a shorter than the latter.

#3 VirtualMidiSynth: The game locks up and freezes, forcing me to kill the process via Task Manager. An error log or crash report doesn't pop up.

I couldn't test Timidity or Wildmidi, as I don't have either of them.

As a side note, it also happened with Jimmy's recently released Project Kate (my sincere condolences :( ), which, after looking at the ACS source via SLADE, has scripts which make use of SetMusicVolume. This caused a lockup after ending MAP02, not transitioning to the intermission screen and at the end of MAP03, where you stand on a 20% Damage + Exit < 10 sector.
Guest

Re: MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by Guest »

I'd say that your D_NULL is badly made and causes playback problems. Why aren't you just switching the music off?

Also, can you post that D_NULL.mid file?
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by StroggVorbis »

As stated in the OP, the mod isn't mine, its Silentzorah's. So your assumption should be directed at him. The crash happens in any map, I just used MAP13 as an example because it offers a straightforward method of reproducing the crash. Also, why should I disable the music? I said that not all MIDI output devices are affected. Your suggestion was neither helpful nor related to the problem. I guess you didn't even properly read my post.

P.S. Happened on GZDoom v3.2.4, used CoolSoft's VirtualMIDISynth in conjunction with the Arachno Soundfont from Arachnosoft.

Edit: I apologize, you were right. D_NULL was faulty. I replaced it with Doom 64: Retribution's D_SILENT and now it works fine. Still, I don't know why VirtualMidiSynth crashes, Microsoft's Default Soundmapper and FluidSynth have hiccups and the rest works fine.
wrkq
Posts: 31
Joined: Sat Apr 02, 2016 9:05 am

Re: MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by wrkq »

DabbingSquidward wrote:Also, why should I disable the music?
That was also written with the assumption of this being your mod - instead of SetMusic("D_NULL") "you" (the modder) could have done SetMusicVolume(0.0) instead.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by wildweasel »

wrkq wrote:
DabbingSquidward wrote:Also, why should I disable the music?
That was also written with the assumption of this being your mod - instead of SetMusic("D_NULL") "you" (the modder) could have done SetMusicVolume(0.0) instead.
That's as may be, but it doesn't fix the bug in ZDoom.
User avatar
Rachael
Posts: 13531
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by Rachael »

wrkq wrote:
DabbingSquidward wrote:Also, why should I disable the music?
That was also written with the assumption of this being your mod - instead of SetMusic("D_NULL") "you" (the modder) could have done SetMusicVolume(0.0) instead.
This is not helpful. The whole point of a bug report is not for you to provide work-arounds and telling people not to do things in order to not trigger the bug - they are reporting the bugs so they can actually be fixed and they don't have to.

Also, SetMusic(""); works just fine.
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by StroggVorbis »

I'll see if I can attach the D_NULL.mid file. The thing is, it plays back fine in XMPlay with VirtualMIDISynth, but it's obviously empty. D64: Retribution's D_SILENT Lump is not recognized by SLADE, I can't even play it back with XMPlay. I also wasn't able to pinpoint the reason for Kate's Project freezing after finishing MAP02 or 03. It doesn't happen all the time, but then again, only with VirtualMIDISynth. I could try updating that, but that still leaves us with the hiccups from FluidSynth (with DoomSND.sf2) and Microsoft's Soundmapper. Has anyone tried reproducing the freeze with gaiden.wad?
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by StroggVorbis »

https://zorasoft.net/doom/gaiden.zip

Doom Gaiden by Silentzorah, I hope he doesn't mind me linking to it here. Anyways, here's a quick run down of the crash:

1. Open the console, load MAP13.
2. Optional: 'Kill Monsters' or start with -nomonsters enabled.
3. Grab the red key, AFAIK giving it through console doesn't work.
4. Go to the red door at the end of the level and save.
5. Open it, the music should now be set to D_NULL.
6. Using the opened door again or dying (which causes a Castlevania death sound unique to this level to be played) at this point causes the aforementioned freeze or hiccups.

Happened 100% of the time.

It seems like the game doesn't like to set D_NULL twice or play anything else after that.

EDIT: The best thing would be to ask the man himself directly. Since its his mod, he knows more about it than anyone else and should be able to provide some insights regarding D_NULL :P
User avatar
Rachael
Posts: 13531
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by Rachael »

My hypothesis with this problem is that the MIDI system does not like zero-time files due to its preference to loop them. I noticed when I played it in SLADE it was instantly done. So it goes to play it, it's already over, so it loops it, it's already over, it loops it again, it's already over.... etc.

Not knowing how to manipulate the MIDI system in GZDoom, myself, I do not really know how to fix this.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by _mental_ »

In the second case lag is caused by reloading of sound font. Exact duration of such freeze depends on the hardware, CPU and HDD/SSD combination in particular.
There is nothing we can do about it. Redesigning whole MIDI playback for such purpose is out of scope at the moment.

Cannot say anything about the third case because I don't use VirtualMIDISynth.
Please note that in general it's not a problem of GZDoom if it hangs or crashes inside thirdparty software.
We are responsible (to some extents) for libraries shipped with stable releases.
Although if some issue is caused by user installed drivers or software then it's a very low priority for us to work on it.
Time spent on this can be significant but the chance to fix it is quite slim.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: MIDI Device Output Freeze/Crash/Hard Lock (Memory Leak?)

Post by Graf Zahl »

The problem: There's nothing here to fix!
The entire effect is how a MIDI restart will affect the current player's runtime behavior.

With Timidity++ (the new one, that is), GUS, OPL and Wildmidi there are no problems here as these devices keep their sound fonts around for reuse by a later song.
FluidSynth depends a lot on the size of the sound font and its current file cache status, but seeing how the sound font must be added to the player as a file name, the actual loading is not controllable by GZDoom, and since the player will be recreated for a new song, the old sound font attachments will be lost.
And Windows's internal synth is entirely outside our control, so is VirtualMIDISynth. If VirtualMIDISynth chokes on otherwise valid MIDI event data it needs to be fixed in that project.
Post Reply

Return to “Closed Bugs [GZDoom]”