I have a Windows Service in C# talking to a serial port and using Remoting.
It also uses several COM objects. On customer's computer the service will
occassionally hang somewhere - the service still shows on a Task Manager
list. In Services it says it is still running. However there is no way to
stop it other than by rebooting the whole computer. No exception (including
non-CLS) is ever generated. I added a separate System.Timers.T imer which
detects that the main thread stopped working. I was trying to stop it by
using System.ServiceP rocess.ServiceC ontroller.Stop( ) which didn't work. I
tried to do process.Kill() which also doesn't work (and no exception). Is
there a bug in framework somewhere. I don't even hope to find out why it
hangs but if I could just kill it that would solve the problem since I have
another Service which would bring it up. I'll be greatful for any ideas.
Kris. 4 9021
Does your application "hang" when you run it as an application?
Whenever I write a windows service application, there is a core section
which exposes start and stop methods which exist in an assembly (DLL). From
here I can apply any front end I like, whether it be windows service,
windows dialog, or a console application.
While doing any sort of debugging information, I flood the area I'm not sure
about with Console.Writeli ne(...) calls so that the program flow can be
easily traced, with details of relevant variables. In this case it would be
worth checking the status of your references to your COM objects. Are you
listening to a serial port or sending data to it?
From here it seems unlikely it's the "windows service" part of the
application that's causing the freeze.
"Kris" <Kr**@discussio ns.microsoft.co m> wrote in message
news:6F******** *************** ***********@mic rosoft.com... I have a Windows Service in C# talking to a serial port and using Remoting. It also uses several COM objects. On customer's computer the service will occassionally hang somewhere - the service still shows on a Task Manager list. In Services it says it is still running. However there is no way to stop it other than by rebooting the whole computer. No exception (including non-CLS) is ever generated. I added a separate System.Timers.T imer which detects that the main thread stopped working. I was trying to stop it by using System.ServiceP rocess.ServiceC ontroller.Stop( ) which didn't work. I tried to do process.Kill() which also doesn't work (and no exception). Is there a bug in framework somewhere. I don't even hope to find out why it hangs but if I could just kill it that would solve the problem since I have another Service which would bring it up. I'll be greatful for any ideas. Kris.
Dan,
Thanks for your reply. To answer your questions I both listen and talk to
the serial port and I actually have a GUI app that uses the same code as my
Service. I never ran it long enough to make it crash though. My crash
(freeze) occurs very infrequently (recently it was 6 weeks) and only on one
particular computer. Actually in the past it was freezing every few hours
also. Maybe I should have changed the emphasis of my question to how to kill
the frozen service rather than why it freezes. If I can kill it then it will
be restarted automatically by another service. Right now I can't kill it by
using Process.Kill() nor manually from the command line nor through the Task
Manager nor can I stop it from the Services. The only way to stop it is to
reboot the computer. Apparently it is messed up big time. No exceptions are
ever being caught. Thanks again.
Kris.
"Dan Bass" wrote: Does your application "hang" when you run it as an application?
Whenever I write a windows service application, there is a core section which exposes start and stop methods which exist in an assembly (DLL). From here I can apply any front end I like, whether it be windows service, windows dialog, or a console application. While doing any sort of debugging information, I flood the area I'm not sure about with Console.Writeli ne(...) calls so that the program flow can be easily traced, with details of relevant variables. In this case it would be worth checking the status of your references to your COM objects. Are you listening to a serial port or sending data to it?
From here it seems unlikely it's the "windows service" part of the application that's causing the freeze.
"Kris" <Kr**@discussio ns.microsoft.co m> wrote in message news:6F******** *************** ***********@mic rosoft.com...I have a Windows Service in C# talking to a serial port and using Remoting. It also uses several COM objects. On customer's computer the service will occassionally hang somewhere - the service still shows on a Task Manager list. In Services it says it is still running. However there is no way to stop it other than by rebooting the whole computer. No exception (including non-CLS) is ever generated. I added a separate System.Timers.T imer which detects that the main thread stopped working. I was trying to stop it by using System.ServiceP rocess.ServiceC ontroller.Stop( ) which didn't work. I tried to do process.Kill() which also doesn't work (and no exception). Is there a bug in framework somewhere. I don't even hope to find out why it hangs but if I could just kill it that would solve the problem since I have another Service which would bring it up. I'll be greatful for any ideas. Kris.
if it's on a windows 2000+ machine there's a handy utility called "kill". If
you go to the command prompt and type "kill /f <processName> " it should nuke
it.
Better to find a fix to a problem than a work around though.
Check the Nt Event log at the time of the freeze, for example.
Was there other activity going on at the same time on the machine (i.e. low
on resources).
Are the ports your using being released properly?
.... and so the list of questions can go on.
"Kris" <Kr**@discussio ns.microsoft.co m> wrote in message
news:B5******** *************** ***********@mic rosoft.com... Dan, Thanks for your reply. To answer your questions I both listen and talk to the serial port and I actually have a GUI app that uses the same code as my Service. I never ran it long enough to make it crash though. My crash (freeze) occurs very infrequently (recently it was 6 weeks) and only on one particular computer. Actually in the past it was freezing every few hours also. Maybe I should have changed the emphasis of my question to how to kill the frozen service rather than why it freezes. If I can kill it then it will be restarted automatically by another service. Right now I can't kill it by using Process.Kill() nor manually from the command line nor through the Task Manager nor can I stop it from the Services. The only way to stop it is to reboot the computer. Apparently it is messed up big time. No exceptions are ever being caught. Thanks again. Kris.
"Dan Bass" wrote:
Does your application "hang" when you run it as an application?
Whenever I write a windows service application, there is a core section which exposes start and stop methods which exist in an assembly (DLL). From here I can apply any front end I like, whether it be windows service, windows dialog, or a console application. While doing any sort of debugging information, I flood the area I'm not sure about with Console.Writeli ne(...) calls so that the program flow can be easily traced, with details of relevant variables. In this case it would be worth checking the status of your references to your COM objects. Are you listening to a serial port or sending data to it?
From here it seems unlikely it's the "windows service" part of the application that's causing the freeze.
"Kris" <Kr**@discussio ns.microsoft.co m> wrote in message news:6F******** *************** ***********@mic rosoft.com... >I have a Windows Service in C# talking to a serial port and using >Remoting. > It also uses several COM objects. On customer's computer the service > will > occassionally hang somewhere - the service still shows on a Task > Manager > list. In Services it says it is still running. However there is no way > to > stop it other than by rebooting the whole computer. No exception > (including > non-CLS) is ever generated. I added a separate System.Timers.T imer > which > detects that the main thread stopped working. I was trying to stop it > by > using System.ServiceP rocess.ServiceC ontroller.Stop( ) which didn't work. > I > tried to do process.Kill() which also doesn't work (and no exception). > Is > there a bug in framework somewhere. I don't even hope to find out why > it > hangs but if I could just kill it that would solve the problem since I > have > another Service which would bring it up. I'll be greatful for any > ideas. > Kris.
Dan,
Thanks again. In the past I was trying to terminate it by using kill
<processId> from the command line which did not work. Whenever I have a next
chance I will try to use kill /f which will still not fix my problem because
as I mentioned I'm trying to kill it programmaticall y with no effect and I
don't understand why. Seems like OS somehow lost track of this service. No
messages were reported in the event logs for the time when it crashed. As you
said there are just too many things that can go wrong - serial port, old COM
dlls, remoting. But it work "most" of the time and on all other machines it
works all the time.
Regards, Kris.
"Dan Bass" wrote: if it's on a windows 2000+ machine there's a handy utility called "kill". If you go to the command prompt and type "kill /f <processName> " it should nuke it.
Better to find a fix to a problem than a work around though. Check the Nt Event log at the time of the freeze, for example. Was there other activity going on at the same time on the machine (i.e. low on resources). Are the ports your using being released properly? .... and so the list of questions can go on.
"Kris" <Kr**@discussio ns.microsoft.co m> wrote in message news:B5******** *************** ***********@mic rosoft.com... Dan, Thanks for your reply. To answer your questions I both listen and talk to the serial port and I actually have a GUI app that uses the same code as my Service. I never ran it long enough to make it crash though. My crash (freeze) occurs very infrequently (recently it was 6 weeks) and only on one particular computer. Actually in the past it was freezing every few hours also. Maybe I should have changed the emphasis of my question to how to kill the frozen service rather than why it freezes. If I can kill it then it will be restarted automatically by another service. Right now I can't kill it by using Process.Kill() nor manually from the command line nor through the Task Manager nor can I stop it from the Services. The only way to stop it is to reboot the computer. Apparently it is messed up big time. No exceptions are ever being caught. Thanks again. Kris.
"Dan Bass" wrote:
Does your application "hang" when you run it as an application?
Whenever I write a windows service application, there is a core section which exposes start and stop methods which exist in an assembly (DLL). From here I can apply any front end I like, whether it be windows service, windows dialog, or a console application. While doing any sort of debugging information, I flood the area I'm not sure about with Console.Writeli ne(...) calls so that the program flow can be easily traced, with details of relevant variables. In this case it would be worth checking the status of your references to your COM objects. Are you listening to a serial port or sending data to it?
From here it seems unlikely it's the "windows service" part of the application that's causing the freeze.
"Kris" <Kr**@discussio ns.microsoft.co m> wrote in message news:6F******** *************** ***********@mic rosoft.com... >I have a Windows Service in C# talking to a serial port and using >Remoting. > It also uses several COM objects. On customer's computer the service > will > occassionally hang somewhere - the service still shows on a Task > Manager > list. In Services it says it is still running. However there is no way > to > stop it other than by rebooting the whole computer. No exception > (including > non-CLS) is ever generated. I added a separate System.Timers.T imer > which > detects that the main thread stopped working. I was trying to stop it > by > using System.ServiceP rocess.ServiceC ontroller.Stop( ) which didn't work. > I > tried to do process.Kill() which also doesn't work (and no exception). > Is > there a bug in framework somewhere. I don't even hope to find out why > it > hangs but if I could just kill it that would solve the problem since I > have > another Service which would bring it up. I'll be greatful for any > ideas. > Kris.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jacob Crossley |
last post by:
Hello all. We have about 10 Window's services that we wrote in c#. We use
them to process row's that we have queued up in various SQL tables.
The services seem to hang at least once in any given 24 hour period. Once we
reset the service, it goes about its processing business until the next time
it hangs. We are wondering if the hanging problem is due to a load issue
(too many windows services on a single machine), a code flaw, or an...
|
by: Andrea Vincenzi |
last post by:
Help me please, I'm totally stuck!
My Visual Studio 2003 debugger stopped working after I installed
Windows XP Service Pack 2. Here is what happens (with any project,
even a "Hello, world" message): the first time I open a project and
try to start it in debug mode, Visual Studio hangs before executing
the first line of code. The only way to stop it is to kill the process
using the Task Manager.
If I open the same project a second time and...
|
by: Steven De Smet |
last post by:
Hello,
This is my first post. I searched on the internet for answers but I was unable to solve my problem. So I hope that you guy's can help me with my VB.NET problem
I tried to create a windows service that converts MS Word Files into .PDF files and after that we want to zip the .PDF files.
Our code:
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set...
|
by: Ashish Khandelwal |
last post by:
I have a Windows Service in C# talking to a serial port and using
Remoting.
It also uses several COM objects. On server the service will
occassionally hang somewhere - the service still shows on a Task
Manager
list. In Services it says it is still running. However there is no way
to
stop it other than by rebooting the whole computer. No exception
(including
non-CLS) is ever generated. I added a separate System.Timers.Timer
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |