Robot Apps out of memory

Hello,

Back to you lovely people with another issue that i’m facing in my development.

The context:

Currently developing an unattended bot which after some hours of running throws me out of memory exception for the apps that i am working with. ( outlook, access and excel)
The robot is running on a i7 4 th gen CPU, 8 gb RAM physical machine with windows 10 OS.
The robot is developed based on the Re framework state machine model.

The overview process flow:
- check access DB if any files need to be sent by e-mail
- check access DB if there are any values to be sent by email
- check if there are any new e-mails with specific subject
- if current day time is between 12 and 6 open app and browser and delete registered user → if expire date is correct
- for each new mail open browser and download excel file
- read values from excel file
- open browser and check values are correct then add item to Orchestrator queue
- take item from queue open app, find location, add data
- open browser and register new user, close ticket and send e-mail with info
-DO THIS ALL OVER AGAIN

This is a bot that should be running 24/7 or at least 8 hours a day, during work time.

The problem:
After a specific run time ( 2-5 hours) the bot or some app ( i can’t figure it out) is taking to much memory. When the bot is trying to interact with outlook, access or excel i’m getting the out of memory exception( the exception is generated by the apps not the robot).
Sometimes the bot remains idle and does nothing.
Any idea on how to approach this or what could be causing this issue?

1 Like

@Victor_Carmocanu

This might suitable for your project.

  • Divide the Performer and Dispatcher workflow into separate robot.
  • Performer check the DB and upload any data to Orchestrator Queue
  • Orchestrator Schedule Hourly/Minutes to run the Performer and Dispatcher workflow
  • It will produce smaller robots and release used memory every time a robot finished.
1 Like

That’s a great suggestion @hermawan. And i totally agree with you.
Unfortunately the business does not allow me to do that thus, i’m stuck with this.
Perhaps there might be a way to clear the robot execution memory while running.
I took a look at the garbage collector functions of dispatch and refresh. But they are leaving the process unstable or won’t clear memory until stop.

Set the global variable to Nothing or “” (for string variable type) after a main loop.
There might be something in the log file indicate which activity cause the problem. (Open Log Files - UiPath Studio).
Implementing Try Catch and Exception Logging on critical flow might help.

1 Like

I will suggest one thing …
Make sure you check once the flow of argument that you are passing .
For example - argName , you need to pass as “in” but you are passing it as “in/out” and same thing in case of “out” . Unnecessary passing argument also lead to memory consumption.
Hope it will help.

2 Likes

That is already implemented.
Global variables are set to nothing when finished using.
Try catch with exception logging is set on all workflows.
Always checking the logs when this is happening.
There are no errors generated by the robot. On the other hand there are exceptions generated by the applications interacting.
I will update this thread with the errors on Monday when i have access to the production environment.

2 Likes

That’s great to have in mind. Appreciate the best practice reference
Although this is not the case All the args have specific usage and passing behavior…

Okk… I am tagging experts here for your issue
@ClaytonM , @loginerror & @aksh1yadav can you please help in resolving this issue.

highly appreciated ! :smiley:

Few suggestions

  1. Use option to read the downloaded excel without actually opening the file.
    2.disable cache /history on browser.
  2. Outlook itself might cause memory issue. Try implementing the same mail functionality using mail acitivited and not opening outlook explicitely

If you are already doing above, then we have to look into it in detail.

@ArunVelaayudhanG

  1. Could you please detail more to what you are referring to?
    For the moment i am using the excel application scope and multiple read cell activities to extract the required data
    1.2 It’s already done
    2.Could you please detail more to what you are referring to?
    For the moment i am using the get outlook mail activity to retrieve unread e-mails from specific sender and subject then processing the Mail item list through a for each loop.

Are suggesting to have a different implementation then the current? If so, please help me with some examples due to the fact that I am not aware of any other?

What version of Studio and the Excel activity package are you using? “Out of memory” could be fixed in newer versions. If you are on Studio v18 or newer and Excel 2.5 (I think), then it should be fine.

You can also get a better understanding of the error by looking in Event Viewer of the machine it is run on. From my observation, you can get this error from an Excel file with too much data to read (you might look at the ExcelXL activity package if this is the case), or you are using a Write Line or Read Text file+String concatenation of too much text.

