react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

[Bug]: Crash in Production: android.database.sqlite.SQLiteException in TSLogReader.getLog

Open shubhlumber opened this issue 7 months ago • 4 comments

Required Reading

  • [x] Confirmed

Plugin Version

^4.16.5

Mobile operating-system(s)

  • [ ] iOS
  • [x] Android

Device Manufacturer(s) and Model(s)

Pixel 6a

Device operating-systems(s)

Android 15

React Native / Expo version

0.73.6,Expo 50

What happened?

Hi Transistor team,

We are using your library to track user location. While reviewing Android Vitals today, we noticed a crash occurring in production related to the library.

Type : android.database.sqlite.SQLiteException

Exception android.database.sqlite.SQLiteException:
  at android.database.sqlite.SQLiteConnection.nativePrepareStatement
  at android.database.sqlite.SQLiteConnection.acquirePreparedStatement (SQLiteConnection.java:1541)
  at android.database.sqlite.SQLiteConnection.prepare (SQLiteConnection.java:976)
  at android.database.sqlite.SQLiteSession.prepare (SQLiteSession.java:590)
  at android.database.sqlite.SQLiteProgram.<init> (SQLiteProgram.java:63)
  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:2280)
  at android.database.sqlite.SQLiteDatabase.queryWithFactory (SQLiteDatabase.java:2127)
  at android.database.sqlite.SQLiteDatabase.query (SQLiteDatabase.java:1998)
  at com.transistorsoft.locationmanager.logger.TSLogReader.getLog (Unknown Source:62)
  at com.transistorsoft.locationmanager.logger.a.run (Unknown Source:28)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
  at java.lang.Thread.run (Thread.java:1012)

Plugin Code and/or Config

const uploadPreviousDayLogs = async () => {
    const endOfYesterday = moment().startOf('day').subtract(1, 'seconds').toDate();
    const startOfYesterday = moment(endOfYesterday).startOf('day').toDate();
    const apiUrl = `${config.API_URL}/api/geolog/timestamps/${startOfYesterday.getTime()}/log/`;

    try {
      await BackgroundGeolocation.logger.uploadLog(apiUrl);
      await BackgroundGeolocation.logger.destroyLog();
    } catch (error) {
      await BackgroundGeolocation.logger.destroyLog();
      console.log('[uploadLog] Error:', error);
      return;
    }
  };

  useEffect(() => {
    if (Platform.OS === 'android') {
      uploadPreviousDayLogs();
    }
  }, [status]);

Relevant log output

Exception android.database.sqlite.SQLiteException:
  at android.database.sqlite.SQLiteConnection.nativePrepareStatement
  at android.database.sqlite.SQLiteConnection.acquirePreparedStatement (SQLiteConnection.java:1541)
  at android.database.sqlite.SQLiteConnection.prepare (SQLiteConnection.java:976)
  at android.database.sqlite.SQLiteSession.prepare (SQLiteSession.java:590)
  at android.database.sqlite.SQLiteProgram.<init> (SQLiteProgram.java:63)
  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:2280)
  at android.database.sqlite.SQLiteDatabase.queryWithFactory (SQLiteDatabase.java:2127)
  at android.database.sqlite.SQLiteDatabase.query (SQLiteDatabase.java:1998)
  at com.transistorsoft.locationmanager.logger.TSLogReader.getLog (Unknown Source:62)
  at com.transistorsoft.locationmanager.logger.a.run (Unknown Source:28)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
  at java.lang.Thread.run (Thread.java:1012)

shubhlumber avatar Apr 17 '25 09:04 shubhlumber

Any Idea?

shubhlumber avatar Apr 22 '25 08:04 shubhlumber

No idea. Let me know how to reproduce.

christocracy avatar Apr 25 '25 16:04 christocracy

No we are not able to reproduce this issue. Did someone else facing the issue?

shubhlumber avatar May 06 '25 12:05 shubhlumber

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 06 '25 02:06 github-actions[bot]

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

github-actions[bot] avatar Jun 20 '25 02:06 github-actions[bot]