Skip to content

use cacheDir for setting TMPDIR env to solve android 12 issue - #25

Closed
SebastianSingle99 wants to merge 2 commits into
margelo:mainfrom
meetnow:feature/android_12_env
Closed

SebastianSingle99 wants to merge 2 commits into
margelo:mainfrom
meetnow:feature/android_12_env

Conversation

@SebastianSingle99

Copy link
Copy Markdown

sqlite3.c tries to use the TMPDIR environment variable which resolves to /data/user/0/<app-id>/cache except for Android 12 devices. I'm not sure if this is a bug in android, but it leads to this error message:

WebSQL threw an error [Error: [react-native-quick-sqlite] SQL execution error: disk I/O error

sqlite cannot write the temporary file, because it cannot find a valid file path.

This pull requests overwrites the TMPDIR variable explicitly with the cache directory. Any other ideas or solutions are welcome.

@gegana

gegana commented Oct 19, 2023

Copy link
Copy Markdown

I noticed this exact problem as well and had to configure the temp store to be in memory. I think this problem has existed even before the ownership transition.

PRAGMA temp_store = memory;

@EduFrazao

Copy link
Copy Markdown

I noticed this exact problem as well and had to configure the temp store to be in memory. I think this problem has existed even before the ownership transition.

PRAGMA temp_store = memory;

Yes, its a know problem with the same workaround in different libraries. On android, TEMP STORE is set to temp.

@chrispader chrispader added bug Incorrect behavior or a change that fixes it. area:runtime Database lifecycle, SQL execution, transactions, or native runtime. platform:android Issue or change affecting Android. labels Sep 29, 2026
@chrispader

Copy link
Copy Markdown
Member

Superseded by #406. It preserves your two commits and ports the Android temporary-directory fix to current NitroSQLite, with an integration test. Answered by Codex, instructed by Chris.

@chrispader chrispader closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:runtime Database lifecycle, SQL execution, transactions, or native runtime. bug Incorrect behavior or a change that fixes it. platform:android Issue or change affecting Android.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants