core icon indicating copy to clipboard operation
core copied to clipboard

Timeout when trying to export records from a form

Open nicktalsma opened this issue 2 years ago • 2 comments

I suspect this may be more of a host issue / php settings (which I am unable to edit with my current hosting package), but double checking anyway. I have noticed I am getting a page not found, HTML 500 error when I try to export too many records at once. For example if I try to export 1,000 records to Excel, the page loads for around 20-30 seconds and then spits out an Excel file of my requested data. If I try to export 2,000 records to Excel, the page loads for around 60 seconds and gives me the page not found error.

Any workaround here? Thanks!

nicktalsma avatar Mar 01 '23 22:03 nicktalsma

Hey @nicktalsma, ah I remember this issue. No great tips, I'm afraid :( - it's probably just memory. You could check your PHP error logs to see exactly what it's outputting, but it's probably simpy running out of available memory and crashing after the first minute. The default export timeout time has been set to 5 minutes (300 seconds) for the last few versions of the module - that's set in the Export Manager module settings. Might be worth checking that that's the value you have it set to and not something lower (Modules -> Export Manager -> Settings).

To be frank, the module's export functionality is pretty old and needs to be re-examined to generate the data in smaller chunks and write them to disk to free up memory, then combine them all at the end. Oddly enough I'm working on exactly the same problem for a different script right now (node).

benkeen avatar Mar 02 '23 04:03 benkeen

@benkeen thanks for the quick reply! You are correct the timeout is set to 300 seconds. And correct again about running out of memory:

[02-Mar-2023 14:45:21 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1048576 bytes) in /formtools/modules/export_manager/smarty_plugins/function.smart_display_field.php on line 56

nicktalsma avatar Mar 02 '23 14:03 nicktalsma