Android SQLiteDiskIOException磁盘I / O错误(代码522)

时间:2018-02-22 07:39:05

标签: java android sqlite

昨天来自Crashlytics我在打开数据库时注意到disk I/O error (code 522)。问题是已经有16个用户已经报告了这次崩溃36次。可悲的是,我无法重现此错误。这是发生错误的代码片段

SessionDbManager(Context context, String tripDbFileName) {
        this.context = context;
        this.tripDbFileName = tripDbFileName;
        this.tripDbHelper = new SessionDbHelper(this.context, tripDbFileName);
        SQLiteDatabase database = null;
        int attempt = 1;
        while (database == null) {
            try {
                database = this.tripDbHelper.getWritableDatabase(); // here's the error
            } catch (android.database.sqlite.SQLiteException e) {
                Crashlytics.logException(e);
                XLog.e("Failed to load history data from database ", e);
                if (attempt == 5) throw e;
            }
            attempt++;
        }
        db = database;
    }

这是堆栈跟踪

Fatal Exception: android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 522): , while compiling: PRAGMA journal_mode
       at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
       at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:932)
       at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:677)
       at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:363)
       at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:337)
       at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:251)
       at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:195)
       at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
       at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
       at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
       at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:808)
       at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:793)
       at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:696)
       at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:737)
       at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:289)
       at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223)
       at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
       at eu.fishingapp.data.sql.session.SessionDbManager.(SourceFile:51)
       at eu.fishingapp.data.sql.session.SessionContentProvider.update(SourceFile:753)
       at android.content.ContentProvider$Transport.update(ContentProvider.java:384)
       at android.content.ContentResolver.update(ContentResolver.java:1412)
       at eu.fishingapp.data.sql.session.SessionDbHelper.renameSessionDb(SourceFile:584)
       at eu.fishingapp.data.network.synchronization.FileSyncServiceImpl.uploadFile(SourceFile:462)
       at eu.fishingapp.data.network.synchronization.FileSyncServiceImpl.uploadSessions(SourceFile:221)
       at eu.fishingapp.data.network.synchronization.FileSyncServiceImpl.uploadSessionsFiles(SourceFile:243)
       at eu.fishingapp.data.network.synchronization.FileSyncIntentService.onHandleIntent(SourceFile:116)
       at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:67)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.os.HandlerThread.run(HandlerThread.java:61)

我已经阅读了有关I / O错误的信息并找到了两个可能的答案我认为这是因为用户的设备上的可用空间不足。但是这里有来自两个应用用户的一些图片 enter image description here

enter image description here

所以这绝对不是存储问题:(任何想法如何解决这个问题?

编辑:targetSdk版本22

0 个答案:

没有答案