Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reasons to NOT run a business-critical C# console application via the debugger?

Tags:

c#

debugging

I'm looking for a few talking points I could use to convince coworkers that it's NOT OK to run a 24/7 production application by simply opening Visual Studio and running the app in debug mode.

What's different about running a compiled console application vs. running that same app in debug mode?

Are there ever times when you would use the debugger in a live setting? (live: meaning connected to customer facing databases)

Am I wrong in assuming that it's always a bad idea to run a live configuration via the debugger?

like image 338
Duffy Avatar asked Sep 25 '08 22:09

Duffy


5 Answers

You will suffer from reduced performance when running under the debugger (not to mention the complexity concerns mentioned by Bruce), and there is nothing to keep you from getting the same functionality as running under the debugger when compiled in release mode -- you can always set your program up to log unhandled exceptions and generate a core dump that will allow you to debug issues even after restarting your app.

In addition, it sounds just plain wrong to be manually managing an app that needs 24/7 availability. You should be using scheduled tasks or some sort of automated process restarting mechanism.

Stepping back a bit, this question may provide some guidance on influencing your team.

like image 166
Luke Avatar answered Oct 20 '22 17:10

Luke


Just in itself there's no issue in running it in debugging if the performance is good enough. What strikes me as odd is that you are running business critical 24/7 applications as users, perhaps even on a workstation. If you want to ensure robustness and avaliability you should consider running this on dedicated hardware that no one uses besides the application. If you are indeed running this on a users machine, accidents can be easily made, such as closing down the "wrong" visual studio, or crashing the computer etc.

Running in debug should be done in the test environment. Where I've work/worked we usually have three environments, Production, Release and Test.

Production

  • Dedicated hardware
  • Limited access, usually only the main developers/technology
  • Version control, a certain tagged version from SVN/CVS
  • Runs the latest stable version that has been promoted to production status

Release

  • Dedicate hardware
  • Full access to all developers
  • Version control, a certain tagged version from SVN/CVS
  • Runs the next version of the product, not yet promoted to production status, but will probably be. "Gold" if you like.

Test

  • Virtual machine or louse hardware
  • Full access
  • No version control, could be the next, next version, or just a custom build that someone wanted to test out on "near prod environment"

This way we can easily test new version in Release, even debug them there. In Test environment it's anything-goes. It's more if someone want to test something involving more than one box (your own).

This way it will protect you against quick-hacks that wasn't tested enough by having dedicated test machines, but still allow you to release those hacks in an emergency.

like image 43
Mats Fredriksson Avatar answered Oct 20 '22 17:10

Mats Fredriksson


Speaking very generically, when you run a program under a debugger you're actually running two processes - the target and the debugger - and tying them together pretty intimately. So the opportunities for unexpected influences and errors (that aren't in a production run) exist. Of course, the folks who write the debuggers do their best to minimize these effects, but running that scenario 24/7 is likely to expose any issues that do exist.

If you're trying to track down a particular failure, sometimes running under a debugger is the best solution; but even there, often enabling tracing of one sort or another is a lower-impact solution that is just as effective.

The debugger is also using up resources - depending on the machine and the app, that could be an issue. If you need more specific examples of things that could go wrong using a debugger 24/7 let me know.

like image 36
Bruce Avatar answered Oct 20 '22 16:10

Bruce


Ask them if they'd like to be publicly mocked on The Daily WTF. (Because with enough details in the write up, this would qualify.)

like image 2
dgvid Avatar answered Oct 20 '22 17:10

dgvid


I can't speak for everyone's experience, but for me Visual Studio crashes a lot. It not only crashes itself, but it crashes explorer. This is exacerbated by add-ons and plugins. I'm not sure if its ever been tested to run for 24/7 over days and days and days the same way the OS has.

Your essentially putting the running of your app at the mercy of this huge behemoth of a second app that sounds like its easily orders-of-magnitude larger and more complex than your app. Youre just going to get bug reports and most of them are going to involve visual studio crashing.

Also, are you paying for visual studio licenses for production machines?

like image 1
Doug T. Avatar answered Oct 20 '22 17:10

Doug T.