Target application terminated before entering 'main()' if capturing an OpenGL trace with NSight Systems


I’m having problems running the NVidia NSight Systems (v2021.1.1) on a C++, OpenGL, QT application if choosing to collect the OpenGL trace while runing NSight Systems capture.


What happens is that the target application terminates itself before entering the ‘main()’ function. And it only happens if “Collect OpenGL trace” is checked in the capture options, otherwise it works ok. A more visually descriptive illustration can be seen from attached images where i took snapshots of a timeline for the collected report and also its Diagnostics Summary. Images are called “Big_picture_timeline.png”, “Close_up_timeline.png” and “Diagnostics_summary.png”.



Here are some well tested facts i can confirm in regards to the situation:

FACT_1: Target and Host are the same PC (localhost capture).
FACT_2: The application itself - without tracing - runs normally.
FACT_3: It is a graphical application running on Windows, instantiating multiple windows in runtime of which all are sharing the same OpenGL context.
FACT_4: The application is terminated before entering the ‘main()’ function of the targeted project.

FACT_5: The tracing works well with the following capture options (can be set all at once or individually):
– Sample target process
– Collect CPU context switch trace
– Collect CUDA trace
– Collect NVTX trace
– Collect WDDM trace

FACT_6: If “Collect OpenGL trace” is included in the capture options, the problem occurs.
FACT_7: The problem occurs even if “Collect GPU workload trace” and tracing all of the OpenGL functions is disabled under checked “Collect OpenGL trace” option (everything possible under this OpenGL option).
FACT_8: The problem occurs also if “Collect OpenGL trace” is the only option selected.
FACT_9: I ran all the necessary programs with administrator privilages.

FACT_10: The application is a QT 5.12.6 application.
FACT_11: Another few - much simpler - applications work well, using the same OpenGL libraries as this project.
FACT_12: The problem occurs even if all OpenGL calls are excluded from runtime execution (commented out).
FACT_13: The OpenGL version used is 4.6.

FACT_14: Since the first occurance of this problem, i have updated the GPU drivers and the result was still the same.


I know that the application terminates itself before entering the ‘main()’ function. I confirmed it by storing a dummy .txt file to desktop (tested on a normal application execution and it works) but the file wasn’t there when tracing OpenGL. This was the first thing that the main() function did and it didn’t do it.


I tried running the trace capture from command line interface as well (using GIT Bash). I got the message “The target application returned non-zero exit code -1073741819” and - if i’m not mistaken - this translates to C0000005 which - on MSDN - means ACCESS DENIED. In order to run the NSight Systems i used the following command: “nsys profile -t opengl --duration 10 -o ./_OUTPUT/report_1 --force-overwrite true -w true --kill true ./MY_APP.exe”. I also tried using a much simpler command, stating only the necessary “-t opengl” but the result was the same. A full CLI output is visible from the attached image called “CLI_run.png”.


Then - wondering about the difference between successfully running CUDA trace and unsuccessfully running OpenGL trace - i tried to figgure the difference between the two. What i did was using “strace” command before the upper mentioned CLI call to ‘nsys’. This allowed me to see a bunch of .dll loading calls and after collecting them alphabetically and comparing them in text comparing program, i noticed, that when running OpenGL trace, two .dll files were not mentioned anywhere in the ‘strace’ output whereas they were present with the successful CUDA trace. These .dll files were called “qwindows.dll” and “qwindowsvistastyle.dll”. These belong to QT as far as my understanding goes and this is why i’m suspicious that QT has something to do with it. Combining this information with upper mentioned ACCESS_DENIED - if that really was the case - i’m thinking that maybe these .dlls weren’t reachable for some reason if OpenGL trace was used (they reside in their own folders for example ‘…exe_path/platforms/qwindows.dll’ as the QT convention dictates. It’s also worth mentioning that this was the only difference between working CUDA and non-working OpenGL trace outputs in regards to using ‘strace’ and observing .dll filenames.


I also tried tempering with the NSight Monitor settings. I disabled WDDM TDR (which was enabled and set to 2 seconds), disabled “Driver Instrumentation Enabled” setting but the problem remained.

Unfortunately i cannot send you this project, it belongs to the company i work for. All i can say is that it’s fairly complex and list you the libraries that we’re using in case NSight Systems could clash with one of them. And all the smaller scale projects i’ve used to test this are working fine with OpenGL trace enabled. It’s also worth mentioning, that i couldn’t get Visual Studio’s instrumentation profiler to work with this same project (but that might have been an issue related to something else). I can also say that using Apitrace program worked with capturing the data but NSight seems the way i’d really like to go.

If you have any ideas on what i could try further or perhaps any known issues i’ve missed checking the forums, i’d be really greatful. Getting NSight to run would benefit us greatly.

I would also like to take this opportunity to compliment you on the great work you’re doing. NSight seems like a really great set of tools. Keep up the good work!

Thank you for your time and Best Regards!


CPU: Intel(R) Core™ i7-6700K CPU @ 4.00Ghz
GPU: NVidia GeForce GTX 980 Ti
Driver version: 461.72
OpenGL version: 4.6

OS: Windows 10 Pro (x64)
NSight Systems: 2021.1.1
NSight (VSE): 2020.3.1.21012 (Standard)
Visual Studio: VS Professional 2019, version 16.9.0

Hi CyBear,

Thank you for a very detailed report and for the warm compliments.

First, I suggest you try to trace with Nsight Systems 2021.2.1 which has been released just days after you posted.

If the problem persists, please turn on logging:

  1. Copy the file C:\Program Files\NVIDIA Corporation\NVIDIA Nsight Systems 2021.2.1\host-windows-x64\nvlog.config.template to the working folder of your target application.
  2. Rename the copied file from “nvlog.config.template” to “nvlog.config”
  3. Rerun Nsight Systems and launch a trace.
  4. Look for a file named nsys-ui.log at the same directory.

You can upload the log file to this thread or send it via email (more private) to:


Hi Doron, thank you for the reply!

Unfortunately updating to version 2021.2.1 didn’t solve the problem.

I took the log as you suggested, obscured some of the personal but irrelevant information so i’ll just post it here.

nsys-ui.log (13.1 KB)

I couldn’t make much of the log but i did see a few “exception” words contained within. At the end of the log these “FAILED” on GL calls for counters and “TryGetGLVersion()” caught my eye so i double checked the version of my OpenGL.

The version indeed is 4.6, at least as far as the program “OpenGL Extension Viewer (” goes. I’m using GLEW and checked in code if it supports OpenGL 4.6 via simple “if( GLEW_VERSION_4_6 )” and it returns true. Also all the shaders begin with “#version 460 core” so i’m assuming that the version on my system must really be 4.6.

I hope this sheads some light on the problem. If there’s anything else i could try please let me know.