Weird proxy pass timeout


I have an nginx server proxying traffic to a java app server (they are
on separate machines). I will be giving the configuration below, but
just to summarize the problem I am getting a

“2012/08/23 21:25:09 [error] 1798#0: *61949 upstream timed out (110:
Connection timed out) while connecting to upstream, client: …”

after 60 seconds from NGINX couple of times a day.

The weird thing is that I check the corresponding log entry on the
other side (java app server), and it looks like the request is
completed successfully on the java server side and the response was
prepared super fast (a few ms) since this was a heavily cached
content. BTW, traffic is really really low on both NGINX and java
server (like 1 req every 30 seconds or so), so it is not about worker
threads, number of processes, or any other congestion related issue,

Can you guys please provide any idea about what / how to debug? Since
Java side is super fast and I am getting this every once in a while, I
am really puzzled by this.

Thanks in advance…

BTW, my nginx configuration:

upstream appservers {
server X.X.X.X:5000;

    location / {
            proxy_pass              http://appservers;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For

proxy_set_header Host $http_host;
proxy_set_header x-forwarded-proto $scheme;