Remote Desktop Affects Windows Application on network interruption

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

To demonstrate my problem, I have a very simple VB Windows application. It
has a text box that is used to display a counter, a button to reset the
counter, and a timer that increments the counter every second.

I remote desktop to the computer hosting this application and run the
application. It starts up and displays the counter incrementing every
second. If I disconnect the network cable between the two computers for 10
seconds and reconnect it, the application has "hung" while the network has
been disconnected -- my counter has not been incrementing.

If I run the same test, but minimize the application before disconnecting,
then upon reconnect and un-minimizing, it is evident that the counter
continued to run while the network was disconnected.

I tried another test where I started up this application and an application
that was similar. I minimized one and left the other alone. I disconnected
the network and re-connected. After un-minimizing the one, it was evident
that BOTH applications failed to increment their counters while the network
was disconnected.

Any ideas on what is causing this problem and if there is a way around it
(the desired behavior is that internally the counter continues to increment
regardless of the network connectivity.

Thanks
 
Hi,

Based on my understanding, you remote desktop B to a computer A and runs an
application on computer A. When the application is run, you disconnect the
network cable between the two computers. After some time, you reconnect the
network and find that the application has "hung" while the network has been
disconnected because the counter in the application has not been
incrementing. If I'm off base, please feel free to let me know.

I performed a test based on your description, but didn't reproduce the
problem on my part.

I create a WinForm application similar to yours and place it on a machine
installed Windows XP. I remote a desktop installed Vista to the machine
installed Windows XP and run the application.

The application starts up and displays the counter incrementing every
second. When the texbox on the form shows 10, I disconnect the network
cable. After 10 seconds, I reconnect the network cable. The Vista machine
tries to reconnect the remote desktop connection. After it finishes the
reconnection, I see the textbox on the form displayes 20.

I also have a test minimizing the form before I disconnect the network
cable. The result is that the application keep running when the network is
disconnected.

I think the problem may be related to the remote desktop connection. When
the network cable is disconnected, you may login the machine that was
remote connected to directly to see whether the application is really hung.

Could you tell me what the OS of your remote desktop and the machine that
is remote connected to are respectively? As I have mentioned above, in my
test, the remote desktop is intalled Windows XP and the the machine remote
connected to is intalled Windows Vista.

If you have anything unclear, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thank-you for your reply. Your understanding of the problem is correct. In
my situation computer B that was doing the remote desktop is running Windows
XP Professional 2002 Service Pack 2. Computer A is running Windows Server
2003 Standard Edition Service Pack 1.

I repeated the test this morning where both computers were running Windows
XP Professional 2002 Service Pack 2 -- with the same results. I logged into
computer A after disconnecting the network cable between them, the
application was now running, but the count was below what it should have been
(essentially it lost the counts between the network being disconnected until
I could get logged in).

I then repeated the test with computer A running Windows Vista Ultimate
Release Candidate 1 - Build 5600 and computer B running Windows XP
Professional 2002 Service Pack 2 -- with the same results (count was not
being updated while network was disconnected).

The VB application was built with Visual Studio 2005 as a Release version.
The code itself is:

File Form1.vb:

Public Class Form1

Dim m_counter As Integer = 0

Private Sub Button1_MouseClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Button1.MouseClick
m_counter = 0
TextBox1.Text = m_counter
End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
m_counter = m_counter + 1
TextBox1.Text = m_counter
End Sub

Public Sub New()

' This call is required by the Windows Form Designer.
InitializeComponent()

' Add any initialization after the InitializeComponent() call.
Timer1.Enabled = True

End Sub
End Class

File Form1.Designer.vb:

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(68, 51)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(124, 22)
Me.TextBox1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(92, 111)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 37)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Reset"
Me.Button1.UseVisualStyleBackColor = True
'
'Timer1
'
Me.Timer1.Interval = 1000
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(269, 194)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Name = "Form1"
Me.RightToLeftLayout = True
Me.Text = "RDP Test Application"
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Timer1 As System.Windows.Forms.Timer

End Class

If it would help for me to send the Visual Studio files and/or the
executable, let me know.
Your help is greatly appreciated.
 
Hi,

Thank you for your prompt reponse.

Your application seems almost the same as mine. Could you tell me how you
determine whether the application is hung when the network cable is
disconnected?

You have also mentioned that after the network is disconnected, you log
into the computer A and find that the program is running. At this time, the
network is not reconnected and it should prove that the program does not
hang when the network cable is disconnected.

You may send your application to me for test. To get my actual email
address, remove 'online' from my displayed email address.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Linda Liu said:
Hi,

Thank you for your prompt reponse.

Your application seems almost the same as mine. Could you tell me how you
determine whether the application is hung when the network cable is
disconnected?

