UjuiUjuMandan / EhViewer

EhViewer overhauled with censorship circumvention and no more
GNU General Public License v3.0
918 stars 21 forks source link

不同 namespace 的相同内容的 tag 导致下载艺术家数据库操作失败 #91

Closed dsaw14 closed 1 month ago

dsaw14 commented 1 month ago

复现步骤 / Step to reproduce

打开阅读器,不管进行什么操作包括等待一会就随机闪退 无论是处于什么页面,包括设置页面、画廊页面和其他界面

预期行为 / Expected behaviour

正常工作

实际行为 / Actual Behaviour

频繁闪退

应用日志 / App logs

log-2024-09-22-23-17-50-326.zip

备注 / Addition details

No response

浏览站点 / Browsing site

E-Hentai / ExHentai

EhViewer 版本号 / EhViewer version code

1.12.0-cc

EhViewer CI 版本 / EhViewer CI Version

2f7ae1a

Android 系统版本 / Android version

ZUI 16.0.336/Android 14

设备型号 / Device model

拯救者Y700 2023/TBF-320FC

SoC 型号 / Soc model

晓龙8+Gen 1

自查步骤 / Verify steps

dsaw14 commented 1 month ago

已经尝试过重新安装、回退版本等手段 只要一导入数据,重启应用就会出现同样的情况

UjuiUjuMandan commented 1 month ago

你导入的数据文件发一下。

UjuiUjuMandan commented 1 month ago

没发上来。

UjuiUjuMandan commented 1 month ago

没发上来,还显示 Uploading 就别动。

dsaw14 commented 1 month ago

2024-09-22-02-05-14-486.zip

UjuiUjuMandan commented 1 month ago

日志里错误只有一个。

android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: DOWNLOAD_ARTISTS.GID, DOWNLOAD_ARTISTS.ARTIST (code 1555 SQLITE_CONSTRAINT_PRIMARYKEY)
    at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)
    at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:730)
    at android.database.sqlite.SQLiteSession.execute(SQLiteSession.java:621)
    at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:47)
    at androidx.sqlite.db.framework.FrameworkSQLiteStatement.execute(FrameworkSQLiteStatement.android.kt:30)
    at androidx.room.driver.SupportSQLiteStatement$SupportOtherAndroidSQLiteStatement.step(SupportSQLiteStatement.android.kt:337)
    at androidx.room.EntityInsertAdapter.insert(EntityInsertAdapter.java:92)
    at com.hippo.ehviewer.dao.DownloadArtistDao_Impl.insert$lambda$0(DownloadArtistDao_Impl.kt:39)
    at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1$1.invokeSuspend(DBUtil.kt:62)
    at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1$1.invoke(DBUtil.kt)
    at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1$1.invoke(DBUtil.kt)
    at androidx.room.driver.SupportSQLitePooledConnection.transaction(SupportSQLiteConnectionPool.android.kt:84)
    at androidx.room.driver.SupportSQLitePooledConnection.withTransaction(SupportSQLiteConnectionPool.android.kt:67)
    at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1.invokeSuspend(DBUtil.kt:60)
    at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1.invoke(DBUtil.kt)
    at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$lambda$1$$inlined$internalPerform$1.invoke(DBUtil.kt)
    at androidx.room.driver.SupportSQLiteConnectionPool.useConnection(SupportSQLiteConnectionPool.android.kt:43)
    at androidx.room.RoomConnectionManager.useConnection(RoomConnectionManager.android.kt:126)
    at androidx.room.RoomDatabase.useConnection$room_runtime_release(RoomDatabase.android.kt:600)
    at androidx.room.util.DBUtil__DBUtil_androidKt$performSuspending$$inlined$compatCoroutineExecute$DBUtil__DBUtil_androidKt$1.invokeSuspend(DBUtil.android.kt:109)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
    at androidx.room.TransactionExecutor.execute$lambda$1$lambda$0(TransactionExecutor.java:38)
    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)
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [uy1{Cancelling}@20fd53d, Dispatchers.IO]

我以为是数据库损坏导致的。但是我清空应用数据后导入你的 .db 文件,又强制停止后、重新打开了应用。等了一段时间也没有遇到闪退,进入阅读界面也没有闪退。

UjuiUjuMandan commented 1 month ago

@FooIbar 我怀疑应用会从本地下载目录的文件夹名、或者 .ehviewer 文件读取 GID 并 INSERT 进去,从而有可能导致 UNIQUE constraint failed 。

com.hippo.ehviewer.dao 我没动任何东西。最近更改是 5 月前。

FooIbar commented 1 month ago

这是一个画廊有两个相同的作者标签,可以在 putDownloadArtist 那里捕获下看看 GID

UjuiUjuMandan commented 1 month ago

@dsaw14 你下载安装这个版本、打开等它闪退一次,然后导出日志再发一下。 https://github.com/UjuiUjuMandan/EhViewer/actions/runs/10990320355

dsaw14 commented 1 month ago

已经覆盖安装,db还是一样的 log-2024-09-23-20-15-14-852.zip

UjuiUjuMandan commented 1 month ago

日志里没看到任何我加的东西。

putDownloadArtist 只在 addDownload 时用,但是这里是“等待一会就随机闪退”。

@FooIbar 哪一个数据库操作会在什么都不做的时候就执行?

UjuiUjuMandan commented 1 month ago

@dsaw14 能否录屏看一下闪退过程?什么都不做、或者做了什么就闪退。

dsaw14 commented 1 month ago

什么都不做也会出现这种情况

https://github.com/user-attachments/assets/a8616f9e-a193-42b9-9a9e-f7d13fd07823

什么都不做随机放置和执行任意操作都会像这样闪退

FooIbar commented 1 month ago

日志里没看到任何我加的东西。

putDownloadArtist 只在 addDownload 时用,但是这里是“等待一会就随机闪退”。

@FooIbar 哪一个数据库操作会在什么都不做的时候就执行?

你全局搜索一下也知道不是只在 addDownload 时用 某些系统看不到日志可以写到单独的文件里,参考 https://github.com/FooIbar/EhViewer/commit/be47d8abde62a61d4b35b71217e3a8daeb7ba224

UjuiUjuMandan commented 1 month ago

某些系统看不到日志

什么原因啊?有其他进程的 DEBUG 级别日志但是没有 EhViewer 的。

UjuiUjuMandan commented 1 month ago

@dsaw14 https://github.com/UjuiUjuMandan/EhViewer/actions/runs/10996033953 你安装这个版本再闪退发日志吧。

dsaw14 commented 1 month ago

log-2024-09-23-22-49-32-414.zip 执行了两个下载文件的cbz归档操作

dsaw14 commented 1 month ago

新版本不进行任何操作放置一段时间后依然闪退,闪退时间有所延迟,从20-30秒延迟到了1分钟以上 log-2024-09-23-22-56-10-190.zip

UjuiUjuMandan commented 1 month ago

@FooIbar

2024-09-23T14:48:34.604469Z Inserting GID: 1228909, Artist count: 2
2024-09-23T14:48:34.617836Z Detected, GID: 1228909, Artist count: 2, Distinct artist count: 1
2024-09-23T14:48:34.624571Z Inserting artist: saku with GID: 1228909
2024-09-23T14:48:34.632893Z Inserting artist: saku with GID: 1228909
2024-09-23T14:48:34.643543Z SQLite constraint failed: UNIQUE constraint failed: DOWNLOAD_ARTISTS.GID, DOWNLOAD_ARTISTS.ARTIST (code 1555 SQLITE_CONSTRAINT_PRIMARYKEY)
2024-09-23T14:49:01.835145Z Inserting GID: 2199499, Artist count: 1
2024-09-23T14:49:01.855806Z Inserting artist: kurokoshi you with GID: 2199499
2024-09-23T14:49:04.074542Z Inserting GID: 2197974, Artist count: 1
2024-09-23T14:49:04.101117Z Inserting artist: kumada with GID: 2197974
2024-09-23T14:49:22.075106Z Inserting GID: 1228909, Artist count: 2
2024-09-23T14:49:22.081217Z Detected, GID: 1228909, Artist count: 2, Distinct artist count: 1
2024-09-23T14:49:22.089750Z Inserting artist: saku with GID: 1228909
2024-09-23T14:49:22.096192Z Inserting artist: saku with GID: 1228909
2024-09-23T14:49:22.104583Z SQLite constraint failed: UNIQUE constraint failed: DOWNLOAD_ARTISTS.GID, DOWNLOAD_ARTISTS.ARTIST (code 1555 SQLITE_CONSTRAINT_PRIMARYKEY)

https://e-hentai.org/g/1228909/6df98664a7/

这个画廊同时有 artist:sakucosplayer:saku

FooIbar commented 1 month ago

artist:saku 是错的,不过反正都 expunged 了也没人关心 tag 对不对了

UjuiUjuMandan commented 1 month ago

namespace 不同但是都划到一个数据库的元数据还有吗?插入数据库之前需要检查一下。

UjuiUjuMandan commented 1 month ago

https://github.com/UjuiUjuMandan/EhViewer/actions/runs/10998963142