Web api randomly error

I writed a web app (cgi) api. It runs in a Linux server (64 bit).
This api connects to our database and receive requests. The format is JSON string (encrypted). After receive a string, the app converts the string to sql and write it to the database.
All operations are logged.
We tested it with lot of datas (4-5000 requests). The results are the “POST OK” string or an error code.
The problem - it seems randomly - that the result is “internal server error”. For example 2934 of 5000. But 2933 and 2935 requests are ok.
The app not logs anything because it does not get there.

I tried to do this:

AutoQuit = False

Self.Timeout = 0

It seems totally random, but I can’t find the cause.

This is not so reliable.
Has anyone ever met this problem?

Internal server errors in Xojo Web are usually caused by an unhandled exception of some kind.