Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entering the background immediately after closing the database causes a crash #1612

Closed
cragod opened this issue Sep 3, 2024 · 2 comments
Closed
Labels

Comments

@cragod
Copy link

cragod commented Sep 3, 2024

After closing the db pool, enter the background immediately. At this time, when performing releasingMemory, the sqliteConnection is already nil, which will cause a crash at sqlite3_db_release_memory

Crashed: GRDB.DatabasePool.writer: EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000018
 0                           0x106f22c sqlite3_db_release_memory + 2111308
 1                           0x2414c14 Database.releaseMemory() + 1576 (Database.swift:1576)
 2                          0x2453f54 closure #1 in closure #1 in DatabasePool.releaseMemoryEventually() + 208 (DatabasePool.swift:208)
 3                          0x252a7ec closure #1 in SerializedDatabase.async(_:) + 228 (SerializedDatabase.swift:228)
 4                          0x1cfeec0 thunk for @escaping @callee_guaranteed @Sendable () -> () + 5622064 (<compiler-generated>:5622064)

I think we need to check if it is nil.

@groue
Copy link
Owner

groue commented Sep 4, 2024

Hello @cragod,

Thank you for the report.

I could not reproduce the crash, but I could see an SQLite log message about misuse of sqlite3_db_release_memory with a NULL pointer. Maybe the actual behavior depends on the SQLite version. Please next time fill the issue template completely, and provide the requested information (system version, etc.).

I've created #1613 to fix this issue.

@groue groue added the bug label Sep 4, 2024
@groue
Copy link
Owner

groue commented Sep 7, 2024

The fix has shipped in v6.29.3

@groue groue closed this as completed Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants