While working with DHIS 2 on Android devices it is important to tweak some parameters of the server timeout so both the Android App and the Tomcat Server use the same timeout values. By using the default values in the server setup the connection might be closed before the data sent by the Android app is processed leading to some inconsistencies.
The DHIS 2 Android App timeout has been modified from 120 seconds to 600 seconds as from version 1.3.1 as it can be seen in the code in Github
The information below could be considered an annex to the Implementation guide - Installation
Summary chart of DHIS 2 Android App timeout value (in seconds)
| Version | Timeout | | < 1.3.1 | 120 | | ≥ 1.3.1 | 600 |
Note: While using several versions of the Dhis 2 Android App apply the greatest value.
Configuring Tomcat timeout
Modifiy the connectionTimeout option in the configuration file tomcat-dhis/conf/server.xml according to your needs. In doubts see table above. Note that this value should be specified in milliseconds (in this case 120000 milliseconds or 120 seconds).
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="120000" redirectPort="8443" relaxedQueryChars="" />
If Nginx is used as a reverse proxy several options should be specified in order to modify this timeout. In order to do this modify your nginx configuration file (usually under /etc/nginx/sites-available/). Note that here is specified in seconds.
proxy_connect_timeout 120; proxy_send_timeout 120; proxy_read_timeout 120; send_timeout 120;
See the Nginx doc for more information.
Specific instructions for AWS / Load Balancer
If Amazon Web Services / Load Balancer is being used make sure that the idle timeout is properly set up as well following the same principle as above. More information can be found on the Nginx documentation
Other web servers
Feel free to comment or add in case you use any other HTTP server as a reverse proxy (like Apache) so we can provide the configuration.