VOGONS


First post, by Rincewind42

User metadata
Rank Member
Rank
Member

I've recently started testing demoscene productions in DOSBox, and a strangely high number of them cause MCB chain corruptions which ultimately results in all sorts of misbehaviour and/or a hard DOSBox process crash.

That's with the stock settings, so UMB enabled. Now the strange thing is that if I disable UMB, then virtually all these misbehaving programs start acting normally and they don't corrupt the MCB chain.

Why I suspect this is a bit suspicious and should not be just shrugged off is that I did run a lot of these demoscene productions on my 486 DX2/66 + GUS setup back in the 90s and I don't remember this level of stability issues. My DOS setup was rock stable and I was running all the demos and tools written by demosceners that hit the hardware directly and have a lot of "dirty" code. Which makes me suspect that something is not completely right on the emulation side of things, therefore I wanted to raise awareness on this potential issue.

As I said, I can trigger these problems with UMB enabled with a rather large set of programs. But the erratic behaviour or crash is not always immediately apparent, so I've included one very particular case in a reproduction pack I've attached. Using this repro pack and my specific instructions, the crash can be triggered 100% of the time with UMB on, and the same steps result in no crash and no MCB corruption 100% of the time with UMB off. Better yet, the program that triggers the bad behaviour is a 256-byte intro with the full asm source included, which should hopefully help in narrowing down the issue even further and hopefully fixing it (if it's indeed an emulation issue as per my suspicion).

All the files in the attached ZIP are either shareware (DOS Navigator, the shareware version of PKZIP) or free to copy (the intro in question).

I've conducted my testing using Dominus' SVN build from https://www.dosbox.com/wiki/SVN_Builds, but I can reproduce the exact same behaviour in other DOSBox variants too (unsurprisingly).

Repro steps:

1. Unpack the repro pack to a directory and start DOSBox SVN from that directory.
2. DOS Navigator will be started automatically, the cursor is on puls4x1.com in the left pane. Press enter to start the 256-byte intro.
3. Let it run for a few seconds, then hold Esc to quit.
4. Press Tab to move the cursor to the right pane, then press enter on imphob6.zip to browse the contents of the ZIP file.
5. Press F3 on any file inside the ZIP archive to view its contents. This will invariably result in a hard crash with the "Exit to error: Corrupt MCB chain" message in the console.
6. Now repeat the exact same steps from 1 but with UMB disabled in the config (uncomment umb = false in dosbox.conf). The crash will never happen.

If anyone more experienced with the low-level workings of DOS memory management is willing to look into this, that would be greatly appreciated! I can share further test cases and a list of erratically behaving programs with UMB enabled on further request! (all public domain scene stuff and free to copy)

Thanks!

Attachments

  • Filename
    umb-crash-1.zip
    File size
    1.29 MiB
    Downloads
    82 downloads
    File license
    Public domain

DOS: Soyo SY-5TF, MMX 200, 128MB, S3 Virge DX, ESS 1868F, AWE32, QWave, S2, McFly, SC-55, MU80, MP32L
Win98: Gigabyte K8VM800M, Athlon64 3200+, 512MB, Matrox G400, SB Live
WinXP: Gigabyte P31-DS3L, C2D 2.33 GHz, 2GB, GT 430, Audigy 4

Reply 1 of 3, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Real DOS returns an error code to the calling program when memory allocation/deallocation functions fail due to a corrupt MCB chain. However, the system will likely be halted if/when the program tries to exit back to DOS with a corrupt MCB chain, where there will be a message like "Unable to load COMMAND.COM, system halted".

DOSBox's internal emulation of DOS has an error exit when the MCB chain is found to be corrupt during a memory function. FYI, an error exit in DOSBox is not a "crash" in the strict sense -- it informs the user that the system has become unstable before an actual crash occurs.

Given the above difference in how memory chain corruption is handled, have you tried your test case(s) in real DOS with UMBs? And remember that in real DOS all programs must be exited back to DOS with no halting of the system for there to be no issue.

Reply 2 of 3, by Rincewind42

User metadata
Rank Member
Rank
Member

Thanks for your reply, @ripsaw8080! I've done some further testing and the plot thickens!

Test 1

Real hardware with MS-DOS 6.22 (see my signature). Running the intro when UMB is available does not crash the machine, but consumes all available UMB (MEM reports zero after running it once). The "ZIP test" works fine. I can start the intro for a second time, and things still appear normal. If I start it a third time, though, I get some random chars printed on the screen when I try to exit it, then one beep, and the machine hangs.

I repeated this several times after rebooting and it's consistent; the system crash happens after exiting the intro exactly for the 3rd time.

Interestingly, I'm getting the same behaviour both with UMB and without it, with only conventional memory.

Test 2

Now this gets interesting! When I use real DOS in DOSBox SVN via an HDD image, I get no crashes whatsoever with UMB either enabled or disabled. Although all UMB memory gets consumed after running the intro, I can run it any number of times and I get no crashes and the "ZIP test" always works. So the MCB chain doesn't get corrupted.

I have attached the repro pack on a minimal HDD image for your convenience. Just start DOS Navigator with DN, then follow the repro steps from my original
post.


This proves there is definitely a difference between running real DOS in DOSBox SVN or on real hardware versus the emulated DOS environment of DOSBox. Of all three, the emulated DOS environment with UMB enabled is the "most crash prone". Interestingly, running real DOS in DOSBox seems to be the most stable; it's actually more stable than real hardware in that particular case! I'm not sure I want it to mimic the hardware behaviour in this case 😀

Anyway, maybe this points to some fundamental issue about memory handling in the emulated environment which will perhaps lead to better emulation and/or stability if it gets rectified (if there's anything to rectify, that is).

Attachments

DOS: Soyo SY-5TF, MMX 200, 128MB, S3 Virge DX, ESS 1868F, AWE32, QWave, S2, McFly, SC-55, MU80, MP32L
Win98: Gigabyte K8VM800M, Athlon64 3200+, 512MB, Matrox G400, SB Live
WinXP: Gigabyte P31-DS3L, C2D 2.33 GHz, 2GB, GT 430, Audigy 4

Reply 3 of 3, by Rincewind42

User metadata
Rank Member
Rank
Member
ripsaw8080 wrote on 2023-06-20, 15:02:

Given the above difference in how memory chain corruption is handled, have you tried your test case(s) in real DOS with UMBs? And remember that in real DOS all programs must be exited back to DOS with no halting of the system for there to be no issue.

Just wondering if you've had a chance to investigate this further perhaps using the provided HDD image repro pack?

I guess it's not a deal-breaker in the sense that one can simply disable UMB and nothing of major value is lost (as you don't really need to load any drivers in DOSBox anyway), but it's an interesting one for sure.

Plus most (all?) games don't care about UMB at all.

DOS: Soyo SY-5TF, MMX 200, 128MB, S3 Virge DX, ESS 1868F, AWE32, QWave, S2, McFly, SC-55, MU80, MP32L
Win98: Gigabyte K8VM800M, Athlon64 3200+, 512MB, Matrox G400, SB Live
WinXP: Gigabyte P31-DS3L, C2D 2.33 GHz, 2GB, GT 430, Audigy 4