Skip to content

[335] Process priority high hangs RDP session on server shutdown #12573

Closed
MrSmite opened this Issue Jul 19, 2014 · 15 comments

5 participants

@MrSmite
MrSmite commented Jul 19, 2014

Core: c28345e
DB: TDB_full_335.52 + updates
OS: Win 7 SP1

Bug:

When you set the process priority to HIGH either through config or task manager, the system hangs during server shutdown when issued over Remote Desktop (RDP)

Details:

  • Log in to the machine remotely using Remote Desktop 7.1
  • Change the Process Priority to HIGH in the config
  • Start the server
  • When it is finished loading, issue the CTRL+C command to stop the server
  • The entire RDP session hangs for approximately 1 to 3 minutes (no keyboard or mouse input)

Notes:

This is probably a conflict with the RDP session thinking that CTRL+C is a COPY command. Perhaps we could change the server to use a different combination, such as CTRL+ALT+C?

@MrSmite MrSmite changed the title from [335] Process priority high hangs RDP session on shutdown to [335] Process priority high hangs RDP session on server shutdown Jul 19, 2014
@DDuarte
TrinityCore member
DDuarte commented Jul 19, 2014

I doubt we can change CTRL+C. That's a special Windows key combination that sends SIGINT to the process.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms682541(v=vs.85).aspx

@Warpten
TrinityCore member
Warpten commented Jul 19, 2014

let's spawn taskkill !

@Aokromes
TrinityCore member

use .server restart / server shutdown 1 as workarround

@MrSmite
MrSmite commented Jul 20, 2014

I doubt we can change CTRL+C. That's a special Windows key combination that sends SIGINT to the process.

Interesting, I didn't know that. Now that I think about it, I don't think it's a problem with COPY like I originally thought, the behavior doesn't happen with the process set to normal priority.

use .server restart / server shutdown 1 as workarround

Thanks, I will try that.

@jaredjones

This is in no way an issue or problem with TrinityCore. This is simply a byproduct of shitty Microsoft employees that don't know how to code a proper kernel.

I'd potentially understand if this happened if you set the priority to RealTime, however the fact that the system freezes with high priority is beyond me.

@MrSmite
MrSmite commented Jul 20, 2014

use .server restart / server shutdown 1 as workarround

This has the same effect.

This is in no way an issue or problem with TrinityCore

If it happened on all priority types then maybe but given that it only happens on high and even the console command has the same effect, it indicates it might something to do with the core itself.

More information:

When you set high priority using the config file, the core stays in normal priority during startup and sets itself to high at the end. During the startup process you can use CTRL+C through RDP and it will shutdown the server without hanging the RDP session.

It is only after the loading finishes and the process is set to high does it have this behavior. I will have to try logging into the machine directly and see if it also hangs the Windows session.

I think the issue is actually that the cleanup process (grid unloading, database stuff, etc.) while being done on high priority is what's eating the system. Maybe we should set the process back to normal when it receives the CTRL+C so it can process the shutdown at a lower priority.

@jaredjones

Were you having these problems before the BOOST rollover?

@DDuarte
TrinityCore member
DDuarte commented Jul 20, 2014

This is all we do about the process priority: https://github.com/TrinityCore/TrinityCore/blob/master/src/server/shared/Threading/ProcessPriority.h#L52
it's one single call to the Windows API SetProcessAffinityMask(hProcess, currentAffinity)

@MrSmite
MrSmite commented Jul 20, 2014

Were you having these problems before the BOOST rollover?

Yes, I didn't report it because I was in the midst of switching over to Win 7 to see if it was an XP issue

This is all we do about the process priority: https://github.com/TrinityCore/TrinityCore/blob/master/src/server/shared/Threading/ProcessPriority.h#L52
it's one single call to the Windows API SetProcessAffinityMask(hProcess, currentAffinity)

Nay, I think you meant to quote SetPriorityClass, not SetProcessAffinityMask

And my suggestion was to call SetPriorityClass(NORMAL_PRIORITY_CLASS) when the SIGINT is received so the core can do all its cleanup and grid unloading without hogging the system. I think that's the issue because it doesn't even print the console message.

When the process is running at normal, it will print a message about the server shutting down. When it is at high it doesn't because it consumes so much of the system resources that the console window doesn't update.

@DDuarte
TrinityCore member
DDuarte commented Jul 28, 2014

Nay, I think you meant to quote SetPriorityClass, not SetProcessAffinityMask

Indeed, I meant SetPriorityClass (my point still stands).

@DDuarte
TrinityCore member
DDuarte commented Jul 28, 2014

Won't fix / not an issue. If your computer can't handle the extra load by running in high priority, don't use high priority.

@DDuarte DDuarte closed this Jul 28, 2014
@MrSmite
MrSmite commented Jul 28, 2014

Won't fix / not an issue. If your computer can't handle the extra load by running in high priority, don't use high priority.

I can run the server at high just fine, in fact I always run at high. Using CTRL+C or the shutdown command while logged directly into the computer is also fine. It's only when issuing the command through remote desktop that it hangs the RDP process.

I understand not wanting to fix it because it's probably an issue with RDP but it's not correct to assume my computer can't handle high priority.

@DDuarte
TrinityCore member
DDuarte commented Jul 28, 2014

Sorry about the assumption, that's what I understood from "it consumes so much of the system resources that the console window doesn't update".

Aokromes suggested to use TeamViewer instead of RDP.

Edit: Sorry for sounding like a dickhead for closing the issue but this is likely something that we can't fix and/or a Windows bug. We already got our hands pretty full with all the issues introduced in the "Boost update".

@MrSmite
MrSmite commented Jul 28, 2014

Sorry about the assumption, that's what I understood from "it consumes so much of the system resources that the console window doesn't update".

Aokromes suggested to use TeamViewer instead of RDP

Good timing, I was just googling RDP replacements for windows 7 :)

Ah, yes my comment about the resources was that it showed the RDP process at 99% when I hit CTRL+C and it caused the trinity console window to freeze and never display the shutdown message. Interestingly the whole RDP window terminates when the core finally closes. I really do think it's some sort of weird conflict with RDP and CTRL+C.

My quick solution was a small EXE that I wrote which uses PostMessage() to send the CTRL+C to the console after a few seconds delay. That lets me log out of RDP before everything goes to hell.

PS: I also never had this problem with RDP 6 from Win XP.

@MrSmite
MrSmite commented Aug 8, 2014

Just an update:

I noticed today that when the console hung as reported in the OP, when it finally closed and I went to shutdown the MySQL server, the console reported a bunc of warnings about connections. It scrolled by too quickly to see.

I am now running the console while piping output to a file. I will post the results should it happen again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.