Java deadlock when saving an BackendlessEntity

Hello, Support Team

App ID:6BB8FB6D-7BEA-2244-FF30-A3C649DEB100

     Our app is on app store and suddenly we are getting this issue now while saving the object in table.

[backendless.persistenceService save:response response:^(tbl_response *result) {

                } error:^(Fault *fault) {
                    
                     [AppDelegate dismissGlobalHUD];
                     NSLog(@"%@",fault.detail);
                     [MBProgressHUD hideHUDForView:self.view animated:YES];
                }];

and in error block we are getting following error

FAULT = ‘Server.Processing’ [java.lang.RuntimeException: com.backendless.util.BackendlessTimeoutException: Could not acquire lock] <java.lang.RuntimeException: com.backendless.util.BackendlessTimeoutException: Could not acquire lock>

                    Plz resolve this issue as soon as possible because App is live

Hello!

Are you facing this problem at the moment?
regards,
Alex

When i try to save object in table im facing this issue before it was working fine. Now it fails with above error.

Yes, this issue is occuring very frequently.

Ok, we shall look into it.Do you mean “always”, or the problem is floating?

always

We’ve checked the app and it looks like simple saving objects to the table works fine.

Can you give us sample object you’re trying to save?

[backendless.persistenceService save:response response:^(tbl_response *result) {

                    [result.txtResponseUID setProperty:@"txtReward" object:[NSNumber numberWithInt:[[result.txtResponseUID getProperty:@"txtReward"] intValue] + 29]];
                    
                      [result.txtResponseUID setProperty:@"Total" object:[NSNumber numberWithInt:[[result.txtResponseUID getProperty:@"Total"] intValue] + 29]];
                    
                    [backendless.persistenceService update:result response:^(tbl_response *object)
                    {
                        [self DeleteNotificationn];
                      
                        [AppDelegate CalculateLevelAndRanking:^(BackendlessUser *result)
                        {
                            [MBProgressHUD hideHUDForView:self.view animated:YES];
                            FDAlertView *alert = [[FDAlertView alloc] init];
                            LevelUpView *contentView = [[NSBundle mainBundle] loadNibNamed:@"LevelUpView" owner:nil options:nil].lastObject;
                            NSInteger reward = [[result getProperty:@"txtReward"] integerValue];
                            
                            NSInteger level = [[result getProperty:@"userLevel"] integerValue];
    
                            [contentView getLatestReward:reward getlevel:level];
                            contentView.frame = CGRectMake(0, 0, self.view.frame.size.width-40, self.view.frame.size.height-30);
                            contentView.layer.cornerRadius = 5;
                            contentView.layer.borderWidth=1.0f;
                            contentView.layer.borderColor=[UIColor grayColor].CGColor;
                            alert.contentView = contentView;
                            [alert show];
                            [self.navigationController popViewControllerAnimated:YES];
                
                            [bckview removeFromSuperview];
                            
                            isTimeOver = YES;
                            self.txtComment.userInteractionEnabled = NO;
                            self.cmntBtnO.hidden = YES;
                            showLikes = YES;
                            [self.tableView reloadData];


                        }];
                        
                        [self SilentPushTorequester:request];
                        
                    } error:^(Fault *fault) {
                        
                        [AppDelegate dismissGlobalHUD];
                        NSLog(@"%@",fault.detail);
                        [MBProgressHUD hideHUDForView:self.view animated:YES];
                        
                    }];
                    
                } error:^(Fault *fault) {
                    
                     [AppDelegate dismissGlobalHUD];
                     NSLog(@"%@",fault.detail);
                     [MBProgressHUD hideHUDForView:self.view animated:YES];
                }];

In response object we have other object with relation “txtResponseUID” after saving the response we are updating txtResponseUID object but while saving the first object we are getting the error and it is occuring evrry time.

Please, clarify: the first response object is a new tbl_response instance (its objectId is not set) or it was previously saved.

Yes its new instance of tbl_response model…

Please, provide your tbl_response class and code which create this new instance and set its properties before a first saving. We need to reproduce your scenario.

i have attached tbl_requests and tbl_response class and the code which causing the error.
im able to get the user and request object from tbl_request. than im saving request and user object in tbl_response model and while saving the response object im getting the error

