Closed Bug 247715 Opened 20 years ago Closed 20 years ago

###!!! ASSERTION: unexpected progress values: 'progress <= progressMax', file /home/chb/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp, line 3712

Categories

(Core :: Networking: HTTP, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.8alpha2

People

(Reporter: Biesinger, Assigned: Biesinger)

References

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

###!!! ASSERTION: unexpected progress values: 'progress <= progressMax', file
/home/chb/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp, line 3712
1083267968[8093548]: ###!!! Break: at file
/home/chb/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp, line 3712

nsInt64 correctly determines that 284 is > -1 :(

        nsInt64 progressMax(mResponseHead->ContentLength());
        nsInt64 progress = mLogicalOffset + nsInt64(count);
        NS_ASSERTION(progress <= progressMax, "unexpected progress values");

Maybe ContentLength should be inited with LL_MaxInt() not MaxUint... or the
comparison should be unsigned
Depends on: 245927
Target Milestone: --- → mozilla1.8alpha2
Attached patch patch (obsolete) — Splinter Review
uses nsUint64; so requires the patch in the bug on which this one depends on
now...
Attachment #151254 - Flags: superreview?(darin)
Attachment #151254 - Flags: review?(darin)
Status: NEW → ASSIGNED
Keywords: regression
*** Bug 247773 has been marked as a duplicate of this bug. ***
Comment on attachment 151254 [details] [diff] [review]
patch

Hmm... I was worried about signed/unsigned affects.  Good patch.  I'm glad to
see that we have nsUint64 now.
Attachment #151254 - Flags: superreview?(darin)
Attachment #151254 - Flags: superreview+
Attachment #151254 - Flags: review?(darin)
Attachment #151254 - Flags: review+
Seems like overkill just to quash an assertion. At 1GB/sec transferring 2^63 
bytes (the smallest integer that doesn't fit in a int64) will take > 272 
years. That far exceeds the shelf life of mozilla. :-)

You also lose the ability to detect impossible values and you need keep track 
of such things as "not yet started" (i.e., progressMax = -1) separately.

Do you really want to do this?
(In reply to comment #4)
> Seems like overkill just to quash an assertion.

huh?

> At 1GB/sec transferring 2^63 
> bytes (the smallest integer that doesn't fit in a int64) will take > 272 
> years. That far exceeds the shelf life of mozilla. :-)

I'll trust you on that.

> You also lose the ability to detect impossible values and you need keep track 
> of such things as "not yet started" (i.e., progressMax = -1) separately.

progressMax == -1 does not mean "not yet started", it means "total size
unknown". as it is the maximum 64 bit number, this is very suitable as an upper
bound when the real size is not known. I'm using nsUint64 here to get an
_unsigned_ comparison, not to double the number space.
> progressMax == -1 does not mean "not yet started", it means "total size
> unknown".

Ok, but the important point is that you're storing both normal data and
status information in the same variable. It's easy to distinguish the two
types of data with signed quantities. Switching to unsigned variables makes
it harder to separate the data. That's why I said you would need to store
the two types of data separately.

> I'm using nsUint64 here to get an _unsigned_ comparison ...

You're really asking two questions: 1) is the data valid and 2) is it within
some limit. Signed quantities make answering both questions simultaneously
relatively easy. Unsigned quantities make it harder. Wouldn't it be better
to rework the tests to decide which question you're asking? Perhaps in 
separate steps. 
(In reply to comment #6)
> Ok, but the important point is that you're storing both normal data and
> status information in the same variable. It's easy to distinguish the two
> types of data with signed quantities. Switching to unsigned variables makes
> it harder to separate the data. That's why I said you would need to store
> the two types of data separately.

(you _are_ aware that this was always using unsigned numbers and only recently
changed accidentally to a signed number, right? (bug 243974))

the length of a stream is an unsigned data point. it thus makes sense to store
it in an unsigned variable.

it makes perfect sense to treat "no length known" as the maximum possible
number, so that it is effectively not limited.

> You're really asking two questions: 1) is the data valid and 2) is it within
> some limit.

I am? where?
I only want to know "did the server send more data than it claimed it would send"

> Signed quantities make answering both questions simultaneously
> relatively easy. Unsigned quantities make it harder.

since I don't particularly want to know whether the server did send a length, I
don't need to answer a second question.

Attached patch patch v2Splinter Review
after the latest patch in the nsUint64 patch, some more casts are needed
Attachment #151254 - Attachment is obsolete: true
Checking in base/src/nsInputStreamPump.cpp;
/cvsroot/mozilla/netwerk/base/src/nsInputStreamPump.cpp,v  <-- 
nsInputStreamPump.cpp
new revision: 1.14; previous revision: 1.13
done
Checking in base/src/nsInputStreamPump.h;
/cvsroot/mozilla/netwerk/base/src/nsInputStreamPump.h,v  <--  nsInputStreamPump.h
new revision: 1.5; previous revision: 1.4
done
Checking in protocol/http/src/nsHttpChannel.cpp;
/cvsroot/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp,v  <-- 
nsHttpChannel.cpp
new revision: 1.209; previous revision: 1.208
done
Checking in protocol/http/src/nsHttpChannel.h;
/cvsroot/mozilla/netwerk/protocol/http/src/nsHttpChannel.h,v  <--  nsHttpChannel.h
new revision: 1.59; previous revision: 1.58
done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
V/lxr.
Status: RESOLVED → VERIFIED
QA Contact: core.networking.http → benc
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: