10 Replies Latest reply on Jun 19, 2014 2:30 PM by weetbicks

    FMS13 Scheduled Scripts not Terminating when Finsihed

    weetbicks

      Summary

      FMS13 Scheduled Scripts not Terminating when Finsihed

      Product

      FileMaker Server

      Version

      13.0v2

      Operating system version

      Windows Server 2008 R2 Standard 64bit

      Description of the issue

      Server side scripts that used to run fine on FMS11 (we skipped 12) are now occasionally failing to properly terminate on server.  The script itself is done, I check the records and they have all been properly updated as required, but the script client stays running at 100% CPU on server which eventually fires off a warning.

      Steps to reproduce the problem

      Run a server-side script on machine with specs mentioned.  Randomly sometimes it works sometimes it fails to terminate (it fails to terminate more often than it works).

      Expected result

      Same as 11/12,  the script just ends when it is finished, it doesn't leave server client connected and cpu at 100% as a result.

      Actual result

      Server script remains connected as a client,  its stats are around 0 so its not doing anything, BUT when it is in this state the CPU goes to 100%.

      Exact text of any error message(s) that appear

      There are no errors

      Configuration information

      Virtualised environment
      4gb Ram
      FMS 13.0v2
      Intel Xeon CPU-E7 2850 @ 2ghz
      Windows Server 2008 R2 Standard 64bit

      Workaround

      Only solution is to put a terminate time-out on the script, this is far from ideal.

        • 1. Re: FMS13 Scheduled Scripts not Terminating when Finsihed
          TSGal

               Daniel Wood:

               Thank you for your post.

               How often is the script scheduled to run?  Daily?  Hourly? 15 minutes?

               What action(s) is the scheduled script performing (besides updating records)?

               Does the event.log show anything out of the ordinary?

               Any other information you can provide may be helpful.

               TSGal
               FileMaker, Inc.

          • 2. Re: FMS13 Scheduled Scripts not Terminating when Finsihed
            weetbicks

                 hi TSGal, thank you for the quick reply.

                 The script is normally run at about 2:15am daily.  The script in question is something along the lines of:

                 Go to Layout [ Jobs ]

                 Show all records

                 Replace Field Contents [ Jobs::zCurrent Date ; Get ( CurrentDate ) ; No Dialog ]

                  

                 and that's about it.  We need to store current day on jobs in order to store job status (which is dependent upon current day).  This script has run fine for years on versions 11 , and also runs fine on my Dev server which is running on a mac (but also on our windows dev servers).

                 Note that this is not the only server-side script that we wish to run on this server, there are 2others and both do the exact same thing in terms of not properly exiting when done, so I don't think it is anything to do with the script itself.

                 The event log shows nothing unusual, script starts as normal,  no errors or warnings. The only error we see comes when script exceeds its timeout limit we have had to impose to force quit it.

                 I Plan on doing some further testing today to try things such as a simpler script (seeing if the steps affect the issue), and trying to put exit/halt/exit application in various places such as the script itself, or the files shutdown script.

            • 3. Re: FMS13 Scheduled Scripts not Terminating when Finsihed
              TSGal

                   Daniel Wood:

                   Thanks for the information.

                   Since this is happening with other scripts, it doesn't appear to be script specific (which was one factor I was trying to determine).

                   Assuming the other scripts are also similar (replacing across all records), is it possible a client is still logged in and accessing a record?  Then again, there would be an error in the log file.

                   I would first try adding "Exit Script" at the end of the script.  I know it seems redundant, but it would force the script to close.

                   Please keep me updated with any progress and anything you discover.

                   TSGal
                   FileMaker, Inc.

              • 4. Re: FMS13 Scheduled Scripts not Terminating when Finsihed
                weetbicks

                      hi TSGal,

                     My first thought also was a user was locking a record, but this is not the case as I have tested this with no users connected and same result.  I will let you know how my testing goes.

                      

                     Cheers

                • 5. Re: FMS13 Scheduled Scripts not Terminating when Finsihed
                  weetbicks

                       More testing has been done this morning but cannot gleam much from it except it seems fairly random.  I made a simple script of 1 step "go to layout" this worked 90% of the time, then I went to lunch and came back and ran it again and it stalled 'running' until I terminated,  I can't see any correlation between the size/complexity of the script and when this occurs.  If I just sit there hitting run, run, run, run on the simple script it seems to run fine, but if it is the scheduler that activates the script, or I run it after a period of inactivity it can break.   Running a longer script ran fine, but then 1/4 times it bombed out.

                        

                       Putting exit application, exit script, halt script as the last step in the scheduled script did nothing to make it any better.

                  • 6. Re: FMS13 Scheduled Scripts not Terminating when Finsihed
                    philmodjunk
                         

                              Go to Layout [ Jobs ]

                         

                              Show all records

                         

                              Replace Field Contents [ Jobs::zCurrent Date ; Get ( CurrentDate ) ; No Dialog ]

                         I fully realize that I might alter my answer if I knew more about the design of your database and also agree that this doesn't resolve the basic issue, but must comment that this looks like a very "heavy load" script that can probably replaced with a better approach that accomplishes the same end result. The obvious first fix to suggest would be to define zCurrent Date as an unstored calculation field with Get ( CurrentDate ) as its expression. That will update automatically without need for this script.

                         Of course, you may need this field to be stored so that a status field that references it can be indexed. If that's the case, I still think you can avoid doing this replace on all records in the table. I would try to set up a script that performs a find to pull up only those records for which the new day makes a change in status necessary and would then update just that smaller number of records.

                    • 7. Re: FMS13 Scheduled Scripts not Terminating when Finsihed
                      TSGal

                           Daniel Wood:

                           Thank you for your test results.

                           Your description sounds like the file is disconnecting from the client, where the client is the server script.  However, since the file is always open, this is puzzling.  

                           Create a text field so you can capture an error.  To see if the script starts, have as the first line Set Field and set it to "BEGIN".  This will let me know if the hanging occurs when trying to access the script after a long period of inactivity.  Also, at the end of the script, set the same field to Get (LastError).  This will let me know if there is any error.  Run the script to make sure it is working properly, remove 0 from the Text field (assuming the script ran correctly and Get (LastError) returned 0), and then schedule the script for a later time.

                           TSGal
                           FileMaker, Inc.

                      • 8. Re: FMS13 Scheduled Scripts not Terminating when Finsihed
                        weetbicks

                             hi Phil,

                             I agree it is certainly a heavy load script, and thank you for the comments. There may be a few things I can do here actually to make it less heavy - the current date is only needed to determine a single status of a job (overdue for delivery) all the rest can be set automatically via auto/enter,   it is probably better for me to use an auto-enter and nightly find those jobs which are now overdue (a small number) and update them nightly instead.

                             Having said all that, this will still not resolve the issue. I noticed this bug occurring on a variation of the script that was 1 script step only "go to layout" ,which should have taken less than a second to run or thereabouts.  The load of the script may be a contributing factor perhaps, but it is not the only reason here.

                             The solution is multi-file and both interface/data (and other files) have startup and shutdown scripts attached. If I understand correctly server runs both startup and shutdown on files it opens for the purpose of running a server-side script, so I am wondering if something in FMS 13 is getting caught in a loop of shutdown/startup of these files,  I'll do some more testing by making some modifications to these 2 scripts, and perhaps might just try disabling them when running the server side script.

                        • 9. Re: FMS13 Scheduled Scripts not Terminating when Finsihed
                          TSGal

                               Daniel Wood:

                               Are there any script triggers?  Specifically, when opening and closing the file (OnFirstWindowOpen, OnLastWindowClose).  Also, when you Go to Layout (OnLayoutEnter, OnRecordLoad).  If so, what are those scripts doing?

                               I realize the issue only occurs occasionally, but I need to consider all possibilities.

                               TSGal
                               FileMaker, Inc.

                          • 10. Re: FMS13 Scheduled Scripts not Terminating when Finsihed
                            weetbicks

                                 I'll do some error checking and report back and see if I can log the exact script steps/scripts being executed by server