558
Views
11
Comments
Solved
Server action behavior with platform timeout
Question
Application Type
Reactive
Service Studio Version
11.54.10 (Build 62419)
Platform Version
11.18.1 (Build 38276)

Hi, all.

I need some help about timeout behavior.

A server action in my app sometimes runs for about 1.5 hours straight, which is kinda strange for my understandings of how timeout works.
(There is no dought in execution time. It usually completes within ~30secs or so, but if user puts in gigantic amount of data, it takes 1 hour to complete)

The problem is, if a task's execution takes too long, I thought that process should be killed by platform (20min by default platform settings) with an error like "A thread is being aborted", and I saw it happens on one of my other app before.

However, this time it didn't happen and kept running for hours(until it completes its process).
What could be the reason of timeout not working?


Thanks in advance.

2020-11-10 23-58-16
Raphael Ranieri
 
MVP
Solution

Hi @Shinichiro Endo,

The timeout on the server side will depend on what you have configured on your IIS in this case.
The platform by default doesn't have 20 minutes for the server calls.

It is actually 110 seconds.
Unless you explicitly defined a different timeout for this request or if you have an OnPremise installation where someone might have changed the IIS settings to have a bigger value, you shouldn't have it running for so long.

On this link you can see how it could be changed:



Could be the case that you have an OnPremise installation and someone changed the values for the executionTimeout under the machine.config IIS file?

______________________________________________________________________________________

On a side note,



The 20 minutes you saw on the Timer documentation is only a suggested value, but it can run for more time as well, depending on what you set on the service center under the timer configurations:

The reason why they suggest this 20 minutes value and to use internal timeout to wake up the timer before reaching 20 minutes, is to make sure the timer will not time out and rollback all your DB transactions making you lose all the progress.

From the link I sent before you can also see this information:

It also explains the behavior you are seeing with the client actions: 

Cheers,

RR :) 

UserImage.jpg
Shinichiro Endo
Solution

Thanks so much for very clear and comprehensive explanation. This helps me a lot!

My platform is On-premise, so I will ask person in charge for current settings.

By the way, it could be slightly off topic but let me ask one more question.

What is the scope of this "Application Request"?
I assume a new request will be made when I call Server Action from Client Action.
But what if when I call another Server Action inside a Server Action? Will there be another request(=another timeout / thread) made? or does it run on the same request?

(I thought I've read some article that says something like "When calling Server Action, OutSystems is making requests inside platform". I can't remember where so it could be just lapse of memory...)

2020-11-10 23-58-16
Raphael Ranieri
 
MVP
Solution


No worries @Shinichiro Endo

I'm happy to help, 

Once you call a server action from a client action all the other server actions called inside the first server action will be on the same request. They will always have the same scope and transaction. 

 The only exception is if you call a REST / SOAP API or a Service action. Then it will have a different transaction and its own timeout. 


Also, keep in mind that it only applies for server actions called inside another server action. 


If you call multiple server actions inside the same client action, for instance, each one will have a different scope. 

Let ne know if you have any other questions, 

Regards, 

RR :) 

UserImage.jpg
Shinichiro Endo

@Raphael Ranieri
Thanks a lot!

Now everything is clear for me. I appreciate your help so much.

@nani pappala
Thanks for your help too, it helped me making my question clearer.


Best Regards

UserImage.jpg
Shinichiro Endo

*just a quick remark*

I haven't confirmed yet but I found something that might be useful.

In the case which ran 1.5 hours straight, it was calling a Server Action from another module, and request ID (checked on Service Center log) was different between the one calling it and the one being called.

The execution was not going over another module when it stopped in 20 min.

I don't know this is related, but at least this is the biggest difference between those 2 cases I found so far.

2020-11-10 23-58-16
Raphael Ranieri
 
MVP
Solution


No worries @Shinichiro Endo

I'm happy to help, 

Once you call a server action from a client action all the other server actions called inside the first server action will be on the same request. They will always have the same scope and transaction. 

 The only exception is if you call a REST / SOAP API or a Service action. Then it will have a different transaction and its own timeout. 


Also, keep in mind that it only applies for server actions called inside another server action. 


If you call multiple server actions inside the same client action, for instance, each one will have a different scope. 

Let ne know if you have any other questions, 

Regards, 

RR :) 

UserImage.jpg
Shinichiro Endo
Solution

Thanks so much for very clear and comprehensive explanation. This helps me a lot!

My platform is On-premise, so I will ask person in charge for current settings.

By the way, it could be slightly off topic but let me ask one more question.

What is the scope of this "Application Request"?
I assume a new request will be made when I call Server Action from Client Action.
But what if when I call another Server Action inside a Server Action? Will there be another request(=another timeout / thread) made? or does it run on the same request?

(I thought I've read some article that says something like "When calling Server Action, OutSystems is making requests inside platform". I can't remember where so it could be just lapse of memory...)

UserImage.jpg
Shinichiro Endo

I've found something I should share with you while reviewing my code.

Last time I saw process was killed by platform timeout(20min), the code was like this:


(This action is called by other server actions, which is called by data action on screen)

The action repeatedly calls Advanced SQL in forEach, and execution stayed in the same server action for entire 20 min.
(and then aborted with an error "A thread was being aborted".)

This time, the code is like this:

(This action is called by other server actions, which is called by data action on screen)

The action repeatedly calls another server action (which executes SQL in it), so execution goes in and out for each loops.

Hope this helps.


2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Hey @Shinichiro Endo ,

Can you share how your are calling the server action?

If you are calling a server action from from a client action or data action for example, the timeout it would have is what is defined (in seconds) in your module properties like this one: 


It wouldn't matter if a server action call another server action in this case, because the timeout would be for the total duration.

However, if you call the server action from a timer, REST API or a BTP process activity, the timeout you have defined can be different 
So it really depends from where you are triggering it.

Let me know if it helps,
Cheers,
RR :) 

UserImage.jpg
Shinichiro Endo


Hi @Raphael Ranieri. Thank you for your reply.

Those actions are called by Data action, and it has Server Request Timeout overriding module's default timeout.

However, as I have tested, client side timeout won't stop server action's execution as it is just giving up waiting for response.(This forum thread has this topic in detail: Link)

What I thought is even if user defined (client side) timeout won't stop execution, platform will stop it. But this time it didn't stop.

Therefore I wonder how these (server side) timeout works.

UserImage.jpg
Nani

Can you tell how you are calling server action using with (Client action, Timer, Api, Javascript or processes) so i may know where is the issue. I think you are call server action by using timer because you told (20min by default platform settings) in question.
Don't think that execution time is same every time run even if the data is same because depends loops inside logic, number of files, server traffic,etc.., and check any changes are made in logic recently.

UserImage.jpg
Shinichiro Endo

It is called by Data Action which is on Screen as I mentioned earlier.

And as far as I understand, the platform will stop process which is taking too long (and threshold is defined by platform setting, which default is 20min) no matter if it's Timer or not, which is why setting Timer's timeout more than 20min is not recommended (https://success.outsystems.com/documentation/best_practices/performance_and_monitoring/performance_best_practices_logic/).
However, it does not seem to stop way past 20min.

I thought I saw a Server Action (called by screen) was aborted in 20min, but it didn't happen this time. Therefore I want to know how these aborting behaves.

Cheers.

2020-11-10 23-58-16
Raphael Ranieri
 
MVP
Solution

Hi @Shinichiro Endo,

The timeout on the server side will depend on what you have configured on your IIS in this case.
The platform by default doesn't have 20 minutes for the server calls.

It is actually 110 seconds.
Unless you explicitly defined a different timeout for this request or if you have an OnPremise installation where someone might have changed the IIS settings to have a bigger value, you shouldn't have it running for so long.

On this link you can see how it could be changed:



Could be the case that you have an OnPremise installation and someone changed the values for the executionTimeout under the machine.config IIS file?

______________________________________________________________________________________

On a side note,



The 20 minutes you saw on the Timer documentation is only a suggested value, but it can run for more time as well, depending on what you set on the service center under the timer configurations:

The reason why they suggest this 20 minutes value and to use internal timeout to wake up the timer before reaching 20 minutes, is to make sure the timer will not time out and rollback all your DB transactions making you lose all the progress.

From the link I sent before you can also see this information:

It also explains the behavior you are seeing with the client actions: 

Cheers,

RR :) 

UserImage.jpg
Shinichiro Endo
Solution

Thanks so much for very clear and comprehensive explanation. This helps me a lot!

My platform is On-premise, so I will ask person in charge for current settings.

By the way, it could be slightly off topic but let me ask one more question.

What is the scope of this "Application Request"?
I assume a new request will be made when I call Server Action from Client Action.
But what if when I call another Server Action inside a Server Action? Will there be another request(=another timeout / thread) made? or does it run on the same request?

(I thought I've read some article that says something like "When calling Server Action, OutSystems is making requests inside platform". I can't remember where so it could be just lapse of memory...)

2020-11-10 23-58-16
Raphael Ranieri
 
MVP
Solution


No worries @Shinichiro Endo

I'm happy to help, 

Once you call a server action from a client action all the other server actions called inside the first server action will be on the same request. They will always have the same scope and transaction. 

 The only exception is if you call a REST / SOAP API or a Service action. Then it will have a different transaction and its own timeout. 


Also, keep in mind that it only applies for server actions called inside another server action. 


If you call multiple server actions inside the same client action, for instance, each one will have a different scope. 

Let ne know if you have any other questions, 

Regards, 

RR :) 

UserImage.jpg
Shinichiro Endo

@Raphael Ranieri
Thanks a lot!

Now everything is clear for me. I appreciate your help so much.

@nani pappala
Thanks for your help too, it helped me making my question clearer.


Best Regards

UserImage.jpg
Shinichiro Endo

*just a quick remark*

I haven't confirmed yet but I found something that might be useful.

In the case which ran 1.5 hours straight, it was calling a Server Action from another module, and request ID (checked on Service Center log) was different between the one calling it and the one being called.

The execution was not going over another module when it stopped in 20 min.

I don't know this is related, but at least this is the biggest difference between those 2 cases I found so far.

2020-11-10 23-58-16
Raphael Ranieri
 
MVP

Btw, 

I'm not sure if you can use the Factory Configuration component to change this specific IIS value for timeouts on PaaS installations, but if you have it installed might also be worth to have a look and see if there aren't any custom configurations defined there.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.