View Issue Details

IDProjectCategoryView StatusLast Update
0003160FSSCPgraphicspublic2015-05-29 03:57
ReporterGoober5000 Assigned Tom_m  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformDell Precision M4800OSWindows 7 
Product Version3.7.2 
Fixed in Version3.7.3 
Summary0003160: Periodic freezes when running under the NVIDIA GPU
DescriptionI alluded to this in ticket 0003130 but didn't elaborate as that was primarily about the beam crash.

When running a build using the NVIDIA GPU, the build will periodically and unpredictably freeze. Each freeze lasts from 5 to 15 seconds, and they happen every minute or so, with no apparent pattern. They occur in the main hall, in the tech room, and in the mission.

This occurs on builds compiled with 2005, 2008, and 2013. It does *not* occur on builds compiled with VS 6 (at least up to and including 3.7.2 final). This makes me wonder if it's due to a compiler option introduced post-VS6.

I doubt it's an overheating problem as the laptop has plenty of ventilation and doesn't feel particularly hot. And I doubt it's a driver problem as I updated the drivers about five times in the course of testing 0003130.
TagsNo tags attached.

Activities

Goober5000

2015-05-22 05:03

administrator   ~0016717

Interesting update. After Googling around using "Dell Precision M4800 graphics stutter", I ran across this thread:
http://forums.totalwar.com/showthread.php/147456-Issue-Stuttering-and-freezing-from-intro-cinematic-to-main-menu/page2

In the Task Manager, my process affinity was set to only use CPU 1 (the available choices where All Processors and CPU 0 through CPU 7, all with checkboxes). I messed around with the checkboxes a bit and when I set it to use All Processors, the stuttering stopped!

Is there a setting for changing the CPU affinity when the game starts up, just as there is for changing the GPU? If so, we could ensure that the CPU and GPU are changed in the same block of code.

Goober5000

2015-05-22 05:12

administrator   ~0016719

Incidentally, changing the CPU affinity does not prevent the beam crash bug. :sigh:

The_E

2015-05-22 05:55

administrator   ~0016721

Solutions seem to exist (see: http://stackoverflow.com/questions/12803585/example-usage-of-setprocessaffinitymask-in-c-c for Windows, http://stackoverflow.com/questions/8486314/setting-processor-affinity-with-c-that-will-run-on-linux for Linux, unsure about MacOS).

MageKing17

2015-05-22 06:02

developer   ~0016722

Additionally, Windows should default to everything having affinity for all available processes; it sounds like you've got something setting Explorer's affinity to a single core: http://blogs.msdn.com/b/oldnewthing/archive/2005/03/21/399688.aspx

m_m

2015-05-22 07:29

developer   ~0016723

FSO actively set the processor affinity to the second core when there are multiple cores on the system (https://github.com/scp-fs2open/fs2open.github.com/blob/master/code/osapi/osapi.cpp#L126). I can't think if any good reason to actually do this and messing with the OS scheduler isn't such a great idea.

@Goober: Does the issue still exists if you remove that line?

MageKing17

2015-05-22 07:38

developer   ~0016724

...What.

We have a registry setting for processor affinity? Is that documented anywhere?

FUBAR-BDHR

2015-05-22 07:48

developer   ~0016725

Last edited: 2015-05-22 07:54

The affinity being set was added years ago do to a problem with certain processors not liking FSO being set to run on multiple cores. There is a thread on it in either the SCP forum or the internal.

http://www.hard-light.net/forums/index.php?topic=55990

MageKing17

2015-05-22 08:04

developer   ~0016726

This is also not the first time the automatic affinity setting has caused performance issues for somebody: http://www.hard-light.net/forums/index.php?topic=82620.msg1649312#msg1649312

m_m

2015-05-22 10:31

developer   ~0016727

Forcing a process to run on a single core doesn't seem like a generally good idea, the scheduler should take care of that.
I'll see if removing that code causes any issues. Could we add a commandline option that forces the processor affinity instead of defaulting to use a single core?

MageKing17

2015-05-22 18:14

developer   ~0016728

I did some experiments with setting the registry entry to 0 (no preference) without any issues last night.

FUBAR-BDHR

2015-05-22 18:25

developer   ~0016729

The issue only affected specific processors so in order to test you would need to find out which processor line(s) had the flaw and who still has one.

Goober5000

2015-05-23 19:27

administrator   ~0016730

@m!m: Yes, commenting out the line removes the stuttering, and I confirmed via Task Manager that all CPUs were selected.

m_m

2015-05-26 17:34

developer   ~0016731

We now have multiple confirmed cases where setting the process affinity causes issues. I think that is reason enough to use the default affinity and only set it when a commandline flag is present.

The_E

2015-05-26 19:54

administrator   ~0016732

Seems pretty clear-cut to me.

chief1983

2015-05-26 20:38

administrator   ~0016733

It can be set that late into the runtime?

m_m

2015-05-26 20:42

developer   ~0016734

The documentation for SetProcessAffinityMask doesn't mention any restriction as to when this function may be called.

MageKing17

2015-05-26 21:36

developer   ~0016735

It's already set in response to a registry entry; it's hardly a huge difference in how long the executable has been running to set it in response to the commandline. In fact, parse_cmdline() is actually called earlier.

m_m

2015-05-26 22:01

developer   ~0016736

Pull request with the discussed changes: https://github.com/scp-fs2open/fs2open.github.com/pull/131

m_m

2015-05-27 12:34

developer   ~0016737

@Goober: Can you do a final test with the newest nightly now that the PR got merged?

Goober5000

2015-05-28 04:25

administrator   ~0016739

Newest nightly works without any stuttering.

Goober5000

2015-05-29 03:57

administrator   ~0016741

Marking as fixed.

Issue History

Date Modified Username Field Change
2015-05-22 04:07 Goober5000 New Issue
2015-05-22 04:08 Goober5000 OS => Windows 7
2015-05-22 04:08 Goober5000 Platform => Dell Precision M4800
2015-05-22 05:03 Goober5000 Note Added: 0016717
2015-05-22 05:12 Goober5000 Note Added: 0016719
2015-05-22 05:13 Goober5000 Status new => confirmed
2015-05-22 05:55 The_E Note Added: 0016721
2015-05-22 06:02 MageKing17 Note Added: 0016722
2015-05-22 07:29 m_m Note Added: 0016723
2015-05-22 07:38 MageKing17 Note Added: 0016724
2015-05-22 07:48 FUBAR-BDHR Note Added: 0016725
2015-05-22 07:54 FUBAR-BDHR Note Edited: 0016725
2015-05-22 08:04 MageKing17 Note Added: 0016726
2015-05-22 10:31 m_m Note Added: 0016727
2015-05-22 18:14 MageKing17 Note Added: 0016728
2015-05-22 18:25 FUBAR-BDHR Note Added: 0016729
2015-05-23 19:27 Goober5000 Note Added: 0016730
2015-05-26 17:34 m_m Note Added: 0016731
2015-05-26 19:54 The_E Note Added: 0016732
2015-05-26 20:38 chief1983 Note Added: 0016733
2015-05-26 20:42 m_m Note Added: 0016734
2015-05-26 21:36 MageKing17 Note Added: 0016735
2015-05-26 22:01 m_m Note Added: 0016736
2015-05-27 12:34 m_m Note Added: 0016737
2015-05-28 04:25 Goober5000 Note Added: 0016739
2015-05-29 03:57 Goober5000 Note Added: 0016741
2015-05-29 03:57 Goober5000 Assigned To => m_m
2015-05-29 03:57 Goober5000 Status confirmed => resolved
2015-05-29 03:57 Goober5000 Resolution open => fixed
2015-05-29 03:57 Goober5000 Fixed in Version => 3.7.3