[backendless.userService findById:[[NSUserDefaults standardUserDefaults] valueForKey:UDUserid] response:^(BackendlessUser *user)

{

currentUser = user;

QueryOptions *query = [QueryOptions query];

query.relationsDepth = @2;

BackendlessDataQuery *Query = [BackendlessDataQuery query];

Query.whereClause = [NSString stringWithFormat:@“objectId = ‘%@’”,[self.dicPushReceived valueForKey:@“txtRequestId”]];

[backendless.persistenceService find:[tbl_requests class] dataQuery:Query response:^(BackendlessCollection *collection)

{

tbl_requests *request = [[collection valueForKey:@“data”] firstObject];

if ([request.notification_flag intValue ]== 1 )

{

NSArray *split = [self.txtComment.text componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];

split = [split filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@“length > 0”]];

NSString *res = [split componentsJoinedByString:@" "];

NSLog(@"%@",res);

tbl_response *response =[tbl_response new];

response.txtCity = [[NSUserDefaults standardUserDefaults] valueForKey:UDuserCurrentCity];

response.txtRequestId = request;

response.txtResponseUID = user;

response.txtRequestUID = userid;

if (place_id != nil)

{

response.place_id = place_id;

}

response.txtComments = res;

response.txtTag = strHashtag;

[ResponsesArr addObject:response];

[backendless.persistenceService save:response response:^(tbl_response *result) {

[result.txtResponseUID setProperty:@“txtReward” object:[NSNumber numberWithInt:[[result.txtResponseUID getProperty:@“txtReward”] intValue] + 29]];

[result.txtResponseUID setProperty:@“Total” object:[NSNumber numberWithInt:[[result.txtResponseUID getProperty:@“Total”] intValue] + 29]];

[backendless.persistenceService update:result response:^(tbl_response *object)

{

[self DeleteNotificationn];

[AppDelegate CalculateLevelAndRanking:^(BackendlessUser *result)

{

[MBProgressHUD hideHUDForView:self.view animated:YES];

FDAlertView *alert = [[FDAlertView alloc] init];

LevelUpView *contentView = [[NSBundle mainBundle] loadNibNamed:@“LevelUpView” owner:nil options:nil].lastObject;

NSInteger reward = [[result getProperty:@“txtReward”] integerValue];

NSInteger level = [[result getProperty:@“userLevel”] integerValue];

[contentView getLatestReward:reward getlevel:level];

contentView.frame = CGRectMake(0, 0, self.view.frame.size.width-40, self.view.frame.size.height-30);

contentView.layer.cornerRadius = 5;

contentView.layer.borderWidth=1.0f;

contentView.layer.borderColor=[UIColor grayColor].CGColor;

alert.contentView = contentView;

[alert show];

[self.navigationController popViewControllerAnimated:YES];

[bckview removeFromSuperview];

isTimeOver = YES;

self.txtComment.userInteractionEnabled = NO;

self.cmntBtnO.hidden = YES;

showLikes = YES;

[self.tableView reloadData];

}];

[self SilentPushTorequester:request];

} error:^(Fault *fault) {

[AppDelegate dismissGlobalHUD];

NSLog(@"%@",fault.detail);

[MBProgressHUD hideHUDForView:self.view animated:YES];

}];

} error:^(Fault *fault) {

[AppDelegate dismissGlobalHUD];

NSLog(@"%@",fault.detail);

[MBProgressHUD hideHUDForView:self.view animated:YES];

}];

}

else

{

[AppDelegate dismissGlobalHUD];

[AppDelegate showAlertwithTitle:@“Growlin” andMessage:@“Foodie has ended request. We will notify you of their decision”];

[MBProgressHUD hideHUDForView:self.view animated:YES];

}

} error:^(Fault *fault) {

[AppDelegate dismissGlobalHUD];

NSLog(@"%@",fault.detail);

[MBProgressHUD hideHUDForView:self.view animated:YES];

}];

} error:^(Fault *fault) {

[AppDelegate dismissGlobalHUD];

NSLog(@"%@",fault.detail);

[MBProgressHUD hideHUDForView:self.view animated:YES];

}];

tbl_response.rtf (1.2kB)

We reproduce this issue, now our server-side team is working with it. We let you know about a solution.

Can we please get a status update on this issue or we need to purchase another ticket in order expedite the resolution?

We have fixed issue on the server side, could you please check it again?