4

我在创建新的 sqlite 数据库时遇到了问题,它大部分都可以工作,但是我们的一些三星 Galaxy S III 客户在安装我们的应用程序后报告崩溃。我们发现问题出在 sqlite 调用write()方法时,并且仅在客户拥有使用 exFAT 格式化的外部 SD 卡(三星在他们的某些手机上支持)时才会发生。奇怪的是,创建文件夹有效,创建空数据库文件也有效,然后崩溃。它只发生在三星 ROM 的库存中,在带有 exfat 的自定义 ROM 上它工作得很好。如何解决这个问题呢?谢谢

[21:10:36.225] W [22233][Sqlite]: (0) OPENX   59  /storage/extSdCard/Be-on-road/packages 0400102
[21:10:36.225] W [22233][Sqlite]: (0) OPEN    59  /storage/extSdCard/Be-on-road/packages
[21:10:36.225] W [22233][Sqlite]: (0) READ    59      0       0 0
[21:10:36.225] I [22233][Sqlite]: Database successfully opened /storage/extSdCard/Be-on-road/packages.
[21:10:36.238] W [22233][Sqlite]: (0) LOCK    59 SHARED was NONE(NONE,0) pid=22233 (unix)
[21:10:36.238] W [22233][Sqlite]: (0) LOCK    59 SHARED ok (unix)
[21:10:36.238] W [22233][Sqlite]: (0) UNLOCK  59 0 was 1(1,1) pid=22233 (unix)
[21:10:36.239] W [22233][Sqlite]: (0) LOCK    59 SHARED was NONE(NONE,0) pid=22233 (unix)
[21:10:36.239] W [22233][Sqlite]: (0) LOCK    59 SHARED ok (unix)
[21:10:36.239] W [22233][Sqlite]: (0) UNLOCK  59 0 was 1(1,1) pid=22233 (unix)
[21:10:36.239] W [22233][Sqlite]: (0) LOCK    59 SHARED was NONE(NONE,0) pid=22233 (unix)
[21:10:36.239] W [22233][Sqlite]: (0) LOCK    59 SHARED ok (unix)
[21:10:36.239] W [22233][Sqlite]: (0) LOCK    59 RESERVED was SHARED(SHARED,1) pid=22233 (unix)
[21:10:36.239] W [22233][Sqlite]: (0) LOCK    59 RESERVED ok (unix)
[21:10:36.239] W [22233][Sqlite]: (0) OPENX   60  /storage/extSdCard/Be-on-road/packages-journal 0400102
[21:10:36.239] W [22233][Sqlite]: (0) OPENDIR 61  /storage/extSdCard/Be-on-road
[21:10:36.239] W [22233][Sqlite]: (0) OPEN    60  /storage/extSdCard/Be-on-road/packages-journal
[21:10:36.240] W [22233][Sqlite]: (0) WRITE   60    512       0 0
[21:10:36.242] W [22233][Sqlite]: (0) LOCK    59 EXCLUSIVE was RESERVED(RESERVED,1) pid=22233 (unix)
[21:10:36.242] W [22233][Sqlite]: (0) LOCK    59 EXCLUSIVE ok (unix)
[21:10:36.242] W [22233][Sqlite]: (0) READ    60      0     512 0
[21:10:36.242] W [22233][Sqlite]: (0) SYNC    60 
[21:10:36.246] W [22233][Sqlite]: (0) DIRSYNC 61  (have_fullfsync=0 fullsync=0)
[21:10:36.246] W [22233][Sqlite]: (0) WRITE   60     12       0 0
[21:10:36.246] W [22233][Sqlite]: (0) SYNC    60 
[21:10:36.249] W [22233][Sqlite]: (0) WRITE   59   1024       0 0
[21:10:36.249] W [22233][Sqlite]: (0) WRITE   59   1024    1024 0
[21:10:36.249] W [22233][Sqlite]: (0) WRITE   59   1024    2048 0
............ lots of write
[21:10:36.250] W [22233][Sqlite]: (0) WRITE   59   1024   10240 0
[21:10:36.250] W [22233][Sqlite]: (0) SYNC    59 
[21:10:36.263] W [22233][Sqlite]: (0) CLOSE   -1 
[21:10:36.264] W [22233][Sqlite]: (0) UNLOCK  59 1 was 4(4,1) pid=22233 (unix)
[21:10:36.264] W [22233][Sqlite]: (0) UNLOCK  59 0 was 1(1,1) pid=22233 (unix)
[21:10:36.264] W [22233][Sqlite]: (0) LOCK    59 SHARED was NONE(NONE,0) pid=22233 (unix)
[21:10:36.264] W [22233][Sqlite]: (0) LOCK    59 SHARED ok (unix)
[21:10:36.264] W [22233][Sqlite]: (0) READ    59     16      24 0
[21:10:36.264] W [22233][Sqlite]: (0) LOCK    59 RESERVED was SHARED(SHARED,1) pid=22233 (unix)
[21:10:36.264] W [22233][Sqlite]: (0) LOCK    59 RESERVED ok (unix)
[21:10:36.265] W [22233][Sqlite]: (0) OPENX   60  /storage/extSdCard/Be-on-road/packages-journal 0400102
[21:10:36.265] W [22233][Sqlite]: (0) OPENDIR 61  /storage/extSdCard/Be-on-road
[21:10:36.265] W [22233][Sqlite]: (0) OPEN    60  /storage/extSdCard/Be-on-road/packages-journal
[21:10:36.266] W [22233][Sqlite]: (0) WRITE   60    512       0 0
[21:10:36.266] W [22233][Sqlite]: (0) WRITE   60      4     512 0
[21:10:36.266] W [22233][Sqlite]: (0) WRITE   60   1024     516 0
............ lots of write
[21:10:36.269] W [22233][Sqlite]: (0) WRITE   60   1024    3612 0
[21:10:36.269] W [22233][Sqlite]: (0) WRITE   60      4    4636 0
[21:10:36.272] W [22233][Sqlite]: (0) OPENX   62  /storage/extSdCard/Be-on-road/etilqs_nX2uuug04YJMBLG 0500302
[21:10:36.273] W [22233][Sqlite]: (0) OPEN    62  
[21:10:36.273] W [22233][Sqlite]: (778) os_unix.c:27158: (5) write() - 
[21:10:36.273] W [22233][Sqlite]: (0) WRITE   62     -1       0 0
[21:10:36.273] W [22233][Sqlite]: (778) statement aborts at 22: [UPDATE app_info SET db_version=:NEW_VERSION] 
[21:10:36.273] W [22233][Sqlite]: (0) READ    60      4    4624 0
[21:10:36.275] W [22233][Sqlite]: (0) READ    60      4    1540 0
............ lots of read
[21:10:36.276] W [22233][Sqlite]: (0) READ    60      4    4636 0
[21:10:36.276] W [22233][Sqlite]: (0) READ    60      4    4624 0
[21:10:36.276] W [22233][Sqlite]: (0) CLOSE   -1 
[21:10:36.276] W [22233][Sqlite]: (0) CLOSE   -1 
[21:10:36.277] W [22233][Sqlite]: (0) UNLOCK  59 1 was 2(2,1) pid=22233 (unix)
[21:10:36.278] W [22233][Sqlite]: (0) UNLOCK  59 0 was 1(1,1) pid=22233 (unix)
[21:10:36.281] E [22233][Sqlite]: Step failed: disk I/O error, code: 778. Expecting SQLITE_DONE.
[21:10:36.281] E [22233][PackageDb]: Sqlite error: disk I/O error on query UPDATE app_info SET db_version=:NEW_VERSION
[21:10:36.282] E [22233][UpdaterService]: Failed to initialize package database on service start.
4

1 回答 1

1

我们终于在 SGS III 上解决了这个问题,这是一个很好的解决方法——我们将临时文件默认存储在内存中,而不是 sd 卡(SQLITE_TEMP_STORE=2 编译参数),它似乎可以工作。

于 2012-12-14T12:34:44.093 回答