Splitting from bug 54736
When uploading https://test.wikipedia.org/wiki/File:54736-2.png
First uploaded both versions to file stash.
Then issued the publish request (?action=upload&filekey=foo&...)
According to firefox network profiling, the publish request for what ended up the second version of the file (the version with the 1 on it) was sent slightly before the publish for the other version, but both were sent at essentially sent at the same time.
The publish request for the version with a 2 on it finished normally, and rather quickly. The publish for the version with a 1 on it (The current version) stalled for quite a while, and eventually returned a squid/varnish error
"Request: POST http://test.wikipedia.org/w/api.php, from 220.127.116.11 via cp1010.eqiad.wmnet (squid/2.7.STABLE9) to 10.64.0.123 (10.64.0.123)<br/>
Error: ERR_READ_TIMEOUT, errno [No Error] at Fri, 04 Oct 2013 14:52:03 GMT"
Interestingly, the second version of the file was uploaded (according to RC/image table) at precisely 14:52:03. It seems quite a coincidence that everything was done at precisely the moment when the squid hung up, which makes me think maybe there is some sort of deadlock going on, which is immediately cleared the moment the client (squid) terminated its connection to php.
Then again, maybe its a weird coincidence. Probably not critical, but should probably be further investigated.