"Paused before potential out-of memory crash" error in importing XML File


#1

Hello Guys,

We are trying to import the Gantt from an XML file and that is giving us the error of “Paused before potential out of memory crash” in Google Developer tools and the script is stopped in the dhtmlxgantt.js file in Developer tools. After getting the data from the Imported file I am parsing the data like this and then assigning the types of the tasks and deleting the Summary Task (to Link).

    /**
 * * Gantt Parse event
 */
const onParse = gantt.attachEvent('onParse', () => {
  gantt.eachTask(task => {
    if (this.isloadingGanttFromMSP) {
      // checking for every task if it is Task, Project, MileStone or
      // Summary Task
      if (gantt.hasChild(task.id) && task.$level === 0) {
        // assigning the type to the task
        task.type = gantt.config.types.project;
        task.activity_code = gantt.getWBSCode(task);
        task.is_critical = gantt.isCriticalTask(task);
      } else if (task.duration === 0) {
        // assigning the type to the task
        task.type = gantt.config.types.milestone;
        task.activity_code = gantt.getWBSCode(task);
        task.is_critical = gantt.isCriticalTask(task);
      } else if (gantt.hasChild(task.id) && task.$level !== 0) {
        const links = gantt.getLinks();
        links.forEach(link => {
          if (link.target === task.id) {
            gantt.deleteLink(link.id);
          }
        });
        // assigning the type to the task
        task.type = gantt.config.types.project;
        task.activity_code = gantt.getWBSCode(task);
        task.is_critical = gantt.isCriticalTask(task);
      } else {
        // assigning the type to the task
        task.type = gantt.config.types.task;
        task.activity_code = gantt.getWBSCode(task);
        task.is_critical = gantt.isCriticalTask(task);
      }
    } else {
      this.refreshSummaryProgress(task.id);
    }
  });
  if (this.isloadingGanttFromMSP) {
    // creating task and calculating float
    this.updateTaskInfoAfterImport();
  }
});

I am not getting why this error is coming randomly. For small files, it’s not showing this error but for the file with 1200 tasks, this error is coming randomly.

Please help me. I am facing this issue for a long time. Thanking you.


#2

Hello Lalit,
Please, clarify if the issue is reproduced if you don’t modify the data in the onParse event handler.
Could you also send me a file with 1200 tasks so that I can try to reproduce the issue?


#3

Actually, in onParse event handler, I am assigning the types of the task and I don’t see any other place in my process of importing where I can assign the types of the tasks. So I can’t change that.

Btw this is the file with 1200 tasks. Please check. Thank you.
Sample MSP PLAN - XML Format smart sheet.xml (2.4 MB)


#4

Hello Lalit,
Thank you for sending the file. I couldn’t reproduce the issue, but at least I can suggest that you can try applying the performance tweaks as it takes time to load the data, and repainting many cells takes time:
https://docs.dhtmlx.com/gantt/desktop__performance.html
If you highlight the critical path right after parsing the data - it might be the reason why it takes so long to load tasks. But if you do that after parsing the data, it doesn’t heavily affect the performance and loading the data. In the following snippet, I tried to reproduce your case (and I simplified it a bit):
http://snippet.dhtmlx.com/8858d21fb
If adding the performance tweaks doesn’t help you, please reproduce the issue in the snippet, then click on the “Share” button and copy the link.