transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.65k stars 425 forks source link

[SQLite] Database locked #1472

Closed rs-quyenht closed 4 months ago

rs-quyenht commented 2 years ago

Your Environment


## Expected Behavior
<!--- Tell us what should happen -->
There are no crash happened.

## Actual Behavior
<!--- Tell us what happens instead -->
Crash happened. 

## Steps to Reproduce
<!--- reproduce this issue; include code to reproduce, if relevant -->
There are no reproduce steps because this happened in end user devices (Product version). Actually, we discovered this crash from Firebase Crashlytics.

## Context
<!--- What were you trying to do? -->

## Debug logs
<!-- include iOS / Android logs
- ios XCode logs,
- use #getLog #emailLog methods (@see docs)
- Android: $ adb logcat -s TSLocationManager
-->
<details><summary>Logs</summary>

``` <!-- Syntax highlighting:  DO NOT REMOVE -->
Fatal Exception: android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5): , while compiling: SELECT * FROM logging_event_exception ORDER BY EVENT_ID ASC
       at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
       at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:890)
       at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:501)
       at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:616)
       at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
       at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
       at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
       at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1392)
       at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1239)
       at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1110)
       at com.transistorsoft.locationmanager.logger.TSLogReader.getLog(:68)
       at com.transistorsoft.locationmanager.logger.a.run(:32)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at java.lang.Thread.run(Thread.java:764)

mikehardy commented 2 years ago

Plugin version: 4.0.3 vs 4.4.6 https://github.com/transistorsoft/react-native-background-geolocation/blob/master/CHANGELOG.md

Without a reproduction or knowing it is happening on current code I'm not sure what can be done. If you were looking through issues for your software and a colleague came to you with this report, what would you do?

That said, the stack trace is pretty good, @christocracy may be able to deduce something from that without further context...

christocracy commented 2 years ago

One should not be calling .destroyLog(), .getLog() in production code.

The error comes from android-logger.

rs-quyenht commented 2 years ago

@mikehardy You're right, without a context or reproduction, it is truly hard to investigate, but that's what we got now. Thanks for your answer.

@christocracy Thanks for your reply, I will discuss to our customers whether logger code is able to be removed in production version. Could you explain why we can't use api log in production code ? Because we use log get from local database and upload to our log server, in case we need to investigate for future problems of end users. Thanks.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

github-actions[bot] commented 4 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.