473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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: ExpirationNotificationService.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 3794
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.com

<je**********@gmail.comwrote in message
news:11**********************@v23g2000prn.googlegr oups.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.Timer class creates a new thread.

The method that gets called by the ElapsedEventHandler 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**********@gmail.comwrote in message
news:11**********************@v23g2000prn.googlegr oups.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.Threading.Timer instead. I will try this and see
how it deals.

I did try to use the UnhandledException event in AppDomain.Current,
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.com

<je**********@gmail.comwrote in message
news:11**********************@q5g2000prf.googlegro ups.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.Threading.Timer instead. I will try this and see
how it deals.

I did try to use the UnhandledException event in AppDomain.Current,
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.Threading.Timer seems to not have fixed my issue. Somehow
an exception is escaping my code; little trouble maker!

Sep 11 '07 #8
<je**********@gmail.comwrote in message
news:11**********************@q5g2000prf.googlegro ups.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.Threading.Timer instead. I will try this and see
how it deals.

I did try to use the UnhandledException event in AppDomain.Current,
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
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...
7
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...
7
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...
2
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...
12
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...
4
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...
5
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...
4
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
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...

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.