tomcatjasperserverconnection-timeouthttp-status-code-504

Jasper Reporting Server: Long Running Reports: 504 Gateway Timeout Errors


We have a Jasper Reporting Server community instance (Ver 7.1.1) running on Centos 7, using the Jasper-provided Apache TomCat server.

Jasper connects to our MS SQL and Postgres databases via JDBC connectors

The system works well for all short-running reports. If however, the time to run the report exceeds 30 seconds, then the report errors with a “504 Gateway Time-out” error.

This timeout occurs in long-running reports that use either of the databases.

These long-running SQL queries can be successfully run from SSMS or PGAdmin4 and take about 50 secs to run.

Postgres: To replicate the test on a Postgress, one can create a blank report, with the main dataset having the following query.
'''SELECT pg_sleep(30);''' If we set the sleep time to 29 seconds, the blank report runs ok. If we set it to 30 seconds, the blank report times out

MS SQL: Unfortunately, one has to find a long running query on a database. I don’t have an easily-portable test sample – sorry!

Have Tried: Somewhere in the Jasper / Apache / JDBC code is a setting to extend the query time out, but for the life of me (and Google), we can’t find it. We have tried:

Changing the connectionTimeout setting to 60 secs in the following file: /opt/jasperreports-server-cp-7.1.1/apache-tomcat/conf/server.xml <Connector port="8080" URIEncoding="UTF-8" protocol="HTTP/1.1" connectionTimeout="60000" redirectPort="8443"/>

Adding queryTimeout parameters to the JDBC connecton string. E.g. jdbc:sqlserver://192.168.1.1:1433;databaseName=test_db; queryTimeout=300

In both cases, we rebooted the server after making the changes but it made no difference.

There are some existing articles on rectifying general Apache 504 gateway timeouts, however, they refer to modifying files like “apache2.conf”, “httpd.config” or "php.ini" which don’t exist in our system.

Any guidance will be greatly appreciated.

Many thanks in anticipation

James


Solution

  • Is there any proxy server like NGINX sitting between the client and the jasper report server? A proxy server usually has it's own timeout setting