-
Notifications
You must be signed in to change notification settings - Fork 297
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
Could not delete the database using deletedatabase method #418
Comments
When this happens, please pause the app in Xcode and get a backtrace ( |
Sorry wrongly closed this issue. Please find a backtrace. we are deleting the database in a detached thread (thread 15)
|
The formatting was pretty messed-up so I edited the above stack dump to clarify it. |
sorry about the formatting.Bit confused with the editor. <CBL_Shared: 0xa559bd0>: Still waiting to -forgetDatabaseNamed: "couchbaseDb"
After deleting the database,the copy's CBL_Shared object's "opendatabases"count is 0, whereas the main manager (sharedinstance) CBL_Shared object's "opendatabases" count is 1,
Printing description of managerCopy->_shared->_databases: Am i missing out anything? |
Re. the formatting — use a line of three back-quotes to begin or end a block of raw text (code or stack dumps or whatever.) |
Hi, Should i start working on this commit ?? If it needs to be merged to the master,when it would be completed ?? I have to fix the defect based on this issue in our application asap, as this issue is of high priority. Thanks. |
* Per code review, revert changes in CBL_Shared back to use usleep instead of using NSRunLoop to wait. * Update API_DeleteDatabase to ensure that the copied manager is closed and add test for the case that multiple managers working on different threads.
Fix #418 deleteDatabase: blocking thread
@rubha, the fix has been merged to the master. |
Thanks Pasin. There is a latest release of couchbase lite 1.0.2,but this fix is not available in that release.When would be the next release? How can i make use of this commit from the master now ? |
I don't think there's a schedule for 1.0.3 yet, but last I heard we are hoping to push a release every few weeks. You can get the fix now by checking out the master branch in Git and building it yourself. |
Thanks Snej. I built the framework and integrated it into my project and tested. I am able to delete the database successfully,if i delete the database of the manager's copy created in a detached thread. CBLDatabase *database=[[[CBLManager sharedInstance]copy]databaseNamed:kCBLDataBaseName error:&error]; But if i try to delete the database in main thread, I could not delete it.Still getting the same below warning,though i have closed all the copies of the manager's created, |
Can you show the actual code you use? And make sure you're not calling a CBLDatabase or CBLManager on the wrong thread. |
Using 2 managers operating and deleting a database on the same thread is not an ideal case and deleting the database will get blocked. From the code that you posted, please try to close the copied manager before deleting the same database getting from the shared manager on the same thread the following. CBLManager *copiedManager = [[[CBLManager sharedInstance]copy]; // But if i try to delete the database in main thread |
I am trying to delete the database in mainthread as, -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { -(void)deleteDatabase{ |
Pasin ,I am closing all the copies of manager's created, once its job is done and before deleting the database also. Its working fine. For the same above scenario, instead of deleting the database in main thread, if i detach a thread and try to delete it , its working -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { -(void)doDeleteDatabase{ |
@rubha, It's difficult to help without seeing the whole code. I created a gist containing my test code that works, and the code is deleting the database on the main thread. Could you please check the gist below and compare with your code to see differences? The key is that I closed the copied manager so that the database referenced by that manager is closed before deleting the database (See line 17 in the gist). |
In our application we need to delete the database on logout and create new database on login. We have put the activity indicator view till the delete action completes , which is keep on loading and the delete database action never comes to end ,not throwing an exception too. we have implemented it in the following way:
CBLDatabase *database=[[CBLManager sharedInstance]databaseNamed:kCBLDataBaseName error:&error];
BOOL status= [database deleteDatabase:&error];
if(!status){
NSLog(@"error while deleting the database =%@",error.localizedDescription)
}
The text was updated successfully, but these errors were encountered: