Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YYKVStorage _dbOpen may case crash when db can't open #43

Closed
zzzworm opened this issue Apr 6, 2016 · 4 comments
Closed

YYKVStorage _dbOpen may case crash when db can't open #43

zzzworm opened this issue Apr 6, 2016 · 4 comments

Comments

@zzzworm
Copy link

zzzworm commented Apr 6, 2016

你好,感谢你分享的YYCache项目,我们在项目中有使用,在使用过程中我们发现一个问题:
_dbOpen函数在某些情况下由于打开sqlite数据库失败,但是内部状态维护有点问题,具体是场景是:图片缓存被多次清理,在某次清理时打开sqlite数据库返回SQLITE_CANTOPEN,_dbOpen函数返回了NO,但是内部状态,db,_invalidated等状态都标示为打开成功状态,在下次使用图片缓存时由于_dbStmtCache被置为NULL,导致crash。
这里存在的问题还和sqlite的API有关系,int result = sqlite3_open(_dbPath.UTF8String, &_db);在返回失败是,db被赋值了

@ibireme
Copy link
Owner

ibireme commented Apr 6, 2016

感谢提供信息。
能问一下使用的 YYCache 版本是多少吗?

@zzzworm
Copy link
Author

zzzworm commented Apr 6, 2016

我使用YYCache版本是1.0

@ibireme
Copy link
Owner

ibireme commented Apr 6, 2016

好的,我会在多处理一下异常情况,增加容错处理和调试 log。

@ibireme
Copy link
Owner

ibireme commented Apr 6, 2016

Fixed,增加了一些重试和的错误检查的逻辑。

@zzzworm zzzworm closed this as completed Apr 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants