UiPath Out of Memory


#1

I have been developing in UiPath for a few days now and i have had pleasant experiences and not so pleasant experiences.

One of the later is the frequent and frustrating “Out of memory” errors doing debug and straight up crashes doing debug.

I have attached error messages galore and a picture of the program doing it’s thing.

Is there any way to make the the program use a bit less memory while debugging or is there a 64-bit version?

//Fekke

Also here are some error messages!

[details=Click me for error messages:]> -------------------------

Workflow Designer

OutOfMemoryException:
Exception of type ‘System.OutOfMemoryException’ was thrown.

at System.Windows.DependencyObject.UpdateSourceDependentLists(DependencyObject d, DependencyProperty dp, DependencySource[] sources, Expression expr, Boolean add)
at System.Windows.DependencyObject.ChangeExpressionSources(Expression expr, DependencyObject d, DependencyProperty dp, DependencySource[] newSources)
at System.Windows.Expression.ChangeSources(DependencyObject d, DependencyProperty dp, DependencySource[] newSources)
at System.Windows.Data.BindingExpressionBase.ChangeSources(DependencyObject target, DependencyProperty dp, WeakDependencySource[] newSources)
at System.Windows.Data.BindingExpressionBase.ChangeSources(WeakDependencySource[] newSources)
at System.Windows.Data.BindingExpression.ChangeWorkerSources(WeakDependencySource[] newWorkerSources, Int32 n)
at MS.Internal.Data.ClrBindingWorker.ReplaceDependencySources()
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.AttachDataItem()
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
at System.Windows.Data.BindingExpression.AttachOverride(DependencyObject target, DependencyProperty dp)
at System.Windows.Data.BindingExpressionBase.OnAttach(DependencyObject d, DependencyProperty dp)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
at System.Activities.Presentation.View.ExpressionTextBoxViewModel.SetBinding(String path, DependencyProperty property, FrameworkElement target, ExpressionTextBox source, BindingMode mode, IEnumerable`1 validationRules)
at System.Activities.Presentation.View.ExpressionTextBoxViewModel.InitializeEditor(ExpressionActivityEditor editor, ExpressionTextBox expressionTextBox)
at System.Activities.Presentation.View.ExpressionTextBox.OnExpressionTextBoxLoaded(Object sender, RoutedEventArgs e)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at MS.Internal.LoadedOrUnloadedOperation.DoWork()
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)


Workflow Designer

OutOfMemoryException:
Exception of type ‘System.OutOfMemoryException’ was thrown.

at System.Windows.Dependent…ctor(DependencyObject o, DependencyProperty p, Expression e)
at System.Windows.DependentList.Add(DependencyObject d, DependencyProperty dp, Expression expr)
at System.Windows.DependencyObject.UpdateSourceDependentLists(DependencyObject d, DependencyProperty dp, DependencySource[] sources, Expression expr, Boolean add)
at System.Windows.DependencyObject.ChangeExpressionSources(Expression expr, DependencyObject d, DependencyProperty dp, DependencySource[] newSources)
at System.Windows.Expression.ChangeSources(DependencyObject d, DependencyProperty dp, DependencySource[] newSources)
at System.Windows.Data.BindingExpressionBase.ChangeSources(DependencyObject target, DependencyProperty dp, WeakDependencySource[] newSources)
at System.Windows.Data.BindingExpressionBase.ChangeSources(WeakDependencySource[] newSources)
at System.Windows.Data.MultiBindingExpression.ChangeSourcesForChild(BindingExpressionBase bindingExpression, WeakDependencySource[] newSources)
at System.Windows.Data.BindingExpressionBase.ChangeSources(WeakDependencySource[] newSources)
at System.Windows.Data.BindingExpression.ChangeWorkerSources(WeakDependencySource[] newWorkerSources, Int32 n)
at MS.Internal.Data.ClrBindingWorker.ReplaceDependencySources()
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.AttachDataItem()
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
at System.Windows.Data.BindingExpression.AttachOverride(DependencyObject target, DependencyProperty dp)
at System.Windows.Data.BindingExpressionBase.Attach(DependencyObject target, DependencyProperty dp)
at System.Windows.Data.MultiBindingExpression.AttachBindingExpression(Int32 i, Boolean replaceExisting)
at System.Windows.Data.MultiBindingExpression.AttachOverride(DependencyObject d, DependencyProperty dp)
at System.Windows.Data.BindingExpressionBase.OnAttach(DependencyObject d, DependencyProperty dp)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.Data.BindingOperations.SetBinding(DependencyObject target, DependencyProperty dp, BindingBase binding)
at System.Activities.Core.Presentation.StateContainerEditor.CreateConnectionPoint(UIElement element, Double widthFraction, Double heightFraction, EdgeLocation location, ConnectionPointKind type)
at System.Activities.Core.Presentation.StateContainerEditor.PopulateConnectionPoints(UIElement view)
at System.Activities.Core.Presentation.StateContainerEditor.ProcessAndGetModelView(ModelItem model)
at System.Activities.Core.Presentation.StateContainerEditor.AddStateVisuals(IList`1 modelItemCollection)
at System.Activities.Core.Presentation.StateContainerEditor.Populate()
at System.Activities.Core.Presentation.StateContainerEditor.<.ctor>b__141_0(Object s, RoutedEventArgs e)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at MS.Internal.LoadedOrUnloadedOperation.DoWork()
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)


