Server routine timeout?
Posted: Fri Jul 19, 2024 6:23 pm
Hello,
We are working with a file picker (client side) and the built-in function STM_FILE_OPEN + STM_FILE_READ (server side) to upload and parse CSV files but we are having some issues when processing large files in our code.
The upload works fine and the server routine 'CSVToList' works like we want with small sized files. However, when we upload a large file (for example, we have CSV files with 1 million lines), when the server routine takes more than 5 minutes to do its job we have some sort of timeout with a fatal error on the frontend, I have attached an image showing the error message.
Eventhough this error appears, the server routine still works on the IBM i and our database is fully populated after a few more minutes.
We can see the HTTP request staying unanswered for 5 minutes before the error occurs and ends correctly with a status code of 200.
However, the event #sys_web.RequestFailed is fired and the following code gives the following result:
Evtroutine Handling(#sys_web.RequestFailed) Reason(#Reason) Request(#Request)
#sys_web.console.Log( ('request failed: &1 Request: &2').substitute( #Reason #Request.Name ) )
Endroutine
request failed: SERVERERROR Request: CSVTOLIST
Is there a way to solve this? Do we have to change some settings?
Is there maybe a clean way to send the HTTP response to the client before the server routine ends its job?
Thank you for your help.
We are working with a file picker (client side) and the built-in function STM_FILE_OPEN + STM_FILE_READ (server side) to upload and parse CSV files but we are having some issues when processing large files in our code.
The upload works fine and the server routine 'CSVToList' works like we want with small sized files. However, when we upload a large file (for example, we have CSV files with 1 million lines), when the server routine takes more than 5 minutes to do its job we have some sort of timeout with a fatal error on the frontend, I have attached an image showing the error message.
Eventhough this error appears, the server routine still works on the IBM i and our database is fully populated after a few more minutes.
We can see the HTTP request staying unanswered for 5 minutes before the error occurs and ends correctly with a status code of 200.
However, the event #sys_web.RequestFailed is fired and the following code gives the following result:
Evtroutine Handling(#sys_web.RequestFailed) Reason(#Reason) Request(#Request)
#sys_web.console.Log( ('request failed: &1 Request: &2').substitute( #Reason #Request.Name ) )
Endroutine
request failed: SERVERERROR Request: CSVTOLIST
Is there a way to solve this? Do we have to change some settings?
Is there maybe a clean way to send the HTTP response to the client before the server routine ends its job?
Thank you for your help.