Closed Bug 1665412 Opened 4 years ago Closed 4 years ago

Report telemetry when the IO layer feeds a zero-length stream to the parser

Categories

(Core :: XML, task)

task

Tracking

()

RESOLVED DUPLICATE of bug 1693146

People

(Reporter: zbraniecki, Unassigned)

References

(Blocks 1 open bug)

Details

Initial telemetry indicates that one of the more common sources of YSOD on Beta is that .xhtml (XUL) documents are erroring out with NO_ELEMENTS and UNKNOWN_ENTITY errors.

For the former, it seems pretty plausible that the reason is that IO layer feeds a zero-byte long document to the parser.

For the latter, it is also possible that the IO layer feeds a zero-byte long DTD document to the parser.

Henri suggested on Matrix to add a flag to nsParser that would get flipped at https://searchfox.org/mozilla-central/source/parser/htmlparser/nsParser.cpp#1275 when OnDataAvailable sees a non-zero-length buffer and then in OnStopRequest have a probe that checks the flag.

Henri:

  1. Will that cover both XML and DTD files?
  2. Is there a risk that the last block of data is going to be empty and the flag ends up being true in OnStopRequest?
  3. Is there any additional data we could collect in such telemetry event to help us with the next step if we indeed confirm the hypothesis that 0-byte long documents correlate with the errors? (like, which IO causes it etc.)
Flags: needinfo?(hsivonen)

(In reply to Zibi Braniecki [:zbraniecki][:gandalf] from comment #0)

  1. Will that cover both XML and DTD files?

No, DTDs are here:
https://searchfox.org/mozilla-central/rev/f4b4008f5ee00f5afa3095f48c54f16828e4b22b/parser/htmlparser/nsExpatDriver.cpp#595

  1. Is there a risk that the last block of data is going to be empty and the flag ends up being true in OnStopRequest?

We should have a "has seen at least one byte" flag and set the flag if any OnDataAvailable call reports more that zero bytes.

  1. Is there any additional data we could collect in such telemetry event to help us with the next step if we indeed confirm the hypothesis that 0-byte long documents correlate with the errors? (like, which IO causes it etc.)

Redirecting this question to Necko.

Flags: needinfo?(hsivonen) → needinfo?(dd.mozilla)

OnDataAvailable should not be call with count==0. That is per the design. Is it possible that count is not 0 but actually data is not available. We could check Available() if it implemented by the stream.
The data is always coming from omni.ja, is this right? In that case we can add some telemetry to nsJARChannel::OnDataAvailable.

Flags: needinfo?(dd.mozilla)
Depends on: 1677822
No longer blocks: 1675205
Depends on: 1675205
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.