Workflow Designer

OutOfMemoryException:
Exception of type ‘System.OutOfMemoryException’ was thrown.

at MS.Internal.WeakEventTable.Purge(Boolean purgeAll)
at MS.Internal.WeakEventTable.CleanupOperation(Object arg)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)


Workflow Designer

OutOfMemoryException:
Exception of type ‘System.OutOfMemoryException’ was thrown.

at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)


Workflow Designer

OutOfMemoryException:
Exception of type ‘System.OutOfMemoryException’ was thrown.

at MS.Utility.FrugalStructList1.set_Capacity(Int32 value) at MS.Utility.FrugalStructList1…ctor(ICollection1 collection) at System.Windows.Media.DoubleCollection..ctor(IEnumerable1 collection)
at System.Windows.Media.GuidelineSet…ctor(Double[] guidelinesX, Double[] guidelinesY)
at ActiproSoftware.Windows.Controls.DropShadowChrome.OnRender(DrawingContext drawingContext)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)


Workflow Designer

OutOfMemoryException:
Exception of type ‘System.OutOfMemoryException’ was thrown.

at System.Threading.ExecutionContext.Capture(StackCrawlMark& stackMark, CaptureOptions options)
at System.Threading.ExecutionContext.Capture()
at MS.Internal.CulturePreservingExecutionContext…ctor()
at MS.Internal.CulturePreservingExecutionContext.Capture()
at System.Windows.Threading.Dispatcher.LegacyBeginInvokeImpl(DispatcherPriority priority, Delegate method, Object args, Int32 numArgs)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

[/details]


Uipath is continously throwing System.OutOfMemory exception, Even when the xaml size is less
#2

Same here, I’m getting the exact same error only when debugging (launching the process by pressing “play” is not giving me any errors).

Did you manage to fix this problem? please let me know.


#3

Hello,

thank you for sharing…

What is the process you are trying to automate, is there any way you can split it?

using invoke activities is a good practice. here is the article about it.

regards.


#4

I am automating a long chain of interactions with several web pages where I use activity invocation a plenty. The complaint isn’t specific but a complaint in general that the Debug function is useless when a project reaches a certain scale.


#5

We have a 23MB workflow file, made by a non-developer person more than a year ago. In such a big file, there is no way to debug it. If you are lucky enough to avoid the Out Of Memory error while navigating throughout the flow, sometimes the Studio crashes when trying to save the project. (Using 8GB RAM computers here).

The solution we are using here, is to divide the automation itself, making more than one robot and having them interact with each-other. This way, it is possible that the workflow don´t get too big.
(And thinking about it now, this approach goes toward the Single Responsibility principle right?) :grin:

Nonetheless, it would be nicer if UiPath Studio could handle such large projects.


#6

The best practice here is to split the big workflow into smaller chunks and use “Invoke Workflow” activity.

Adrian.


#7

hey @Fekke

As others suggested you should always divide your workflow and size should be not more then 4mb(i prefers) and by using invoke workflow activities you can integrate them. this will be good to understand and manage as well larger process in a easy way and even will work with a great way.

Thanks & Regards…


#8

Even when doing that with nearly every single thinkable piece of functionality. Yet it still breaks Debug completely and in some cases results in UiPath being completley unable to solve a task.

For an instance in my corrent project:

I am copying around 1300 lines from a notepad document and running a Regex match on it. Just copying the text to a String variable breaks debug even though 300.000 chars isn’t even close to the datatype limit on a 32 bit string at 2^(31) chars.

Furthermore if one attempts to execute a foreach item in the IEnumerable that the Match activity outputs using the Regex, then UiPath fails the execution completely even when “just” executing. Tossing an error due to:
{
“message”: “Execution: NotifyJobCompleted error System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.\r\n\r\nServer stack trace: \r\n at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrNotOpen()\r\n at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\r\n at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\r\n at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\r\n\r\nException rethrown at [0]: \r\n at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\r\n at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\r\n at UiPath.Models.IExecutorContract.JobCompleted(String serializedInvokeCompleted)\r\n at UiPath.Executor.RobotRunner.NotifyJobCompleted(Exception exception, IDictionary`2 outputs, ActivityInstanceState state)”,
“timeStamp”: “10:35:58”,
“level”: “Warning”,
“fileName”: “Veris_Comp_Read_PBS_Error_Code”,
“totalExecutionTime”: “00:00:09”,
“totalExecutionTimeInSeconds”: 9
}


#9

I am well aware of the practical limits but the debug seems to not even bother trying if an activity “seems” too difficult. (see comment above)


#10

@Fekke can you please share your XAML ? please… it will be greatly helpful.

regards.


#11

Just a sidenote - amount of RAM on the machine is not that relevant anymore. As long as it’s a 32bit process, 2GB is the limit of memory it can use due to address space, hence Fekke’s question about 64bit version is on point.

InvokeWorkflow by itself doesn’t help much if you’re going through them all anyway (it’s good to split long workflows, just that isn’t a definite answer to this issue). Testing in isolation on the other hand does help - if each workflow file (or at least a set of them) can be tested separately.

@Fekke This is definitely a breaking issue.
By quick check looks like an overloaded debug preview and/or logger communication (when using debug, it logs InArgument and OutArgument values, as well as for String displays the value inside Studio).
I’ve checked with two files that I had on hand (~45k lines and 1,1k lines) and it just errors out with zero info whatsoever.

Message: Job Test7 stopped due to unexpected process termination! Exception Type: Exception System.Exception: Job Test7 stopped due to unexpected process termination!

Changing String to String[] and putting the output of read to element 0 (to make debug not try to display value in Studio, since it doesn’t display array content) still crashes, so I think that logger communication is more likely the cause (also see the workaround as confirmation).

There is a quick and very dirty workaround for the debug issue - make it not log the arguments, by adding one of the excludedData keywords to the name of the activity.
These can be found and changed in project.json in project root location. So f.e. instead of “Read file” name it “Private: Read file”. That way arguments will not be logged and it should not crash.

For the ForEach error unfortunately I don’t have a good guess for at least a workaround, as running with ~15k matches (foreach with a writeline(match.index.tostring)) didn’t throw, so couldn’t reproduce (admittedly the Regex in my test was very simple, but I’m not sure if that’s even a factor).

Edit: Ok, it didn’t throw, but hanged the Studio due to probably console overload, requiring a kill. Still annoying, but unrelated.

Regards,
Andrzej


#12

The Regex i’m running is:

“.*?(32\d{12})(\d{9}).+?\s+(\d{6})”

In a document with about 1300 lines with 256 chars on every line.

The Regex matches on average on 99.9% of the lines and returns 3 values for a valid match.

The foreach seems to die when adding the three values from n row to a datatable, but it still throws the wired error instead.


#13

Your are right @andrzej.kniola
We’re using 64-bit OS, but the UiPath application is installed as a 32-bit application.
We didn´t realized that until now.

Does UiPath Studio have a 64bit version? (I couldn’t find this answer searching the website)


#14

Unfortunately it does not. But in all fairness it really shouldn’t waste as much memory as it does. You could try to manually do a large memory address aware hack, but I think it would be smarter to optimize your code and wait for the developers to fix theirs. :slight_smile:


#15

Does UiPath Studio have a 64bit version? (I couldn’t find this answer searching the website)

It had a 64bit version but that got us into some bigger problems. Since most applications automated by UiPath are 32bit the interprocess communication would slow the execution a lot. Therefore we decided to stay on 32.

I understand that sometimes debug can be annoying and we’ll try to improve.
This issue needs to be investigated. We’ll need some repro steps here.

The workarounds I’m using:

  • split workflows in individual pieces
  • invoke them separately for testing purposes (default arguments)
  • use Log Message - level Trace

64-bit CE?
#16

Veris_Comp_Read_PBS_Error_Code.xaml (75.4 KB)

Here is the current component. Since it’s task is rather tiny it is something we invoke in a larger workflow, even though the workflow attached yields the issues descriped on it’s own.


#17

My two cents -
Breaking the entire flow into multiple logical small workflows with the Isolate flag is the key. Assuming that the machine you are using meets the hardware and software requirements and no antivirus is interfering with the Robot

  1. Review the logs to check if the workflow is always crashing at a specific place in the workflow. This will help you get to the cause
  2. Pass only the relevant data between workflows as arguments, like if you need only few values from a data table only pass them as opposed to the entire data table
  3. Review if the affected sub-workflow has optimum usage of variables and there is no case of infinite looping
  4. Review if any other application which the bot is interacting with is increasing the memory usage thereby affecting the bot. You can view the windows event logs for it.

Regards,
V


#19

Can you elaborate a bit on the functionality of the Isolate flag on the workflow invokation activity?
I would much like to have a clue what it actually does since Google had no answers…


#20

Isolated flag will make the underlying workflow be launched as a completely separate process (you can check with procexp and you’ll see a separate UiRobot.exe with /executor in cmdline).

This has some advantages:

  1. Separate memory address space.
  2. Better ability to recover from crashes (f.e. this was the recommended calling way for MODI OCR since it’s not 100% stable).

But there are also drawbacks:

  1. All arguments will need to be serialized (using JSON serialization). Non-serializable arguments will throw on this and some types (f.e. DataTable) can sometimes produce weird results.
  2. It’s a little bit slower due to serialization and process startup times.
  3. Some large objects as arguments (f.e. datatables >300kB) had some issues due to pipe write limit (don’t remember the details exactly, just keep in mind that large arguments may be an issue when they previously weren’t).

In practice it’s similar to suspending current robot, spinning up a new one, doing work with it, and pushing the results back to the main one.

Regards,
Andrzej


Out of memory exception while trying to access windows clipboard (Opening .xaml file)
#21

Hi Thiago,

If the workflows are old and not split in multiple files, this may happen due to all the images that are stored in the file itself. This has been fixed by storing the images separately, in a .screenshot folder. I would recommend you either to remove all informative screenshots from the file, and then re-add them if you’d like.