Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.58k stars 595 forks source link

Crash: Closing database followed by Error: Leak detected! #1718

Open 17Amir17 opened 11 months ago

17Amir17 commented 11 months ago

Hey, on my project whenever hot reloading or sometimes randomly when interacting with the app, the app crashes with the following error in flipper

Closing database...
Error: Leak detected! Finalized a statement when closing database - this means that there were dangling statements not held by cachedStatements, or handling of cachedStatements is broken. Please collect as much information as possible and file an issue with WatermelonDB repository!

Screenshot 2023-12-05 at 15 02 16

Also this is what I see from the xcode breakpoint

sqlite 3 hades (18): EXC_BAD_ACCESS (code=1, address=0x80000000116775ab)

Screenshot 2023-12-05 at 15 43 57

I'm not really sure why it's closing the db either Any idea how I can debug this further?

17Amir17 commented 10 months ago

This mainly happens when developing and hot reloading, but from playstore crash logs I have seen this happen in production, @radex is there any direction you can give me to investigate this? I tried looking around and it looks like the DB is being closed before this happens (I do not call this)