ibireme / YYCache

High performance cache framework for iOS.
MIT License
2.37k stars 505 forks source link

-[YYKVStorage _dbExecute:] line:182 sqlite exec error (5): database is locked #152

Open jksniper opened 4 years ago

jksniper commented 4 years ago

如题,在对本地缓存异步读取的时候很频繁的发生这样的错误,然后缓存被删,gg。 -[YYKVStorage _dbExecute:] line:182 sqlite exec error (5): database is locked 2019-12-17 11:38:58.225945+0800 xxxxx[389:27234] [logging] BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: /private/var/mobile/Containers/Data/Application/6A2C58F1-C93F-4B4E-A16A-014532078A6C/Library/Caches/CacheOfChapters/manifest.sqlite-shm

youngerbyte commented 3 years ago

多线程同时操作同一张表引起,尝试自己加一个全局锁试一下 https://www.jianshu.com/p/6422ae4e06c2