Closed Bug 1563305 Opened 5 years ago Closed 5 years ago

Make ProfilerGetSymbols.jsm throw more detailed errors if symbolication goes wrong for any reason

Categories

(Core :: Gecko Profiler, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox69 --- wontfix
firefox72 --- fixed

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(3 files)

We have code in ProfilerGetSymbols.jsm and its dependencies that takes a path to a binary on the local file system, and an ID, and returns a symbol table for that binary.

This code can fail, for a variety of reasons:

  • The file might not be present at the given path.
  • The file contents could not be loaded into memory.
  • The file contents are not recognizable as any supported binary type.
  • The given breakpad ID was malformed.
  • The ID computed for the binary at the given location does not match the given breakpad ID, for example because the binary was updated as the result of a more recent compile.
  • There was a parse error.
  • Some other error occurred.

Today, all those failures are reported as the same type of error. It is very hard to find out which of these things actually went wrong. On the rust side, all of those failures are conflated in the None value of on Option and then returned as false through the FFI boundary.

We should change this code to use proper rust Result types with different error kinds, and then expose them in some way to JS through the rust/WASM/JS boundary.

Depends on: 1563310
Blocks: 1563316

There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:ccheung256, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(ccheung256)

I will take over the rest of the work here at some point.

Assignee: ccheung256 → mstange
Status: NEW → ASSIGNED
Flags: needinfo?(ccheung256)

This adds onerror and onmessageerror handlers.
The former is called if there's a syntax error in the worker script, for example.
Without this handler, such mistakes can easily fail silently and go unnoticed.
The latter is supposed to be called when a message is received that cannot be
deserialized. I'm not sure how to get into that state, but it seems like a good
idea to add the handler anyway.

There are some worker errors that these two handlers do not catch. For example,
if the worker tries to send a message that is not Structured Cloneable, neither
of these handlers is called; instead, the postMessage call within the worker
throws an error, and that error needs to be manually propagated from the worker
to the origin thread, via postMessage. And if such an error is encountered
within the error propagation code itself, we're out of luck.

Moreover, somewhat unrelatedly: WorkerGlobalScope.onerror is not called for
unhandled promise rejections. So if we throw an error within an async function
inside the worker, we can only handle that error if it happens within a
try {} catch {} block.

Depends on D44402

Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/fd6c19a8a055
Make ProfilerGetSymbols.jsm throw more detailed errors if symbolication goes wrong for any reason r=mstange
https://hg.mozilla.org/integration/autoland/rev/d7d489555f5f
Make error objects propagate correctly from the worker into the profiler page. r=julienw
https://hg.mozilla.org/integration/autoland/rev/7bf3e2fd554c
Propagate more worker errors. r=julienw
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: