[META] Failure to deal with short read
Categories
(MailNews Core :: Database, defect)
Tracking
(Not tracked)
People
(Reporter: ishikawa, Unassigned)
References
(Depends on 2 open bugs)
Details
(Keywords: meta)
Reporter | ||
Updated•9 years ago
|
Reporter | ||
Updated•9 years ago
|
Reporter | ||
Comment 1•9 years ago
|
||
Reporter | ||
Comment 2•9 years ago
|
||
Reporter | ||
Comment 3•9 years ago
|
||
Reporter | ||
Comment 4•9 years ago
|
||
Updated•5 years ago
|
Reporter | ||
Comment 5•2 years ago
|
||
(In reply to ISHIKAWA, Chiaki from comment #4)
Well, I hate to admit there are conflicting reports of my own, but
I notice that there is another possibility of SHORT-WRITE (!):
(Maybe it is not exercised during |make mozmill| and not noticed during test
run?)
I noticed the following code when I was searching for ".json.tmp" using MXR
in C-C source tree.
(I was trying to identify places where READ to files with ".json.tmp" suffix
is performed.http://mxr.mozilla.org/comm-central/source/mozilla/toolkit/components/
terminator/nsTerminator.cpp#197267 // Shutdown may complete before we have a chance to close the file.
268 // This is not a leak.
269 MOZ_LSAN_INTENTIONALLY_LEAK_OBJECT(tmpFileDesc.get());
270
271 if (tmpFileDesc == nullptr) {
272 break;
273 }
274 if (PR_Write(tmpFileDesc.get(), data->get(), data->Length()) == -1)
{ <==== HERE!!!!
275 break;
276 }
277 tmpFileDesc.reset();The problem may seem more wide-spread than I originally thought.
But in this case, since this is a TEMPORARY file and so it probably is on a
locally mounted directory such as "/tmp" under linux, etc. If that was the
case, maybe we can ignore it although I feel a little uncomfortable leaving
the code as is.
A clarification is necessary.
This was posted 8 years ago by me.
Since then, I learned that |PR_Write()| is designed to retry write until all the octets are written successfully unless there is some fatal error such as disk system full, or network getting offline, etc.
|PR_Read()| does suffer from from short read. The problem is for real. It causes issues when TB's mail folder or profile is on remote file system.
Description
•