NVIDIA Stereo 3D Vision service bug causes handle leak
Affected: GeForce 8800 GT and higher, 9600 GT and higher, or any GeForce 200 series and higher, using driver version 186.xx and up.
Update (8/10): A NVIDIA representative has indicated the fix will be “available in the next driver release” sometime this month.
While poking around Process Explorer, I stumbled upon a process having a curiously high handle count. Having dealt with leaky components before, I identified the 64 handle/minute pattern almost immediately.

Figure - Process Explorer viewing nvSCPAPISvr.exe open file handles
As the description indicates, this particular component (a Windows service) is responsible for some sort of NVIDIA Stereoscopic feature. With some Bing’ing around, I discovered this functionality is only useful if you use 3D glasses shown on the NVIDIA 3D Vision product page.
While I could have simply stopped the service – which shouldn’t be configured to start Automatically to begin with – I decided to dive a little deeper to understand the issue.
After some disassembly, I found string references to \INF\OEM*.INF which led me to a piece of code wrapped in a loop. My ASM to C++ hand transcribed version of the code (not representative of the real product):
GetWindowsDirectoryA(260, path); strcat(path, "\\INF\\OEM*.INF"); HANDLE find_handle = FindFirstFile(path, &wfd); if(find_handle != INVALID_HANDLE_VALUE) { do { HANDLE inf_handle = SetupOpenInfFile( wfd.FileName, NULL, INF_STYLE_WIN4, error_line); // [...] Additional code to search for nvstusb.cat/sys } while(FindNextFile(find_handle, &wfd)); FindClose(find_handle); }
The bug isn’t obvious at first glance. The issue lies within the use of SetupOpenInfFile. The handle returned by this function is never passed into SetupCloseInfFile, leaving various internal file and mutex handles open consuming a large amount of memory (as this user reported in July).
To mitigate this issue, I strongly suggest you stop and disable the NVIDIA Stereoscopic 3D Driver Service. If you use its stereoscopic features, I suggest you only use the service for short amounts of time.
Although the latest drivers I’m using aren’t WHQL signed (190.56), this problem also exists in all drivers versioned 186.xx and up. This range is inclusive of WHQL and non-WHQL signed drivers. I, again, urge Microsoft to include some sort of Application Verifier testing with all components bundled with WHQL submitted drivers.

Raf, you really need to make a business out of this.
So.. This is why my 7 was acting weird..
I was on 186.xx and every single time I wanted to play Trine I had to disable the 3D Stereoscopic glasses even tho I don’t use it.
Since I’ve installed 190.xx I’m not getting the 3D anymore but I’m having issues when 7 starts up, leaving me with a non-aero interface for more than 5 minutes..
Thanks!!!
I had 114,000 handles on that process. Thanks for the tip, shutting off the Stereoscopic 3D service fixed the issue.
I have no idea why that service is started in the first place, I have never enabled Stereoscopic video on this computer.
I have experienced Aero crashing once, not sure it was a result of this bug (there was no apparent reason).
@Bryant I agree with you 100 percent. :) He also needs to start a tutoring service because we could all learn a lot from his experience. lol. I am just starting to get into more heavy duty programming myself. For example, I am reading a Win32 book from Charles Petzold and learning quite a bit about how Windows works from it. I am also going to move on after that and learn the Object Oriented version of win32. I see that any modern Windows Programs seem to be coded in Object Oriented Win32. Anyway, excellent work Rafael! This will help me out a lot because I own and use Geforce 3D Vision. ;) Has anybody alerted Nvidia to this issue and put their developers on the correct path? lol.
@RicardoK Yeah, I have no clue why they integrated everything into one driver, but I suspect that it was a cost cutting measure. They wouldn’t have to support so much extra seperate code. I do have 3D Vision, but I know that most mainstream consumers do not have it yet and I disagree with their choice to do this. They either need to correct this code or disable the service for those that do not have the device detected.
Huh 3d drivers… have always given me problems…
The version numbers of the stereo driver package and the mainstream driver never seemed to match… stereo was usually a version or too behind. Really annoying when trying to install new drivers etc. as the setup always complains about the mismatch in versions.
Last time I tried to update the stereo drivers on my XP desktop, I uninstalled the NVIDIA drivers, but my computer never booted properly again. Specifically the keyboard driver stack would not load/crash (both on USB and PS/2). As I had a password I was unable to login and thus had to wipe my harddrive and reinstall windows.
Wow, I just found this too. Running on Windows 7 x64 rtm, uptime 3 days and 22 hours and did a quick processes check, found nvSCPAPISvr.exe sitting at 128k handles. Ridiculous.
Searched Google for ‘nvSCPAPISvr.exe handles’ and your article was the first to pop up. Good to know I’m not the only one having this problem. Disabling it immediately brought a surprisingly nice boost in system/GUI response. I was even hesitant to disable the service first thing installing the drivers with Win 7, considering I’ll never be using the feature if ever.
I can beat that handle count: 148420 on my 32-bit Vista Biz, 4GB.
I would not have known it was a problem except that I wanted to install the new version of Virtual Box (3.0.4) and the install kept dying. Process monitor reported sharing violation when *.inf files were accessed. Surprise, nvscpapisvr.exe had its hands on the files. As Virtual Box needs to install drivers, no surprise there.
Another question is why they are polling a folder which almost never changes.
So many developers have not heard of the change notification system in Windows, it seems:
http://msdn.microsoft.com/en-us/library/aa365261%28VS.85%29.aspx
(Just remember to close that change-notify handle when you’re done with it. :-) :-) :-) )
But, really, that service shouldn’t even be running when its features are not in use. Not that NVidia are alone in that, but I’ve had enough with background processes which sit around doing nothing even when the features they are tied to are disabled. Stop it, people! That goes for Microsoft’s webcam, punkbuster, bonjour, VMWare (just from a quick look at my 2-day old Windows 7 install)… If I’m not using something WTF is it running, polling things ini files (which MS webcam + VMWare both do too), wasting resources and harming my boot time? Gah.
Hi
I work at NVIDIA and I will have our SW team investigate to see if this a real issue.
@Andrew Awesome! Thank you for looking into this issue. :)
Why wouldn’t it be a real issue? Are you saying all these people are lying?
Leo: Thankfully, Windows 7 adds features to Task Scheduler which allow it to more intelligently start and stop services when they are no longer needed. Hopefully third-party devs will take a cue.
I tend to stop or disable those services you describe unless/until I need them.
jon: I think he just said that wrong, obviously they need to do their own testing and reproduce it internally.
I can beat you all: 0 handles, process non-existant (ATI FTW!!!)
That explains why my friend’s Nvidia “beast” was acting so strange… I’ve informed him and he’s pretty happy now
More and more like Mark everyday :D
Glad to hear nVidia have picked this up, Rafael doing his bit for the internet community again!
Hi
This should be fixed in our next driver release.
@Andrew: I’ll update the post accordingly.
i uninstalled it after out of curiousity activating it in the NVIDIA cpl. Both monitors went haywire. Had to reboot to safe mode to get rid of it.
After reading this post I went ahead and checked it out, besides the high handle count of nvSCPAPISvr.exe, I identified another process with the same issue (RazerTray.exe) used by the Razer Mamba mouse driver, currently at 9037 handles and increasing:
http://img170.imageshack.us/img170/5764/leak.png
I didn’t look at how many handles it had open, but its peak working set on my machine was at 889 MB, nearly 1/4 of my 4GB! Doh!
Glad I happened to be checking to see how much Firefox was leaking and noticed this new process using so much memory. Now it’s disabled and I should never lose that almost gigabyte of RAM again. Yay!
Just noticed the odd amount of consumed RAM in Task Manager, Binged the process name and here I am. It’s disabled and I’m a happy camper. Thank you! :)
As long as “the next driver release” does NOT leave the nvSCPAPISvr.exe to start up a service that is unused by 99.3% of the people, especially when Stereovision has not been enabled in the nV Control Panel, then all will be fine.
I’m very surprised that this issue was somehow missed by both nVidia AND the Windows WHQL team, and also when it was discovered a new video driver with the fix should have been immediately released instead of just waiting and adding it to an upcoming release.
Anyway, a big “Thank you!” goes out from one more voice from the interweb!
Anybody know whether the video output from my NVIDIA GeForce 8800 GT 3D Stereo CPL could be used to display L/R images on alternate pixel rows of a standard LCD of compatible resolution and aspect ratio to the Zalman 22in. I want to experiment with parallax barriers.
Thanks man… I was looking through my Windows Task Manager and found this curious process with a LOT of handles. I can honestly say that I got the current high score on the handle count. I had +- 210 000 handles on that process. I am running Windows 7 RC with 2GB of ram. This was my work pc that I never switch off