background

Because its own project (Springboot back-end service) is related to document editing, there will be a large number of file upload oss operations, and there will be large file upload in the process. In order not to affect the experience, the back-end service directly returns a successful file stream after receiving it, and then sends it to the sub-thread to asynchronously invoke the OSS upload service.

The problem

The initial tests didn’t show it at all, and it didn’t feel like it was necessary. Later, when I looked at the system logs while troubleshooting other problems, Occasionally found a Java. IO. IOException: Java. IO. FileNotFoundException: / home/admin/appName/default/temp/tomcat 4504264197870423949.70 01 / work/Tomcat/Localhost/ROOT/upLoad_ff92855a_13c6_49d9_bbdf_1c062fb9bfd9_00000004. TMP (without the file or directory).

Location problem

In this case, an error will be reported when the asynchronous thread retrieves the file again!

To deal with