When I do my test, I bring up the clock so that I can see the seconds hand
on it. I run my application and hit the reset button when the time is
hh:mm:00. Since my counter is incrementing every second, the seconds portion
of the computer time should match the value of my counter for the first
minute. I then perform the network disconnect for 10 seconds or so and
connect back up. When I connect back up, the counter is 10 or so behind the
seconds portion of the computer time.
You have also mentioned that after the network is disconnected, you log
into the computer A and find that the program is running. At this time, the
network is not reconnected and it should prove that the program does not
hang when the network cable is disconnected.

It is true that when I log into the computer that the application is no
longer hung, but it is missing the "counts" between the time I disconnect the
network cable until the time I log in. The process of logging in causes the
application to no longer be hung. .
You may send your application to me for test. To get my actual email
address, remove 'online' from my displayed email address.

I've sent you an e-mail with the application enclosed. (Sent 4/26/2007 8:15
AM CDT)
 
Hi,

Thank you for your detailed explanation on how you test whether the
application is hung when the network is disconnected.

I performed tests based on your method and did see the problem on my part.

I will go on research on this issue and will get the result back to you
ASAP. I appreciate your patience!

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Hi,

I have searched in our inner database, but unfortunately, I didn't find a
similar issue in it.

I will consult this issue in our inner discussion group and will get back
to you as soon as I get an answer.

I appreciate your patience!

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Hi,

I got a reply from our inner discussion group. It suggests that I use the
System.Timers.Timer instead of the System.Windows.Forms.Timer component.

I have a try using System.Timers.Timer on the form, and do see that the
problem doesn't exist in this case. The number the application shows is the
same as the second portion of the computer time, after reconnection
finishes.

You may also have a try using System.Timers.Timer component in your
application to see if you get the same result as I do.

If you also get the same result, it should prove that the application
doesn't hung during the disconnection.

I look forward to your reply.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
I modified the test application I sent you to use the System.Timers.Timer
component and get the same results you did -- it works.

Could you explain why the System.Windows.Forms.Timer component doesn't
behave the same? Is this a bug? Is this problem just isolated to this
particular component or is it wider in scope in that it is using an
underlying mechanism that is being affected by the network connection and
anything else that uses this underlying mechanism is also going to hang?

I need to understand the entire issue, since the real application is a lot
more complicated than the simple test program. It is a C++, multi-threaded
CBuilder application (an existing application from another company -- don't
have the time or money to convert it over to a Visual Studio application)
that is controlling equipment and can not afford to be hung up due to a RDP
session active when the network connection goes down.

Any information you could provide me would be greatly appreciated.

Thanks
 
Hi,

Sorry for my delayed response.

I think the problem has to do with the WinForms Timer relying on Windows
messages on the UI thread and these messages aren't being received during
the period that the network cable is reconnected.

On the contrary, the Sytem.Timers.Timer is a server-base timer which
doesn't rely on Windows messages, so it is more accurate than WinForms
Timer.

If the C++ multi-thread application doesn't use a component that relies on
Windows messages to control equipment, it should not hang up when the
network is disconnected.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Hi,

How about the problem now?

If you have any question, please feel free to let me know.

Thank you for using our MSDN Managed Newsgroup Support Service!


Sincerely,
Linda Liu
Microsoft Online Community Support
 
Still looking into what we are going to do. We discovered another quirk with
this application and using Remote Desktop. If the application is started
directly from the console and then someone remote desktop's to the console
(using same user name), the application ends up exiting. If the application
is started through a remote desktop session (to the console) and the RDP
session is disconnected and then connected again -- no problems, application
continues to run. But if someone accesses the console directly (same user),
the application exists.

This is a condition was noticed on the production system. I tried a similar
test on a non-production server, and instead of the application exiting, it
just hangs -- unresponsive -- and then I have to kill it.

Both are Windows Server 2003. The production server had a recent windows
update applied to it.

Any thoughts?
 
Hi,

Sorry for my delayed response.

I perform a test according to your description, but don't see that the
application hangs when I remote connect to the machine.

Instead, I do see that the number shown in the textbox is 1 or so behind
the second portion of the clock on the machine after the remote connection
finishes (the number is equal to the second portion before I attempt to
connect to the machine).

I have searched in our inner database, but didn't find a similar issue in
it.

I am discussing this problem in our team, and I will update you as soon as
I have any new finding.

I appreciate your patience!

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Hi,

After discussion, we'd like to have a Product Support Professional from
Microsoft CSS work with you to resolution. Please note that there will be
no cost to you for this support incident.

To expedite creation of the support incident, please e-mail me with the
following information(to get my actual email address, remove 'online' from
my displayed email address):

o Customer Name
o Customer email address
o Company Name, if applicable
o Best times to reach you, and your time zone.
o Microsoft Support Contract Information, if applicable
o Complete Address
o Daytime Telephone Number
o Operating System(s) In Use
o Operating System Language, especially if not US English
o Application Language, especially if not US English
o Any additional telephone number(s), in case you cannot be reached at your
primary telephone number.

After I receive an e-mail from you with the requested information, I will
create a support incident for you. Then, one of our support professionals
will contact you to establish a mutually convenient time to work on this.

Thank you again for your patience in working on this issue in the community.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Back
Top