To identify the moment at which the error occurs, I would suggest placing Log Message activities in various places so you can figure out the point right before it occurs.

8GB of RAM is kind of low for UiPath, but if you are only running 1-2 robot(s) then it’s probably fine. You can monitor the memory used from Task Manager though if this is on a server machine that allows multiple login sessions at the same time.

Hope this gives you some ideas.
Regards.

2 Likes

Hi @ClaytonM,

using studio 2018 2.3 enterprise edition ( licenced )
excel package 2.3.6682.26635
mail activities 1.1.6562.21018
I have tried the log messages but there is not much info there.
Great point on the memory. I was also considering that RAM memory could not be enough. This could be a quick fix.
But before that let me know if there are any issues with the activity packages or studio that i am currentlly using?

Regards
Victor

You should be able to place Log messages right before where you think the error happens. By looking at which Log messages have been completed, you can identify the moment right before the error occurs (edit: make sure you put something different in each Log message so you can differentiate between each one). I recommended this, because if you can locate the precise moment and activity when the error occurs, then you might be able to figure out if it’s a problem with some file or activity.

Since this issue might need more direct support, you can also escalate this with their tech support here: Contact Technical Support

Regards.

Hi,

Please make your object nothing once the object done their job, when will you are going to use the same object as second time with different operation/same, that object should be nothing and again initialize with ‘new’ operator which can be Outlook,Excel or Access object.

Second, if you are using other then the static variable please kill those variable once your operation get done.

This should work.

I understand this may be easier said than done, but referring to a dispatcher/performer pattern; not sure how/why you’d say: the business will not allow it.

The “business” has asked for an automated process solution. The implementation details of said solution is a system architecture topic, not a business requirement.

In addition to the other best practices mentioned below (clearing out used variables, proper cleanup on error handling, etc.) I suggest working towards the dispatcher/performer pattern which helps to create a separation of duties and encapsulate transactions resulting in auto recovery and cleanup.

Also, using the RE Framework, what is your retry count set to? Could it be that you’re looping on an occasional error condition causing the OOM?

Hi @Victor_Carmocanu ,

No. I Believe, you are already following what i suggested.

Yet, have you found if the bot is causing the issue or is it some other reason?

There might be other reasons as well.

yep. agree with you with the architecture topic. unfortunate there is a licence cost in the middle of this.
Just to be clear the business is not willing to invest in a second licence in order to provide a proper separation of duties. I am aware this is a system arch topic. Lucky for us there is no sys arch in the team.
There is no retry count set. Since i can’t separate the dispatcher and performer in 2 separate bots I have modified the Re Framework state flow such as if there are no transaction items in the orch queue ( No transaction item) the process will go back to the dispatcher and start over.
I just made a solid check on all the variables and everything is fine. This is not about variable memory allocation. Also I have double if not triple check all the best practices. Everything is on track.

@ArunVelaayudhanG Thx for clearing that out.
No, I have not.
@ClaytonM regarding your input. I managed to speak with the IT department and requested an update of 8 gb RAM on the machine.
Now the machine is running 16 GB RAM.

Sadly the problem is still ongoing. Only update is that it might be possible due to the RAM upgrade to have extended the period of time needed for the robot to run out of memory. Thursday I will perform a stress test and see if there are any improvements.

Tracing back to all the input on this topic does anyone have any other suggestions?
My thoughts:
Perhaps the running user session on which the bot is running does not have enough admin rights in order to do proper memory cleaning?
I will upload a schema of the actual modified Re Framework implementation. Maybe I am missing out on something related to the framework and this might be the reason?

This might not be related to your problem, but recently I discovered that a certain web application was crashing Internet Explorer after so much time. I noticed that the memory kept increasing, then would crash IE when it got to 1.5gb used (and there was plenty of available memory). The thing which was happening in this case was that the website was loading a page of data, then when you clicked on the next page, that data that previously loaded stayed in memory while loading the next page on top of that. So, it would just keep going up until IE crashed - and this occurred manually as well. In other words, the application would be at fault in this instance.

I thought I would add this point, even if it doesn’t relate or help identify your issue.

Regards.