I've created several dataloading applications in C++, they read data from a file or from a database and then load the data into a SQL 2000 database using ado. They are running at several different sites. At one site several of the programs hang randomly on the windows 2003 server they're running on. They will run fine all day (they are called every minute or so using a cron - scheduling program) then in the afternoon or some other time they'll hang. You can see the process in task manager but it isn't doing anything. The job scheduler detects that it is running and doesn't call it again - thus preventing further data from loading.
How can I determine the cause of the problem or determine where/why it is hanging? Is there a way to set up a utility or something that will capture the state of the process when it hangs? How can one approach debugging a hanging program in general?