开发者

what may cause a c# application to stop after 12 hours

开发者 https://www.devze.com 2023-02-23 05:59 出处:网络
I am developing a c# utility that updates a datatable in a database. My application stops after 12 hours showing a messagebox indicating windows error.

I am developing a c# utility that updates a datatable in a database. My application stops after 12 hours showing a messagebox indicating windows error.

I am sure that there is no memory leak. Moreover, it was also stopping around 12 hours of running indicating timeout expired message. So i set the Commandtimeout property to infinity. Now this error is no more showing.

what else could be stopping the utility after 12 hours? and what does this "Windows error" message mean?

I used AppDomain.CurrentDomain.UnhandledException to handle unhandled exceptions, and i got the following message box after running the utility for long time.

Messagebox: "Timeout Expired.The timeout period elapsed prior to co开发者_运维知识库mpletion of the operation or the server is not responding"

knowing that i am using SQLServer2008 R2 and i already set all the commandTimeout to 0.

whats wrong? why i am still getting this error ?!


Why does you want your utility to work continuesly, if some thing is to carry on at regular interval then you should use the schedular for invoking your utility. This will make sure that your application is not keeping the resource in locked state.
Now coming to your point of view... if application is must to run more than 12 hrs conti. then check,.. is there any thing that makes all the connection to break forcefully example backup scheduled for the database. this will make all the connection to break even if timeout is set to infinity.


Which database are you using? I know that in mysql there is a limit from the database about how much time the connection is kept open. Maybe in your database it is 12 hours,however if this is mySql it is a bit of a problem to change the timeout setting. So remember to change both the global and local setting or else it won't change, good luck.


Some networks have a hickup every 12 hours to crash p2p applications. Maybe there is some network related problem triggered every X hours.

Is you're code correctly going to reconnect on a failure and log decent error messages or is it just going to crash?

0

精彩评论

暂无评论...
验证码 换一张
取 消