google / lovefield

Lovefield is a relational database for web apps. Written in JavaScript, works cross-browser. Provides SQL-like APIs that are fast, safe, and easy to use.
https://google.github.io/lovefield/
Apache License 2.0
6.81k stars 366 forks source link

Select after delete and insert in transaction #264

Open arthurhsu opened 4 years ago

arthurhsu commented 4 years ago

Customer reported issue: https://groups.google.com/d/msgid/lovefield-users/8b96adb3-74a0-4ed9-9b98-c39128003390o%40googlegroups.com.

Minimum repro: http://plnkr.co/edit/ifNSA8OtXnsgDPFc?preview

arthurhsu commented 4 years ago

Sample code has misuse of db.close() but I don't know if that's the real cause. freshp86@ do you have cycles to take a look?

arthurhsu commented 4 years ago

This only happens if the second button is clicked immediately after the first one, suspecting a race condition for db.close() and db.init(). If I wait long enough (2 seconds on my Mac Pro), then the second select is working correctly.