Skip to main content
devarnenis2638
May 15, 2024
Question

Memory Circuit Breaker

  • May 15, 2024
  • 11 replies
  • 0 views

We had an interface, while loading the interface in the flow sometimes we are getting Memory Circuit breaker error and we could not able to move forward as we cannot click anything on interface. We already optimized the code to maximum extent. Is there any way that we can show that error in separate section which will not block the interface, so that we can move forward by clicking on submit button

    11 replies

    stefanhelzle0001
    Brainy
    May 15, 2024

    No. You will have to modify that interface so that it takes less memory.

    devarnenis2638
    May 15, 2024

    Don't we have any option like try catch for that error? So that we can display an user friendly banner

    stefanhelzle0001
    Brainy
    May 15, 2024

    Sorry, but no.

    karthikk538
    May 15, 2024

    Hi Shiva Prasad,

    What is causing the memory circuit breaker error? Can you help with  the root cause, based on the we can think of solutions.

     Is it because of too many queries or number of lines of code, or execute SP's in interface? 

    devarnenis2638
    May 15, 2024
    1. We had 2 local variables with datasubset, both the local variable contains same amount of data but the values are different, for the 1st grid we are using 1st local variable as data source and displaying the data in grid but here we are additional using tag field with white color for each value, in the 2nd grid we are using 2nd local variable as source and accordingly displaying the data using tag field, but for adding color to tag field we are comparing each cell of second grid with corresponding cell of 1st grid and using white color if the data is same else using red color.
    2. We are highlighting the values that got changed. Here the data we are receiving is dynamic, so when the number of colomns are less it's working fine, if the colomns size increases we are getting Memory Circuit breaker. Here our requirement is like in such scenarios we should be able to capture the error and display a banner like we cannot compare. 
    devarnenis2638
    May 16, 2024

     [mention:a11f77a729fb4db2af76b09948583328:e9ed411860ed4f2ba0265705b8793d05] [mention:35656ad056ed4a5a9a8091da482e69e9:e9ed411860ed4f2ba0265705b8793d05] 

    To add details to above description, to that local variables we are gettiong data from below expression rule

    To the above rule we are passing the documentID  from which we need to extract data, check the below sample document

    In this document the 1st row always indicates column headers seperated with comma(A,B,C,D,E) and the rest of rows(rows starting from 2nd line) are actual rows need to be displayed in grid. In this file we have 5 columns with 7 rows but some times we might recieve huge files like 2000columns with 1000rows or more.

    When the file has less data it is working fine but during huge data the expression rule is failing at line 8, where we are converting data to list of dictionary using foreach loop and resulting in memory circuit breaker. In such scenerios instead of giving memory circuit breaker error, we should show some user friendly error and allow the user to move forward in the interface.

     [mention:a11f77a729fb4db2af76b09948583328:e9ed411860ed4f2ba0265705b8793d05] Cas we achieve this or as per your previous response we cant achieve this?

     [mention:a11f77a729fb4db2af76b09948583328:e9ed411860ed4f2ba0265705b8793d05] [mention:35656ad056ed4a5a9a8091da482e69e9:e9ed411860ed4f2ba0265705b8793d05] and any one looking at the this discussion please add your comments

    karthikk538
    May 17, 2024

    Hi Shiva,

    I would suggest to go by approach suggested by [mention:8e5a7a058e4f4768ba94c8d9526dd3e4:e9ed411860ed4f2ba0265705b8793d05] , avoid manipulating the data in the UI, this is not a scalable design and its very costly operation.

    1. Dump the data as is in the staging table 1

    2. Manipulate the data according to your need and move the final data into staging table 2

    3. Display the data from staging table 2, with paging info configured, each instance make sure you capture process id, which acts as session id for each manipulation.

    After all the manipulation is done and everything is displayed to the user, truncate the data using the process id in staging table 1 and staging table 2 using the process id.