Open Bug 1729724 Opened 3 years ago Updated 3 years ago

Report cache sqlite corruption with a dedicated error

Categories

(Core :: DOM: Service Workers, defect, P3)

defect

Tracking

()

People

(Reporter: fabrice, Unassigned)

Details

In chrome code, when calling serviceWorkerManager.register() fails the error returned in case of a sqlite file corruption has its name set to TypeError. This can also happen in other cases so it's not a great way to decide when we need to recover from the corruption (calling Services.qms.clearStoragesForPrincipal() works for that).

Alternatively, a way to check the integrity of the storage for a given principal would work of course. What do you think would be the best solution?

I am not sure I understand the description correctly or not.

Does it mean the error is not specified enough to decide should we call Services.qms.clearStoragesForPrincipal()?

Severity: -- → S3
Priority: -- → P3

I see 2 separate issues here:

  1. Reporting errors in more detail. The error codes we report to content are very much defined by the spec and are frequently motivated by security concerns. That said, I've always thought it would be friendly to users if we were able to propagate additional information about the error codes in a privileged field that devtools and WPT tests can see and content cannot. Chrome code would be able to see this too. We could definitely benefit from a bug for this if we don't already, although this would likely depend on fundamental changes to ErrorResult.
  2. Automatic handling of corruption errors. Bug 1694935 already implemented automated clearing due to origin initialization failing, but we have systematic problems with a failure to detect and respond to dynamically detected corruption. I've slightly updated bug 1652461 to reference dynamic corruption but the key would be addressing bug 1125157 in mozStorage.

Doing 1. would be a good start, yes. In the failures we've seen, we believe that SQlite PRAGMA integrity_check detects the issue, but I don't know if there are ways to recover some data or not. I would tend to just clear up caches in our case, but that doesn't have to be automatic.

You need to log in before you can comment on or make changes to this bug.