Backendless Support
 
Waiting for user's response

Custom business logic execution has been terminated because it did not complete in permitted time

I get this error but it works, at random, when executing some event handlers in the business logic level. The even handler is a simple before update trigger.

- I get the object that is being updated.

- do some very basic single if conditions, conditional checks to handle things differently as required.

- send an email via Backendless.

That event handling takes place when I update something on the browser (using Backendless JS) and/or on the mobile app (Backendless Android sdk, latest), both in async. What happens is that the intended results in the conditional checks take place, basically it seems the event handler is doing its job. BUT I get this error anyway. When I get this error, it acts as an exception and I get in to the catch block of the client where I deal with UI stuff differently.

So basically I carry out the Fail callback in the client UI, because I get that error and it slips in to the catch block, while the update process works successfully.

Leave a Comment

Comments (5)

photo
1

Does it work in debug mode ?In what language the business logic is written ?

If the answer for both questions is yes then please read the following troubleshooting topic:

ServerCode works well in the DEBUG mode, but does not when deployed to the Cloud

photo
1

the issue happens in both debug and published mode. The business logic is written in Java.

photo
photo
1

Hey Salman

Please specify your app id and handler you are invoking, so I could investigate the issue

Regards Anton

photo
1

Hey Anton,

Here is my appID, 4FE40318-2AD9-FE62-FF5B-8A666D229600

I'm just invoking a before update handler on a certain table. I have table called Order that has a column called Status. I usually update the status on the client end. The before update handler for this table checks for the status and deals with things accordingly, namely sending a specific html email.

It's that simple. But yeah, this "5s timeout termination" happens randomly. When it happens, the client end takes it as an exception and it slips in to the catch block of the async call even when the handler does its intended job successfully.

photo
1

How long does it take to send an email ?

Did you perform some timing analysis ?

It looks like a normal behavior.

Your business logic takes some time which depends on a network status.

Sometimes 5 second is enough, sometimes not.

It throws a timeout exception if it doesn't fit into permitted time.

You say it throws this error "even when the handler does its intended job successfully".

That means you see that email has being successfully sent to the recipient.

But it is also possible that the timeout happened on a waiting a response from the SMTP server phase.

In this case you will see exactly what you see now - An email was successfully sent but the timeout exception occurred.

I would recommend you to purchase the expanded script/code execution pack (20secs)

photo