Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Folder watcher application disappears after running several days

Folder watcher application disappears after running several days

Scheduled Pinned Locked Moved Visual Basic
databasetutorialquestion
11 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dBrong
    wrote on last edited by
    #1

    The application watches a folder, and moves the files to another directory, and records some info in an SQL database. The app sometimes just disappears. It's not a complicated app. I checked to make sure I close all file handles, SQL connections, etc. Any idea on how to find out what's going on?

    D D M T 4 Replies Last reply
    0
    • D dBrong

      The application watches a folder, and moves the files to another directory, and records some info in an SQL database. The app sometimes just disappears. It's not a complicated app. I checked to make sure I close all file handles, SQL connections, etc. Any idea on how to find out what's going on?

      D Offline
      D Offline
      David Mujica
      wrote on last edited by
      #2

      If it was a scheduled task, then the final exit code would be available in the scheduled task window.

      D 1 Reply Last reply
      0
      • D dBrong

        The application watches a folder, and moves the files to another directory, and records some info in an SQL database. The app sometimes just disappears. It's not a complicated app. I checked to make sure I close all file handles, SQL connections, etc. Any idea on how to find out what's going on?

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Instrument your code so it logs information to a file. That way you can get an idea of what your service was doing when it crashed. Another possibility would be to run a Debug version of your server, then connect Visual Studio to the running instance to so you grab any exceptions that are thrown and you can see what variables are holding which values to get an idea of what the code was thinking when it blew up.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        1 Reply Last reply
        0
        • D David Mujica

          If it was a scheduled task, then the final exit code would be available in the scheduled task window.

          D Offline
          D Offline
          dBrong
          wrote on last edited by
          #4

          Is there a way one can start a program, then stop it (say at midnight), and restart it again?

          L D 2 Replies Last reply
          0
          • D dBrong

            Is there a way one can start a program, then stop it (say at midnight), and restart it again?

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            dBrong wrote:

            restart it again?

            as in: let's not debug and figure out what is wrong, let's just close our eyes? what you need to do is: 1. add logging code, so a file tells you what is going on. Make sure to use File.AppendAllText so the file is likely closed when things go wrong. 2. try to increase activity so the problem occurs sooner, saving you some calendar time in locating and fixing the problem and testing the fix. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


            1 Reply Last reply
            0
            • D dBrong

              Is there a way one can start a program, then stop it (say at midnight), and restart it again?

              D Offline
              D Offline
              David Mujica
              wrote on last edited by
              #6

              What about making the task self submit itself to the task scheduler at midnight, then exit ? I agree that finding the root cause of the shutdown is the best way, but sometimes you will spend more time than is worth it. Create a detailed log of what the application is doing is highly recommended and if you have time is the best way to go. However, you may be trying to debug this application for months without finding the root cause. A self-submitting application seems like a straight forward approach and may give you years of trouble free execution. It's just a suggestion. Let's not get into nasty postings that don't help the situation. Respectfully, David

              D 1 Reply Last reply
              0
              • D David Mujica

                What about making the task self submit itself to the task scheduler at midnight, then exit ? I agree that finding the root cause of the shutdown is the best way, but sometimes you will spend more time than is worth it. Create a detailed log of what the application is doing is highly recommended and if you have time is the best way to go. However, you may be trying to debug this application for months without finding the root cause. A self-submitting application seems like a straight forward approach and may give you years of trouble free execution. It's just a suggestion. Let's not get into nasty postings that don't help the situation. Respectfully, David

                D Offline
                D Offline
                dBrong
                wrote on last edited by
                #7

                David Mujica wrote:

                What about making the task self submit itself to the task scheduler at midnight, then exit ?

                This sounds like a sensible solution.

                1 Reply Last reply
                0
                • D dBrong

                  The application watches a folder, and moves the files to another directory, and records some info in an SQL database. The app sometimes just disappears. It's not a complicated app. I checked to make sure I close all file handles, SQL connections, etc. Any idea on how to find out what's going on?

                  M Offline
                  M Offline
                  Mycroft Holmes
                  wrote on last edited by
                  #8

                  I seem to recall that the folder watcher was unstable, I looked into using it some years ago and it was known issue if there were too many envents on the folder the watcher would crash. We declined to use it at that point, however that was over 4 years ago. Instead we just used a timed read of the folder contents and processed anyhing we found. As we can process over 1200 filed in the hour FW was not an option - system has been stable for 4 years!

                  Never underestimate the power of human stupidity RAH

                  D 1 Reply Last reply
                  0
                  • M Mycroft Holmes

                    I seem to recall that the folder watcher was unstable, I looked into using it some years ago and it was known issue if there were too many envents on the folder the watcher would crash. We declined to use it at that point, however that was over 4 years ago. Instead we just used a timed read of the folder contents and processed anyhing we found. As we can process over 1200 filed in the hour FW was not an option - system has been stable for 4 years!

                    Never underestimate the power of human stupidity RAH

                    D Offline
                    D Offline
                    dBrong
                    wrote on last edited by
                    #9

                    Thanks. That's another good idea I can try.

                    1 Reply Last reply
                    0
                    • D dBrong

                      The application watches a folder, and moves the files to another directory, and records some info in an SQL database. The app sometimes just disappears. It's not a complicated app. I checked to make sure I close all file handles, SQL connections, etc. Any idea on how to find out what's going on?

                      T Offline
                      T Offline
                      Tim Carmichael
                      wrote on last edited by
                      #10

                      Can the application be retasked as a service? The service can be set to auto-restart on failure. Just a thought... Tim

                      D 1 Reply Last reply
                      0
                      • T Tim Carmichael

                        Can the application be retasked as a service? The service can be set to auto-restart on failure. Just a thought... Tim

                        D Offline
                        D Offline
                        dBrong
                        wrote on last edited by
                        #11

                        Another good idea. I need to see how much money the client wants to spend on this.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups