3

A web app (HTML5 app, used on iOS (Safari or WebView)) using WebSQL sometimes does not work as expected. In short the working of the app: a user needs to register on a car before he sees a list of trips he can open. Because the app also needs to work offline it is using an API that synchronizes data between WebSQL and the backend server.

Upon registering to a car, a document is saved in the local WebSQL database with a timestamp. After sending the document successfully to the server, the timestamp is removed.

Sometimes, the document is initially successfully saved, but can't be updated afterwards. Neither is it possible to save new documents from the server in the WebSQL database.

The following error is logged to the console:

unable to commit transaction (5 database is locked)

So apparently somewhere on the way, the WebSQL database got locked. Reading is still possible, but creating and deleting documents is locked.

This does not always happen when using the app, but when it occurs, it is really annoying. How to prevent such a lock? And how can the lock be released so the user can continue using the app without the need for reopening the app?

Martine
  • 41
  • 5

0 Answers0