473,624 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Service Dies on Exception

Hello:

I am working on a service. For the past month we have been simply
restarting the service daily (which defeats the point).

I have been putting some extra time into it today and have come to the
conclusion that a pop-up window is trying to open whenever an error
occurs.

However, the line of code that it dies on is inside of a try/catch. I
have super checked (dozens of times) that there is no way for an
exception to escape the bounds of my service.

Here is a summary of what appears in the EventViewer:

---
Application popup: ExpirationNotif icationService. exe - Application
Error : The instruction at "0x77d016ab " referenced memory at
"0x77d016ab ". The memory could not be "read".

Click on OK to terminate the program
---

I believe the reason why the code fails is totally in response to the
pop-up trying to open when the service is in the background. I have
found lots of articles about disabling the JIT debugger and they have
not solved my problem. Is there some setting on Server 2003 that
forces a pop-up during any type of error, even handled errors?

Thanks,
Travis

Sep 11 '07 #1
9 3814
I have just found another article specifically to disable the
Application popup issue. However, now the service simply dies without
any errors being caught at all.

But, this means that an exception is definitely escaping my code,
however, I can't see how. Other people have commented that they have
had similar issues with try/catch not working. Some have suggested it
has something to do with threading.

Does anyone have any clue what could cause my try/catch to get skipped
over?

Thanks,
Travis
Sep 11 '07 #2
Travis,

Are you doing any work on any other threads? If so, are you catching
exceptions in those threads as well?

Have you considered using the Exception Handling Block in the Enterprise
Library to help shore up your exception handling? It will help with
exceptions on other threads, I believe.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<je**********@g mail.comwrote in message
news:11******** **************@ v23g2000prn.goo glegroups.com.. .
>I have just found another article specifically to disable the
Application popup issue. However, now the service simply dies without
any errors being caught at all.

But, this means that an exception is definitely escaping my code,
however, I can't see how. Other people have commented that they have
had similar issues with try/catch not working. Some have suggested it
has something to do with threading.

Does anyone have any clue what could cause my try/catch to get skipped
over?

Thanks,
Travis


Sep 11 '07 #3
Well, the only way I can see myself using a thread is if the
System.Timers.T imer class creates a new thread.

The method that gets called by the ElapsedEventHan dler is completely
surrounded by a try/catch block. It is within the try/catch that the
error occurs.

It is as though the try/catch is ignored simply because it is being
executed on Windows Server 2003.

Sep 11 '07 #4
<je**********@g mail.comwrote in message
news:11******** **************@ v23g2000prn.goo glegroups.com.. .
>I have just found another article specifically to disable the
Application popup issue. However, now the service simply dies without
any errors being caught at all.

But, this means that an exception is definitely escaping my code,
however, I can't see how. Other people have commented that they have
had similar issues with try/catch not working. Some have suggested it
has something to do with threading.

Does anyone have any clue what could cause my try/catch to get skipped
over?

Thanks,
Travis


There is no exception thrown in this case, what you have here is an AV, the
instruction at xxxx is trying to read from xxxx, where xxxx is 0x77d016ab
(is it always the same address). It's nearly impossible to have a valid
instruction that reads from it's own location, so it looks like your service
has gone wild. Most of the time this is caused by unmanaged code buffer
overruns and stack overflows and heap corruptions, any chance that you call
into unmanaged code?
Anyway, the only sure way to handle this is by attaching a debugger.
Willy.

Sep 11 '07 #5
My code uses a crappy LDAP library that has all sorts of issues. My
concern is how to catch the exception that is generated. I have been
asked to use System.Threadin g.Timer instead. I will try this and see
how it deals.

I did try to use the UnhandledExcept ion event in AppDomain.Curre nt,
however, it doesn't even get raised.

Sep 11 '07 #6
If the library is that unstable, then I would consider isolating it into
another process, or using COM+ to create an out-of-process application pool
which will keep your service from shutting down. This should allow you to
get a more trappable error that your service can process.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<je**********@g mail.comwrote in message
news:11******** **************@ q5g2000prf.goog legroups.com...
My code uses a crappy LDAP library that has all sorts of issues. My
concern is how to catch the exception that is generated. I have been
asked to use System.Threadin g.Timer instead. I will try this and see
how it deals.

I did try to use the UnhandledExcept ion event in AppDomain.Curre nt,
however, it doesn't even get raised.

Sep 11 '07 #7
The folks here at work insist on using Novell's eDirectory rather than
ActiveDirectory . We are also running on old hardware and the SysAdmins
are fairly new to all the encryption/certificate stuff I am shoving on
them.

I have concealed as much as possible of Novell's LDAP code - I have a
nack for making libraries. Although, there simply isn't much you can
do when the underlying code has issues.

Using System.Threadin g.Timer seems to not have fixed my issue. Somehow
an exception is escaping my code; little trouble maker!

Sep 11 '07 #8
<je**********@g mail.comwrote in message
news:11******** **************@ q5g2000prf.goog legroups.com...
My code uses a crappy LDAP library that has all sorts of issues. My
concern is how to catch the exception that is generated. I have been
asked to use System.Threadin g.Timer instead. I will try this and see
how it deals.

I did try to use the UnhandledExcept ion event in AppDomain.Curre nt,
however, it doesn't even get raised.
You can't trap this , it's not a managed exception , nor an unmanaged one.
The OS removes the process, simply because the instruction triggers a Access
Violation from which there's is no recovery possible.
Now before calling the library crappy, I would suggest you to inspect the
managed code PInvoke declarations, the arguments passed and the calling
convention as required by the exported functions are extremely important to
watch for. A wrong signature or a wrong calling convention declaration will
most certainly destroy the call stack at some point in time and may lead to
the problem you are seeing now.

Willy.
Sep 11 '07 #9
What is all this PInvoke stuff? My code doesn't deal with anything
like that. As far as I am concerned, everything is written in C# with
no hocus-pocus. I have no clue what the LDAP library does.

And why do non-services catch the exception just fine?

Sep 11 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1344
by: Jerry Negrelli | last post by:
I have a windows service that is mysteriously dying on me at what appears to be random intervals. Sometimes its 3 hours, sometimes it's 2 days. Clearly an error is occuring but I haven't been able to pinpoint the problem The service's OnStart method initializes an object whose constructor creates a thread that launches other threads based on certain DB criteria. Every method I call starts with a try and ends with a catch, and any errors...
7
7937
by: Larry Bird | last post by:
I have a windows service that want to un-install. When I run "installutil /u serivcename" I get the error that the serivce is not installed on my machine. However, when view the serivce console I still see my service there. What must be done to remove a windows service written in VB.Net from my system. I'm trying un-install the service because I'm compiling it as a console application to perform debugging. I think it will be easier to...
7
2394
by: Ahmed Perlom | last post by:
Hi all, I am trying to start a windows application that has a GUI from a Windows service written in .NET 2.0. I have been searching on this for few days now with no avail. When using the System.Diagnostic.Process object to start the application (i.e Notepad), the new app runs and it is listed on the task manger list, but the GUI doesn't show up in the desktop of the current user. I am aware windows service (either LocalSystem,...
2
2133
by: Tom | last post by:
Hi, We have a web service (developed in C# framework 1) that run for some time on Windows 2000. Recently we upgraded it to framework 2 and run successfully on Windows 2000 and XP. However, we cannot run it on our new Windows 2003 box. The service runs and we can even instantiate it but then it dies point to NULL login object. ------------------------------------------------------------------------------------- ERROR(7/27/2006 2:55 PM):
12
14522
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
4
8817
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... Following the samples online, we implemented a windows service in .Net. Like most services, there's a worker thread actually doing stuff in the background. The problem we've run into is how to get the service to exit when the worker thread has a fatal error *and* get the SCM to invoke the auto-restart configuration? The worker thread can error out while the parent thread in the server process chugs along. We can set the exit...
5
4254
by: sonali_reddy123 | last post by:
Hello all, I am trying to develop an application which will run as a windows service. The application should have Normal options available with service like start, stop and pause but along with this I need an option to show the windows application which my service has started as a result of its invokation. So I have written a service control by adding a new project of type
4
1786
by: rikleo2001 | last post by:
Hello Experts. I need your help, I am new to XML web service, and I have to complete one task. Here is current situation. 1. I have web service running to recieve SOAP message from an external service and send message reciepts. This service Recieve XML as object and transforms into XML file and then imports that XML file into SQL Server database and then sends SOAP message reciept. I am not developer of that code, it is huge thousands...
3
5476
by: jehugaleahsa | last post by:
Hello: I have had a program that checks LDAP to get a list of all the users whose password will expire. I send these users an email letting them know to change their passwords. It had been working fine for months. Then, all of a sudden, something changed and now the service dies unexpectedly. I wrote some code to log what was the last step performed and it appears as though the service dies while it is "sleeping".
0
8249
marktang
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...
0
8179
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,...
0
8685
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8348
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7176
agi2029
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...
1
6112
isladogs
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...
0
4084
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...
0
4187
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1797
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.