Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Issue 541022: Fix the case where the browser livelocks if we cannot open a file. (Closed)

Created:
10 years, 11 months ago by agl
Modified:
10 years, 10 months ago
CC:
chromium-reviews_googlegroups.com, brettw+cc_chromium.org, pam+watch_chromium.org, John Grabowski, darin+cc_chromium.org, Paweł Hajdan Jr., darin-cc_chromium.org
Visibility:
Public.

Description

Fix the case where the browser livelocks if we cannot open a file. If one tries to upload a file that one doesn't have read access to, the browser livelocks. It tries to read from the file, gets nothing but spins forever because it knows that it hasn't finished reading. To address this, firstly we add a check at stat() time to make sure that we can read the file. However, this doesn't take care of the case where the access() call was incorrect, or the permissions have changed under us. In this case, we replace the missing file with NULs. BUG=30850 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=42152

Patch Set 1 #

Total comments: 14

Patch Set 2 : ... #

Patch Set 3 : ... #

Total comments: 19

Patch Set 4 : ... #

Total comments: 22

Patch Set 5 : ... #

Patch Set 6 : ... #

Total comments: 13

Patch Set 7 : ... #

Total comments: 7

Patch Set 8 : Uploading checkpoint. This is known to cause all uploads on Windows to be zero bytes long. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+215 lines, -66 lines) Patch
M base/platform_file.h View 2 3 4 5 6 7 2 chunks +6 lines, -0 lines 0 comments Download
M base/platform_file_posix.cc View 2 3 4 5 1 chunk +8 lines, -0 lines 0 comments Download
M base/platform_file_win.cc View 2 3 4 5 1 chunk +8 lines, -0 lines 0 comments Download
M net/base/file_stream.h View 2 3 4 5 6 7 1 chunk +12 lines, -1 line 0 comments Download
M net/base/file_stream_posix.cc View 2 3 4 5 6 7 4 chunks +24 lines, -8 lines 0 comments Download
M net/base/file_stream_win.cc View 2 3 4 5 6 7 3 chunks +31 lines, -10 lines 0 comments Download
M net/base/upload_data.h View 1 2 3 4 5 6 7 5 chunks +38 lines, -9 lines 0 comments Download
M net/base/upload_data.cc View 1 2 3 4 5 6 7 2 chunks +56 lines, -16 lines 0 comments Download
M net/base/upload_data_stream.h View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M net/base/upload_data_stream.cc View 1 2 3 4 5 6 7 4 chunks +30 lines, -20 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
agl
10 years, 11 months ago (2010-01-12 03:04:42 UTC) #1
darin (slow to review)
http://codereview.chromium.org/541022/diff/1/5 File net/base/upload_data.cc (right): http://codereview.chromium.org/541022/diff/1/5#newcode28 net/base/upload_data.cc:28: if (!file_util::PathIsReadable(file_path_)) on windows, it might be nice to ...
10 years, 11 months ago (2010-01-12 07:57:45 UTC) #2
wtc
I assume the livelock occurs in the while loop in UploadDataStream::FillBuf(), right? I have some ...
10 years, 11 months ago (2010-01-12 19:51:02 UTC) #3
agl
I decided to change how this works. Rather than cope with the case where the ...
10 years, 11 months ago (2010-01-25 14:14:09 UTC) #4
wtc
http://codereview.chromium.org/541022/diff/1/7 File net/base/upload_data_stream.cc (right): http://codereview.chromium.org/541022/diff/1/7#newcode81 net/base/upload_data_stream.cc:81: // If a file is visible to us but ...
10 years, 11 months ago (2010-01-25 20:07:11 UTC) #5
wtc
I made a pass through Patch Set 3, but I couldn't understand it completely. Sorry. ...
10 years, 11 months ago (2010-01-26 01:43:22 UTC) #6
agl
> I don't understand your changes to upload_data.{h,cc}. > SetToFilePathRange becomes much more complicated, while ...
10 years, 11 months ago (2010-01-26 13:39:03 UTC) #7
wtc
OK, I understand the CL much better now. The code in upload_data_stream.cc is very complicated, ...
10 years, 11 months ago (2010-01-26 20:00:26 UTC) #8
agl
http://codereview.chromium.org/541022/diff/6014/9001 File base/platform_file.h (right): http://codereview.chromium.org/541022/diff/6014/9001#newcode59 base/platform_file.h:59: // *out_length is set to the length of the ...
10 years, 10 months ago (2010-02-10 15:40:50 UTC) #9
wtc
Darin: I'm out of the office today. If you have some spare time, could you ...
10 years, 10 months ago (2010-02-11 14:58:34 UTC) #10
darin (slow to review)
looks great overall. just some comments / questions... http://codereview.chromium.org/541022/diff/11015/10002 File base/platform_file.h (right): http://codereview.chromium.org/541022/diff/11015/10002#newcode66 base/platform_file.h:66: public ...
10 years, 10 months ago (2010-02-12 09:16:22 UTC) #11
wtc
LGTM. Please update the description of the CL to reflect the current code. I suggest ...
10 years, 10 months ago (2010-02-12 22:50:35 UTC) #12
wtc
http://codereview.chromium.org/541022/diff/11015/10011 File net/base/upload_data_stream.cc (right): http://codereview.chromium.org/541022/diff/11015/10011#newcode79 net/base/upload_data_stream.cc:79: false /* not async */); Also, replacing open_flags with ...
10 years, 10 months ago (2010-02-12 22:53:40 UTC) #13
wtc
10 years, 10 months ago (2010-02-20 05:54:22 UTC) #14
I believe I found a bug.  Please see my comment marked with
"BUG" below.

