Upload action won't stop

  

Within an app I have been working on we have an action that populates various entities from an excel that is uploaded in browser. 

The upload seemed to crash the back end data module. 

From doing some investigations we have realised that the action never terminated and at one point there was even 57 instances of it ongoing a once.

At the front of the action we set timeout to -1 so it doesn't time out.

However we do not know what may be causing it to run on indefinitely, could it be because it is reading all the blank rows from the excel file?


If anyone has any experience with this or any hunches please let me know.


Thanks!

 Hi James,

It will not read blank rows.

Can you please provide your oml file or image of your code ?


Thanks,

Ramakrushna Rao Seera 

Ramakrushna Rao Seera wrote:

 Hi James,

It will not read blank rows.

Can you please provide your oml file or image of your code ?


Thanks,

Ramakrushna Rao Seera 

So the logic is a bit complicated (must admit it wasn't made by me)

Basically it dumps the excel into an entity as binary data. 


Then from there it uses the 'launch load action' to launch a load paragraph action:

Within this it launches the bigger action 'load paragraphs':

In this process it basically: Determines whether to overwrite the existing data or not, then it exports the entity holding the new data and turns it into a record list using a records to list action. Then for each record in that list it creates/updates a lot of entities before finally clearing out the entity that it turned into a record in the first place.

I wonder could the error be because we turned the excel into binary data and then converted it back?


Thanks,

James


James Timmins wrote:

At the front of the action we set timeout to -1 so it doesn't time out.

However we do not know what may be causing it to run on indefinitely...

I would say that something that is running indefinitely is doing an infinite looping... :)
Why don't you debug your code to check what is going on?

Cheers

Hum... From your images I see you are using BPT...
Can you explain why are you using BPT to do such a simple task, instead of a Timer?
And it is bad practice to not set a timeout.

Best practice is to use a system to restart the timer near the timeout...

Eduardo Jauch wrote:

Hum... From your images I see you are using BPT...
Can you explain why are you using BPT to do such a simple task, instead of a Timer?
And it is bad practice to not set a timeout.

Best practice is to use a system to restart the timer near the timeout...

Hi,


What is BPT? Sorry I am not so swift with my acronyms,


I will try a restart timer.


Thanks,

James


Well...

https://www.outsystems.com/learn/courses/17/master-class-on-modeling-business-processes-bpt/?StartCourse=False

BPT is what you are using (in Processes tab)
If your code uses BPT and you don't know it, you need to learn, in order to you to be able to find what is happening (and know I understand the problem of the many "instances")

Cheers.

Eduardo Jauch wrote:

Well...

https://www.outsystems.com/learn/courses/17/master-class-on-modeling-business-processes-bpt/?StartCourse=False

BPT is what you are using (in Processes tab)
If your code uses BPT and you don't know it, you need to learn, in order to you to be able to find what is happening (and know I understand the problem of the many "instances")

Cheers.


Thank you for the learning link eduardo.

Having worked through the first couple I have decided to convert it into a normal screen action composed of server actions.

What do you understand about the cause of many 'instances'?

Will continue to work through the BPT course now but will appreciate any other input you may have.

Thanks!

Hi,

Every time you start a process (launch process), you create a new instance of it.
If your processes are not finishing, that is the reason why your instances are increasing.

And you can have many reasons to a process to not finish. If can be in a suspended or blocked state, for example. It will be there, hanging, until you decide what to do with it.
Or the logic can be giving an error that you are not properly handling and it will try again and again, with bigger intervals between tryings, until the error goes away, or you decide to kill the process.

Only a deep look into the logic to understand what is going on, as BT are not really linear. Each case is a different case.

For a simple "process an XLSX file and create a bunch of records", you could do something simpler, using a very well known pattern.

In the upload action

1. Stores the XLSX in database as binary.
2. Start the timer.

In the Timer action

1. Get the time to restart the timer. This will depend on each case, but you can do something like Current time + 80% of timeout (usually 20 min).
2. Convert the excel to list, check wich line you should start the process.
3. Process each line. At the end, always check if you reach the limit time.
3.1. If limit time reached, store the number of the next line to process, awake the timer again and end the action
3.2. If no more lines, do your cleanup and end the action

Basically something in these lines. :)

Cheers. 

Eduardo Jauch wrote:

Hi,

Every time you start a process (launch process), you create a new instance of it.
If your processes are not finishing, that is the reason why your instances are increasing.

And you can have many reasons to a process to not finish. If can be in a suspended or blocked state, for example. It will be there, hanging, until you decide what to do with it.
Or the logic can be giving an error that you are not properly handling and it will try again and again, with bigger intervals between tryings, until the error goes away, or you decide to kill the process.

Only a deep look into the logic to understand what is going on, as BT are not really linear. Each case is a different case.

For a simple "process an XLSX file and create a bunch of records", you could do something simpler, using a very well known pattern.

In the upload action

1. Stores the XLSX in database as binary.
2. Start the timer.

In the Timer action

1. Get the time to restart the timer. This will depend on each case, but you can do something like Current time + 80% of timeout (usually 20 min).
2. Convert the excel to list, check wich line you should start the process.
3. Process each line. At the end, always check if you reach the limit time.
3.1. If limit time reached, store the number of the next line to process, awake the timer again and end the action
3.2. If no more lines, do your cleanup and end the action

Basically something in these lines. :)

Cheers. 


Thank you Eduardo that was really helpful.


Just another point that you may be able to help with.

While error shooting and applying the above I have realised that part of the error with excel upload is because outsystems doesn't seem to like one particular line in my excel sheet. I have attached the line in question.


Any idea why the upload doesn't like that line in particular? The other 200 go through fine