Oskar Gunther Oskar Gunther -4 years ago 95
PHP Question

Connection between apache2 server and client breaks after 6 minutes

I've got big issue with connection between user browser and apache2 server. We've to process a lot of data, so the request takes more time, and client have to wait for response more than few minutes. It worked well for a month.. then it started breaking the connection (or something similar).

Every time connection is closed after 6 minutes. Chrome browser throws an

. DHC shows
No response
No content
. In apache
, log level set to debug, there's nothing, running
tail -f dev.log
in symfony I can see, that script is still running.. till the end, no errors.

Weird is that when I run the script from Windows the connection is lossed not after 6 minutes but 12. I've got 12 minutes when I run 2 different requests by browser on Mac.

2 days of debugging and nothing. Not even a single row of log.

Where can I look next? Network logs? Maybe someone had same issue?

Answer Source

Didn't find reason, but the answer is streamed response + JSON. Connection won't break if there's a response.

This gave powerful tool for debug (live memory usage) and showed me that the problem is memory (Enity Manager in doctrine is very low when it stores too much objects).

Btw, cool way to work with Doctrine's $em->clear().

foreach ($items as $item) {
    $item = $this->em->getReference('AppBundle:Item',$item->getId());


That's cool, because you don't need to detach objects related to $item, just full clear and attach it back. Works really fast.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download