FileMaker Plugins Behaving Badly

Plugin Devil

I experienced a very bizarre plugin issue a little bit ago:

I set up a server side script that ran every night. There are 2 server side plugins used in this script. This process ran fine for about a year, then all of a sudden, there were issues. According to the logs I set up, the plugin calls were failing. They were failing very inconsistently, and for both plugins. When I ran the script on the client machine, the calls never failed. Stumped…

My first defensive plan of attack: During the plugin calls, I scripted a check to see if the call failed. If it did, I would try the call again. I repeated this in a loop for 10 times. That seemed to help the issue a little bit, but it did not go away.

Since I couldn’t figure this out offensively, and I wasn’t beating it defensively, I reached out for help. I met with Bob Bowers, who helped me build the original system, and told him the situation. I mentioned to him that there was one change that occured around the time the plugin calls stopped working: IT had beefed up security on that server machine big time. That gave him a brilliant idea: perhaps the network was slowed down by the security updates, and plugin calls were not getting completed before the script went on to the next script step. His suggestion: add a pause before and after every plugin call. Well what do you know, that worked!

I thought I’d share this little tip, in case this is happening to anyone else. It’s an odd issue, but I was really glad it was an easy fix!

4 thoughts on “FileMaker Plugins Behaving Badly”

  1. Thanks for the tip. I’ve run into this issue when doing command line stuff using the “Send Event” script step, but it never occurred to me that it might affect plug-ins too, I assumed they’d be synchronised.

    Unfortunately the “Pause” step solution is unlikely to be enough when the processing time of the unsynchronised step is variable. Say you have a script that takes 10 seconds 90% of the time, 20 minutes 5% of the time and 5 hours 5% of the time. The only way to ensure it succeeded 100% of the time would be to put in a five hour pause, but that would be overkill for 95% of cases and give you much less time to run other scripts dependent on the completion of the initial script.

    The only alternative I’ve found – and it won’t be possible in all situations – is to have the unsynchronised step output a file at the end of its processing. So if I’m running a vbs from a Send Event step I’ll add a final instruction to write boolean true to a tiny “success file” which lives next to a static “failure file” containing boolean false. Directly after the “Send Event” step I’ll put a loop (usually with a few seconds pause between each iteration) where FileMaker attempts to import data from the success file. If it can’t find that file, which it won’t if the unsynchronised step hasn’t completed, it will import the failure file instead. Then a simple boolean check of the import field can determine whether the unsynchronised step has completed and it’s safe to continue.

    This isn’t ideal and I would like to see a more elegant solution. I don’t have a great deal of experience with plug-ins, but as they manifest themselves as external custom functions I guess they can return a result which could indicate whether the function completed? For “Send Event” I guess it would be harder, but perhaps we could be treated to an updated “Send Event” script step which is more like “Run something and return a result” so you could wait for external processes to finish before continuing.

  2. You referenced that this is a server side script. I thought the Pause/Resume script step was not supported by FileMaker Server? I’ve had a number of times when I sure wish it did and I’ve never really understood why FileMaker won’t let the Server pause a script. Very strange. Are you using some pause script step that is actually a plugin function?

  3. One thing to keep in mind (and as Taylor mentions), is that the Pause/Resume Script step is NOT compatible with FileMaker Server for versions of FileMaker < 12.

    Note: You can check script step compatibility by using the Show Compatibility selector located at the bottom-left of the Edit Script dialog.

    So, what do you do with lower versions of FileMaker? There may be other ways to deal with this (Alec mentions one way), but I create a sub-script thats sole purpose is to create a "pause" in a server-side script. It's a simple script called "ServerPause (value)" with the following steps:

     
    Set Variable [$pause_value; Value: Get ( ScriptParameter )]
    Set Variable [$counter; Value:0]
    Loop
       Set Variable [$counter; $counter + 1]
       Exit Loop If [$counter > $pause_value]
    End Loop
     

    I insert this script as a sub-script wherever I need to in the primary script called by FileMaker Server. Since this script is called as a subscript in the parent, I can pass whatever value I wish to adjust the pause and I can edit this value without the need to modify the actual "pause" script itself. I usually start with a value of 10000 and adjust as necessary. It's also important to keep in mind that this isn't a real pause; FileMaker is still running a script.

    If you've run into this problem, how have you solved it? Alec and I have mentioned a couple ways and I'm very curious what others have done as well.

     

Leave a Comment

Your email address will not be published. Required fields are marked *

Are You Using FileMaker to Its Full Potential?

Claris FileMaker 2023 logo
Scroll to Top