-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
crash on [FMStatement reset] (FMDatabase.m:1470) #521
Comments
i think i should not close every handle,maybe the first handle doesn't complete,the second handle close the dababase |
Are these two singletons referencing different databases or the same database? |
Don't FMDatabaseQueue will open the database, so you don't need to do that either. Also, doing updates in the middle of a result set might cause problems. Though, if it's async as well, maybe not. |
You should not call |
referencing same database,but two tables @robertmryan |
you mean if i updates two different tables' data, it may cause problems too? |
No, I mean you're doing updates in the middle of a result set. Pull out data from the db, while updating it at the same time. |
ok,i know~thank u very much,and i remove |
No, you never should call |
ok,thanks for your suggestion!:-D |
i see the other issues about crash in this is my insert list code - (void)insertList:(NSArray<FIMCacheMessage *> *)modelList
inDatabase:(FMDatabaseQueue *)databaseQueue {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[databaseQueue inTransaction:^(FMDatabase *database, BOOL *rollback) {
for (FIMCacheMessage *model in modelList) {
NSString *sqlString =
[NSString stringWithFormat:@"INSERT INTO %@ ("
@"msg_id, msg_create_time, msg_operate_time, "
@"msg_is_self, msg_status_code, kdt_id, "
@"req_id, user_id, msg_type, "
@"msg_content, conversation_id, msg_resource_path, "
@"automate, isEvent"
@") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
MESSAGE_TABLE_NAME];
BOOL isSucceed = [database
executeUpdate:sqlString, @(model.messageID), @(model.createTime),
@(model.opearteTime), @(model.isSelf), @(model.statusCode),
model.kdtID ?: [NSNull null], model.requestID ?: [NSNull null],
model.userID ?: [NSNull null], model.messageType ?: [NSNull null],
model.content ?: [NSNull null], model.conversationID ?: [NSNull null],
model.resourcePath ?: [NSNull null], @(model.automate), @(model.isEvent)];
NSLog(@"MessageCRUD insertList %@ %@ errorMsg: %@", modelList,
isSucceed ? @"成功" : @"失败", [database lastErrorMessage]);
if (!isSucceed) {
*rollback = YES;
return;
}
}
}];
});
} the this is the crash log
and sometimes may crash in
|
Can you show all the thread back traces? |
this crash log is crash in
|
this crash log is crash in
|
Nothing pops out at me, but I find it weird that both crashes happen when the main thread is doing glyph layout of some sort. Do more of your crashes have the main thread doing that, or was this a coincidence? |
sometimes i insert message to database, it will crash on FMStatement reset
this is crash log
this is insert code
this is insert message code
this is insert user info code
what cause it?
The text was updated successfully, but these errors were encountered: