Interesting. So I've seen this happening on my development machine (design mode), in testing (testing mode), and in production (yep, production mode). So, I doubt very much it could be 1 or 3.
However, 2... I don't think so, but tell me what you think.
This page does the following...
1. downloads the top 20 email headers and caches the query in session
2. downloads one email in its entirety and processes it (validates it's parts, organizes the attachments, logs, adds to the DB, etc)
3. At the end, it redirects to itself using redirecTo() and repeats the process (except it uses the cached headers until it has downloaded all 20)
4. at the end, I rest and set a meta redirect to kick off the process again
I know it seems funky to do so many redirects, but its the only way I can avoid the timeout limits. Sometimes downloading 20 email headers is incredibly slow, sometimes it's quick. I can redirectTo up to 21 times before the browser stops the process, which is why I rest for a few seconds to let the meta redirect start it off again.
But I'm not processing any redirects mid-control, just at the end, once the process has already concluded. So unless some of the controller processes are happening async to the redirects, I don't see how this could be the problem. Thoughts?
FYI: I also tried CFThread to async download the emails to avoid the timeouts. This worked great until I went to production. Apparently, ACF doesn't play well with threaded apps in a co-hosted environment.