Skip to content

Exceptions during database upgrade no longer closes the connection #473

@stelar7

Description

@stelar7

After #458, the condition for closing with an error was changed to check the requests error.
Unfortunately that will never be true, as we pass that point before the request has its error set.

Following the flow, it seems to go like this:
open -> upgrade -> queue TASK A -> wait for finished state -> close if request's error is set
TASK A -> upgrade needed -> did throw = true -> abort -> transaction set as finished -> queue TASK B
TASK B -> request gets its error set.

Since the transaction gets marked as finished before TASK B is started (we will finish TASK A with TASK B still pending), upgrade will then check if the transaction is finished, (which it is at this point), go back to open, where step 10.8 will not see the error yet.

Possible idea for solution:

  • New step after 5. in abort: If transaction is an upgrade transaction: Set transaction's associated request's error to a newly created "AbortError" DOMException.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions