Sign in to follow this  
sirob

Blue screen of death? what the? [solved]

Recommended Posts

Yikes! I'm working on a bit of code, and when running my code with certain values (number of quads to draw) at some value, I get a blue screen of death (windows "stop"). It starts dumping my memory and tells me to reboot. Heres the code:
bool cTerrain::Mark(int x, int y, int size)
{
	TerrainVertex *Vertices;
	Vertices = new TerrainVertex[6 * size * size];
	TerrainVertex *TmpBuffer = Vertices;
	for (short i = 0; i < size; i++)
		for (short j = 0; j < size; j++)
		{
			TmpBuffer[0] = m_TData.CreateQuad(x + i, y + j, 0, 0);
			TmpBuffer[1] = m_TData.CreateQuad(x + i, y + j, 0, 1);
			TmpBuffer[2] = m_TData.CreateQuad(x + i, y + j, 1, 0);
			TmpBuffer[3] = m_TData.CreateQuad(x + i, y + j, 0, 1);
			TmpBuffer[4] = m_TData.CreateQuad(x + i, y + j, 1, 1);
			TmpBuffer[5] = m_TData.CreateQuad(x + i, y + j, 1, 0);
			TmpBuffer += 6;
		};
	m_Device->SetTexture(0, 0);
	m_Device->SetRenderState(D3DRS_ZFUNC, D3DCMP_GREATEREQUAL);
	float bias = 0.6f;
	//m_Device->SetRenderState(D3DRS_DEPTHBIAS, *(DWORD*)&bias); 
	m_Device->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *(DWORD*)&bias); 
	m_Device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, size * size * 2, Vertices, sizeof(TerrainVertex));
	bias = 0.0f;
	//m_Device->SetRenderState(D3DRS_DEPTHBIAS, *(DWORD*)&bias); 
	m_Device->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *(DWORD*)&bias); 
	m_Device->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS);
	return false;
}



What I'm doing is just basic decalling, nothing special. As long as size is 1 or 2, nothing bad happens and everything is nice and dandy. I wanted to see how a 16x16 decal would look, so I pushed size up to 16, and got the screen of death. I thought it might have something to do with using too much memory (I had heroes 4 open), so after rebooting, I recompiled and tried again - same thing happened. I've turned it back down to 2, and all is well, but I don't even know where to start with this. What could even be causing this? I thought I might try increasing the size until I hit where it fails, but I don't see how that would do any good. Any ideas? btw, Windows XP, though I doubt it matters :). [Edited by - sirob on October 22, 2005 1:30:34 PM]

Share this post


Link to post
Share on other sites
Thank god for the event viewer, wouldn't want to do that again :).

The stop was 0x0000008E.

Heres some info I found on the web:
Quote:

0x0000008E: KERNEL_MODE_EXCEPTION_NOT_HANDLED
(Click to consult the online MSDN article.)
A kernel mode program generated an exception which the error handler didn’t catch. These are nearly always hardware compatibility issues (which sometimes means a driver issue or a need for a BIOS upgrade).
“STOP 0x0000008e” Error Message During Windows XP Setup {KB 315335} Win XP
Games: “Stop” Error Message That References Nv4_disp.dll {KB 325730} Flight Simulator, other games (wth Nvidia-based video adapter)
Your Computer Stops Responding When You Use the Highlighter Feature & the Font Color Feature {KB 829578} Win XP


I'm reading the thing about Nv4_disp.dll, as I have an NVidia card.
[edit] *sigh* That article isn't there anymore. I'm looking for cached versions of it :(. Also, thanks for your help :).

Share this post


Link to post
Share on other sites
Quote:
Blue Screen Error "STOP: 0x0000008E"

Page 1 of 1

(solution id: 1662)

The key in finding the failure behind this problem depends on what other information Windows gives you. Here are some related search results on the Microsoft support site for this error.

Typically this seems to be one of two problems. The first is a memory issue, and Microsoft says it can be fixed by making sure you have the latest updates.

It also references NVidia drivers being corrupted. If you have an Nvidia card, it's possible that this error is caused by bad drivers. Make sure you completely unisntall the old drivers and reinstall the new drivers (simply reinstalling might not fix the problem).

If you have problems still, you'll need to contact either Nvidia or Microsoft for further assistance.



Blizzard.com - World of Warcraft

Share this post


Link to post
Share on other sites
Here's a little more in-depth data, compliments of WinDbg:

Quote:

The KERNEL_MODE_EXCEPTION_NOT_HANDLED bug check has a value of 0x0000008E. This indicates that a kernel-mode program generated an exception which the error handler did not catch.

Parameters
The following parameters are displayed on the blue screen.

Parameter Description
1 The exception code that was not handled
2 The address at which the exception occurred
3 The trap frame
4 Reserved


Cause
This is a very common bug check. To interpret it, you must identify which exception was generated.

Common exception codes include:

0x80000002: STATUS_DATATYPE_MISALIGNMENT
An unaligned data reference was encountered.

0x80000003: STATUS_BREAKPOINT
A breakpoint or ASSERT was encountered when no kernel debugger was attached to the system.

0xC0000005: STATUS_ACCESS_VIOLATION
A memory access violation occurred.

For a complete list of exception codes, see the ntstatus.h file located in the inc directory of the Windows DDK.

Resolving the Problem
If you are not equipped to debug this problem, you should use some basic troubleshooting techniques. Make sure you have enough disk space. If a driver is identified in the bug check message, disable the driver or check with the manufacturer for driver updates. Try changing video adapters. Check with your hardware vendor for any BIOS updates. Disable BIOS memory options such as caching or shadowing.

