-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file write timing issue #184
Comments
Hi, That is interesting, can u share middleware debug logging for the issue, when u do that without timeout? Also could u clarify whether /data and /tmp located on the same fs and what type of hardware u are using when getting this issue. |
Hi, I'm using Docker on Ubuntu 18.04 host. before timeout fix, the debug log was something like that after timeout fix, I saw uploaded file saved by multiple chunks sometimes Is it possible these files was wrong before timeout? |
The output you showed up looks strange for me, what version of middleware are you using? Answering your question about callback immediate start. |
I'm using |
There were several changes in file handling since 1.1.3. |
Hi @szilvasics , any updates about this issue? |
We encountered a similar issue in our application and tracked it down to the fact, that the middleware does not wait for the tempfile to flush / finish. |
Hi @caritasverein , Thanks for your investigation. Could you also clarify which version of middleware you use and if it's the latest one share the output when debug option set to true. |
i meet the same bug with Docker Centos. version 1.1.5 |
I just had that same problem. I was moving the file using process.exec("mv ...") (because mv() was broken in my old release). The file would get moved but it was 0 bytes. If I add a sleep before moving, everything is fine. and I've seen that repeatedly but only on one system. I think the file should get flushed before calling next(). Or maybe do a validation of the file size/existance before proceeding. |
I released a package called |
@RomanBurunkov are you ok with @somewind's PR? Or were you thinking about another solution? |
I have some doubts about it, but still haven't had a chance to look into because of having no free time =( |
The previous reply did not express clearly, I have modified it as you said, please check the PR again 😃 |
We recently hit the same error when API benchmarking start for our project. Almost 13% of the times file uploads fail with the error We see that your commit has been merged. We are on 1.1.6. NPM Registry suggests that 1.1.6 updated 4 months ago. How can we access your fix ? Please guide. |
@RomanBurunkov Can you please guide ? I have placed a comment 6 Days ago. |
Having same problem. |
Hi there, Going to publish into npm 1.1.7-alpha.1 with @somewind fix for this issue. |
I found an error in the "file-flow":
MW config:
app.use(
fileUpload({
useTempFiles: true,
tempFileDir: "/tmp/",
debug: true,
safeFileNames: true
})
);
The file seems OK when I check with:
if (Object.keys(req.files).length == 0 || !req.files.file) {
return console.log("No file uploaded.");
}
but sometimes, I get an error when I try to move the file to a new path
{ [Error: ENOENT: no such file or directory, open '/tmp/tmp1575948653152']
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/tmp/tmp1575948653152' }
I use this code to move:
req.files.file.mv(
/data/${prefix}_${req.files.file.name}
, err => {if (err) {
return console.log("Error in file moving", err);
}
...
});
I checked the file and exists in /tmp
The problem was fixed, when I changed my code to wait a second (with setTimeout) before move the file.
The text was updated successfully, but these errors were encountered: