Server Function Appears to Repeatedly Execute Without Cause

I’m experiencing a problem with a server function that appears to be executed repeatedly at approximately 60-second intervals, even though the client invokes it only once.

This application previously completed the same reporting and email-generation workflow successfully. The database has grown somewhat since our previous testing, but the overall workload is similar.

My application generates PDF reports, stores them in a staging table, combines certain PDFs, and uploads the resulting files to FilePost, an external file-sharing service.

The client invokes a Five server function named BuildEmailAttachmentsServer using:

five.executeFunction(
    'BuildEmailAttachmentsServer',
    parms,
    null,
    '',
    '',
    function(serverResult) {
        // Process server response
    }
);

The server function performs the PDF processing and uploads synchronously, returning the results after all uploads are complete.

What I’m observing

The process makes it successfully up to the BuildEmailAttachmentsServer step, and that is where it always terminates with a memory error and a blank message.

I added diagnostic logging immediately before the client’s five.executeFunction() call and at the beginning of the server function.

On October 21, 2026, the logs showed:

Time (Pacific) Event
2:25:45 PM Client initiates BuildEmailAttachmentsServer
2:25:46 PM First server execution starts
2:26:46 PM Second server execution starts
2:27:47 PM Third server execution starts

There is only one client CALL log entry, but three server START entries.

All three server executions use the same BatchKey:

bd3b2e5c-4c36-4d65-9375-55101e3a9567

They also use the same EmailType (BOARD).

The server executions overlap

This is the most concerning part.

The original server execution continues processing and uploading PDFs even after the second and third executions have started.

For example:

  • 2:25:46 — First execution starts.

  • 2:26:31 — First execution uploads GroupRoster Part 1.

  • 2:26:46 — Second execution starts.

  • 2:27:03 — First execution uploads GroupRoster Part 2.

  • 2:27:30 — Second execution uploads its own GroupRoster Part 1.

  • 2:27:47 — Third execution starts.

  • 2:28:27 — First execution uploads GroupRoster Part 5.

Each execution starts processing the same reports from the beginning.

The resulting files have different FilePost IDs, confirming that these are actual duplicate uploads rather than duplicated log messages.

Eventually, the process fails with what appears to be a memory-related error. I suspect the overlapping executions are contributing significantly to the memory consumption.

Questions (bold ones seem to be more important)

1. Does Five automatically retry a five.executeFunction() request when a server function has not returned after approximately 60 seconds?

  1. Is there a documented 60-second timeout or execution limit for server functions?

3. If a request times out, why does the original server execution continue running while another execution starts?

  1. Is there a way to disable automatic retries or configure the timeout?

5. Is this expected behavior, or could it indicate an issue in Five’s request-handling infrastructure?

  1. What is Five’s recommended approach for preventing duplicate execution of long-running server functions that perform external operations?

Additional information

I’ve reviewed the client-side call chain and found no explicit retry logic. Diagnostic logging shows only one client invocation for the affected batch.

This workflow previously completed successfully, including processing all selected groups and uploading the combined PDFs to FilePost.

I can provide the complete timestamped logs and the relevant client and server functions if that would help your investigation.

I’d appreciate your assistance in determining why the repeated executions are happening. I can supply the inspector logs if necessary. They definitely contain only one client call to the server function, but 3 different invocations of the server function.

Hi Ron,

We are currently improving our reporting abilities to handle longer execution times for reports, in the meantime you can try the following as a work around:

Run the function as a background process (executeFunction with background: true) and record its progress or result somewhere the UI can poll.

Thanks for the quick reply Jo.

I’m confused. This used to work properly. Is there something about your new version that causes the server process to restart every minute? Why is this happening?

I’m not averse to using a background process, but how will that prevent the server process from restarting? Also, how do I know it is completed? Do I need to do some polling?

What if I need to run other reports? Running as a normal server process, at least I can see a message that it is done.

Are you suggesting perhaps using a variable like ReportsRunning = true, then set it to false at the end, then tie that variable to the enabling of the menu commands to run reports?

Thanks…

Progress Report:

While waiting on your progress, I have modified my architecture a bit. I was doing a single server call which would both combine multiple parts of the various PDFs and upload all applicable PDFs to FilePost. This could be very memory-intensive.

Now I changed the process to first do combining as needed in a server function, then when that returns, run a new server function to upload the files.

That upload server function is also restarting itself every minute, for a total of 3 different invocations.

The report I uploaded gets built in 5 parts to handle the memory load of having huge documents in memory. In FilePost dashboard, there are 15 files uploaded. From the oldest to newest, the appear in this order:
Part 1
Part 2
Part 3
Part 1
Part 4
Part 2
Part 5
Part 1
Part 3
Part 2
Part 4
Part 3
Part 5
Part 4
Part 5

So the same server function runs 3 times, each one uploading the full 5 parts.
It is no wonder I’m running out of memory.

When “five.executeFunction()” calls a server function that takes longer than 60 seconds, does Five automatically retry the function while the original execution continues? If so, can that behavior be disabled or the timeout increased?

Thanks…

Hi Ron,

Thanks for raising this. Unfortunately, a process restarting partway through is a known limitation of our current infrastructure, and we plan to address it in a future release.

What’s happening

When the connection between your browser and the Five server drops, Five automatically tries to reconnect and retry. This is built in specifically to work around these kinds of interruptions. However, we’ve found that the proxy servers sitting between your browser and Five retry their own reconnection at roughly 60 second intervals, and that can cause a long-running process to restart.

Why fixing the proxy isn’t the whole answer

Even if we resolve the proxy behaviour, any interruption between your browser and the Five server can cause the same problem. There are many possible causes, such as network changes, Wi-Fi drops, or other networking equipment along the way, so we can’t guarantee that every situation is covered.

What we recommend

For any long-running process, run it in the background. A background process doesn’t depend on your browser’s connection, so it can’t be interrupted by a dropped connection and will run through to completion.

A good pattern for this is:

  1. Create a results table to store the output, such as your reports.
  2. Run the process in the background, writing its results to that table.
  3. Add a check in your UI code to see whether the results are ready.
  4. Fetch the results from the table whenever you need them.

This also means users don’t have to wait on screen for the process to finish. They can come back later and pick up the results.