http://codereview.chromium.org/541022/diff/16001/16005
File net/base/file_stream.h (right):

http://codereview.chromium.org/541022/diff/16001/16005#newcode47
net/base/file_stream.h:47: void Release();
Instead of adding a Release() method, perhaps we can just
add a 'bool owns_file_' argument to the Open() method at
line 59, and change the Close() method to close file_ only
if owns_file_ is true.

http://codereview.chromium.org/541022/diff/16001/16005#newcode61
net/base/file_stream.h:61: // Returns true if Open succeeded and Close has not
been called.
Should this comment be updated to say "Close or Release has
not been called"?

http://codereview.chromium.org/541022/diff/16001/16009
File net/base/upload_data.cc (right):

http://codereview.chromium.org/541022/diff/16001/16009#newcode43
net/base/upload_data.cc:43: file_->release();
BUG:  I believe file_->release() leaks the PlatformFile handle!

We should say
  file_ = NULL;

http://codereview.chromium.org/541022/diff/16001/16009#newcode62
net/base/upload_data.cc:62: file_path_= path;
Why do we set file_path_ to path in this case?
This no longer matches the comments on lines 76-77 in
upload_data.h.

http://codereview.chromium.org/541022/diff/16001/16009#newcode79
net/base/upload_data.cc:79: file_ = new base::RefCountedPlatformFile(file);
We may no longer need the RefCountedPlatformFile class now.

http://codereview.chromium.org/541022/diff/16001/16010
File net/base/upload_data.h (left):

http://codereview.chromium.org/541022/diff/16001/16010#oldcode98
net/base/upload_data.h:98: uint64 GetContentLength() const;
Can we add back this 'const'?

http://codereview.chromium.org/541022/diff/16001/16012
File net/base/upload_data_stream.h (left):

http://codereview.chromium.org/541022/diff/16001/16012#oldcode17
net/base/upload_data_stream.h:17: explicit UploadDataStream(const UploadData*
data);
Can we add back this 'const'  and the 'const' at line 45 now?
I guess the data_->CloseFiles() call in the destructor require
that data_ be non-const.

Powered by Google App Engine
This is Rietveld 408576698