tags:

views:

850

answers:

10

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?

+1  A: 

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?

Doug T.
+9  A: 

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.

Luke
A: 

We never run it via the debugger. There are compiler options which may accidentally be turned on/off. Optimizations aren't turned on, and running it in production is a huge security risk.

Kevin
+3  A: 

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.

Bruce
+1  A: 

You definitely don't want an application that needs to be up 24/7 to be run manually from the debugger, regardless of the performance issues. If you have to convince your co-workers of that, find a new job.

I have sometimes used the debugger live (i.e. against live customer data) to debug data-related application problems in situations where I couldn't exactly reproduce the production data in a test environment.

MusiGenesis
+5  A: 

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.

Mats Fredriksson
A: 

Aside from the debug code possibly having different code paths (#ifdef, Debug.Assert(), etc) code-wise it will run the same.

A little scary mind you - set breakpoints, set the next line of code you want to execute, interactive exceptions popup and the not-as-stable running under visual studio.There are also debugger options that allow you to break always when an exception occurs. Even inspecting classes can cause side-effects if you haven't written code properly... It sure isn't something i'd want to do as the normal 24x7 process.

The only reason to run from the debugger is to debug the application. If you're doing that on a regular basis in production, it's a big red flag that your code and your process need help.

To date I've never had to run debug mode interactively in production. The rare time we switched over to a debug version for extra logging, but never sat there with visual studio open.

Robert Paulson
+1  A: 

Simple answer: you will almost certainly reduce performance (most likely considerably) and you will vastly increase your dependencies. In one step you've added the entire VS stack including the IDE and every other little bit to your dependencies. Smart people keep the dependencies of high-uptime services as tight as possible.

If you want to run under a debugger then you should use a lighter weight debugger like ntsd, this is just madness.

Wedge
A: 

I would ask them what is the advantage of running it via Visual Studio?

There are plenty of disadvantages that have been listed in the replies. I can't think of any advantages.

PJB
+2  A: 

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.)

dgvid