Example console triggered by gerrit 900459.
01:19:51 1) ApiUploadTest::testUploadChunks 01:19:51 ApiUsageException: The file /tmp/localcopy_14095242b63b.jpg does not exist. ... 01:19:51 [wfDebug] [debug] UploadStash::stashFile tried to stash file at '/tmp/localcopy_14095242b63b.jpg', but it doesn't exist {"private":false}
I've confirmed that it is possible to trigger deletion of the relevant temporary file while the file is still in use, using gc_collect_cycles(), which causes the TempFSFile to be destroyed.
Concatenation is finished by around line 607541 of the debug log, but it tries to stash again at line 607674. Why? The error indicates that performStash('critical') was called, so it must have been from getChunkResult() or getStashResult().