If you plan to debug this problem, you may find it difficult to obtain a stack trace. Parameter 2 (the exception address) should pinpoint the driver or function that caused this problem.

If exception code 0x80000003 occurs, this indicates that a hard-coded breakpoint or assertion was hit, but the system was started with the /NODEBUG switch. This problem should rarely occur. If it occurs repeatedly, make sure a kernel debugger is connected and the system is started with the /DEBUG switch.

If exception code 0x80000002 occurs, the trap frame will supply additional information.

If the specific cause of the exception is unknown, the following should be considered:

Hardware incompatibility. First, make sure that any new hardware installed is listed on the Microsoft Windows Hardware Compatibility List (HCL).

Faulty device driver or system service. In addition, a faulty device driver or system service might be responsible for this error. Hardware issues, such as BIOS incompatibilities, memory conflicts, and IRQ conflicts can also generate this error.

If a driver is listed by name within the bug check message, disable or remove that driver. Disable or remove any drivers or services that were recently added. If the error occurs during the startup sequence and the system partition is formatted with NTFS file system, you might be able to use Safe Mode to rename or delete the faulty driver. If the driver is used as part of the system startup process in Safe Mode, you need to start the computer by using the Recovery Console to access the file.

If the problem is associated with Win32k.sys, the source of the error might be a third-party remote control program. If such software is installed, the service can be removed by starting the system using the Recovery Console and deleting the offending system service file.

Check the System Log in Event Viewer for additional error messages that might help pinpoint the device or driver that is causing bug check 0x1E. Disabling memory caching of the BIOS might also resolve the error. You should also run hardware diagnostics, especially the memory scanner, supplied by the system manufacturer. For details on these procedures, see the owner's manual for your computer.

The error that generates this message can occur after the first restart during Windows Setup, or after Setup is finished. A possible cause of the error is lack of disk space for installation and system BIOS incompatibilities. For problems during Windows installation that are associated with lack of disk space, reduce the number of files on the target hard disk. Check for and delete any unneeded temporary files, Internet cache files, application backup files, and .chk files containing saved file fragments from disk scans. You can also use another hard disk with more free space for the installation. BIOS problems can be resolved by upgrading the system BIOS version.


Hope that gives you some more info!

Share this post


Link to post
Share on other sites
Well, I'm back with no good news.

After installing new drivers (*begin rant* and removing my motherboard drivers in the proccess - which include my network adapter drivers - forcing me to move them from a different machine on a USB drive 'cause the CD drive just had to jam up now *end rant*).

Those were 60 minutes I won't be getting back :).

Anyhow, I tried it again with the new drivers, but no potato.

I did however manage to get rid of the blue screen simply by deleteing the memory I was allocating (simple, eh? :)).

I'm still getting wild colors if the size is over 4, but now at least I can debug without rebooting every single time.

Anyhow, thanks for the help, everyone!

Share this post


Link to post
Share on other sites
Yay!

Image Hosted by ImageShack.us

Thanks to everyone for helping out!

Turns out DrawPrimitiveUP was causing some problems. I'm not sure why, but once I switched to using a VB everything worked out just right. Weird, but it works :).

Share this post


Link to post
Share on other sites
Quote:
Original post by furby100
If it's a kernel mode thing it can only be your drivers being dumb (i.e. it's not your fault).

I don't think so. Provide a gfx driver with invalid data (e.g. a bad pointer or invalid data) and it might choke on it. Kernel mode errors are most likely to be caused by damaged hardware, but that doesn't rule out (user mode-) software errors completely.

Share this post


Link to post
Share on other sites
I've never had a windows stop running any commercial or indie game yet. Also, fixing a memory leak solved the stop, so I'm guessing it is my fault.

I'm still unsure why DPUP fails with more than 50 primitives, though I've had problems with it before. I really don't like it that much.

Anyhow, I'm happy with it as it is. :)

Share this post


Link to post
Share on other sites
have you tried running with the d3d debug runtime, and "break on error"?
it usually catches problems before they cause a bsod.

(it's _almost_ always a misuse of the api)

edit: actually, looking at your code i can see one problem: you're never freeing the memory you're allocating.

Share this post


Link to post
Share on other sites
It's one of two things:

1) there's a bug in one of the drivers for your system, most likely graphics or AGP drivers (or, possibly but not likely, a low-level DirectX runtime bug)

2) you have marginal hardware, where your RAM is going old, or your bus is noisy, or something like that.

Running a RAM and bus tester like SiSoftware's Sandra ought to show you if it's #2. If that runs fine, then it's likely #1 (although Sandra can't find things like marginal AGP bus signal quality)

Share this post


Link to post
Share on other sites
Quote:
Original post by rept
edit: actually, looking at your code i can see one problem: you're never freeing the memory you're allocating.


Sorry to be rude, but been there, done that:
Quote:

Also, fixing a memory leak solved the stop, so I'm guessing it is my fault.


Quote:
Original post by hplus0603
It's one of two things:

1) there's a bug in one of the drivers for your system, most likely graphics or AGP drivers (or, possibly but not likely, a low-level DirectX runtime bug)

2) you have marginal hardware, where your RAM is going old, or your bus is noisy, or something like that.

Running a RAM and bus tester like SiSoftware's Sandra ought to show you if it's #2. If that runs fine, then it's likely #1 (although Sandra can't find things like marginal AGP bus signal quality)


Yah, like I said, since it was a memory leak that caused the stop directly (more or less), I don't see it being a problem. If I encounter something like this again, I'll look into the stuff you suggest.

Thanks all, but as far as I'm concerned, this issue is done, isn't it? (I'm adding solved to the title, maybe that'll finally kill it!).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this