question

DaveNelson-6847 avatar image
0 Votes"
DaveNelson-6847 asked DaveNelson-6847 commented

Server 2012 R2 - RemoteApp - Application not exiting cleanly

Hey all,

Am hoping you can help with this query.

I have published an old 32-bit application using RemoteApp on Server 2012 R2. We're currently in UAT so the RD setup is fairly simple; 1 server handles the Connection Broker, Gateway and RD Web roles, 1 server is a Session Host where the application is installed, and I have a separate licence server.

Everything runs fine. Application fires up, users can login and test. All good.

The issue is exiting. Once the user completely exits the application, the session disconnects but the published application's exe is still running in memory, so if the user tries to connect again the application thinks it is already running and the user gets a message saying as much. As a workaround I set the disconnected session timeout to be 5 mins (with customer agreement) so that the max they have to wait to get back in again is 5 mins. Oddly, if there is only one session on the session host server, the application exits cleanly. This only seems to be an issue with 2 or more users (which for Production would obvs be a bigger issue).

The servers are housed in our datacentre and as such are not overly hit with GPOs. I can't see anything that would force the exe to stay in memory from a GPO perspective. Process and File monitor didn't reveal any issues as far as I can tell.

Any information of help would be gladly welcomed.

Thanks all,

Dave.

remote-desktop-serviceswindows-server-2012
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JiaYou-MSFT avatar image
0 Votes"
JiaYou-MSFT answered DaveNelson-6847 commented

HI

"Once the user completely exits the application, the session disconnects but the published application's exe is still running in memory "

1.If enable "set time limit for disconnected sessions" and set it to 1 minute, after this user's session log off, will the old 32-bit application be running in the memory?

2.If the problem persist, we can modify below command and copy to a batch file( I named 2.bat) and insert it in task scheduler to kill all your old 32-bit application processes(and subprocess) for specified user (or user group) after he close his/their remote app.
My example is kill rdpclip.exe process, you can modify it to your specified application process.

taskkill /im rdpclip.exe /F /T
logoff

Detail steps to create task scheduler on RD session host server like below:
When running the task, use the following use account, I use Myrds\u1, It also can be user group.
107524-60.png
107487-61.png
107535-62.png
107499-63.png
107506-64.png
107536-65.png

3.If the problem persist, we can contact Microsoft phone support engineer to get a command to kill the memory cache for your remoteapp and insert it to batch file. Finally, we can run the above similar task scheduler to kill your remoteapp completely after the end user close this remoteapp.



query process
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/query-process

taskkill
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/taskkill

============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


60.png (29.6 KiB)
61.png (40.3 KiB)
62.png (31.9 KiB)
63.png (29.0 KiB)
64.png (31.3 KiB)
65.png (81.1 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hey,

Thanks very much for you detailed reply.

  1. We already have "set time limit for disconnected sessions" set, only for 5 minutes and not 1. When the users' disconnected session is logged off, the 32-bit process (and everything else) is killed off so that does provide a solution of sorts.

  2. That is a really neat solution if the 32-bit process decided to hang around if "set time limit for disconnected sessions" didn't work, which it does, thankfully.

However, the issue I would like to get to the bottom of is why the executable doesn't exit cleanly. What I would like to know if this is a RemoteApp issue (which I am not convinced it is) or a server 2012 R2 issue (or GP, etc). Hope that makes sense.

Cheers,

Dave.



0 Votes 0 ·

HI DaveNelson-6847,

Thanks for your reply.

"However, the issue I would like to get to the bottom of is why the executable doesn't exit cleanly".
OK, I think Microsoft phone support will help you further more, he will using RDStracing/procmon/dump debug tool to discover the no dead
thread/memory cache.


If the current issue is related server 2012 OS issue and we can reproduce the issue on fresh install w2012 RDS session host(with full update) environment, I think we can consider using w2019 session host environment and check if the same issue also happen.

if the current issue is related remoteapp issue, I think we contact this remoteapp vendor to confirm if there is a latest version.

============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

1 Vote 1 ·

Agree. I will Mark your original answer and 'answered' as both options given are good workarounds for the issue I am seeing.

I am hopefully speaking with MS Support tomorrow (23rd June 2021) so will update once I have spoken to them.

Many thanks again for your input and help.

0 Votes 0 ·
JiaYou-MSFT avatar image
0 Votes"
JiaYou-MSFT answered DaveNelson-6847 commented

HI
I am researching your issue, thanks for your waiting.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Many thanks for getting in touch. FYI, I have a ticket open with MS Support. I will post any updates from them here by way of information.

Many thanks,

Dave.

0 Votes 0 ·