Book a Demo

Author Topic: Parallel script execution - second run stops first  (Read 4045 times)

Tony D

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Parallel script execution - second run stops first
« on: November 21, 2016, 07:58:29 pm »
We have experienced issues where a script has not finished executing and is run a second time, the second instance overwrites execution of the first.  Sscripter.exe then hangs and the first instance never completes.

The following sample illustrates the fact.  You need to initiate execution of the second whilst the first is still progressing.

Does anyone have any ideas how to prevent this?

Code: [Select]
!INC Local Scripts.EAConstants-JScript

function ReportInfo( message )
{
Session.Output( "[INFO] " + message );
}


function expMultiInstance()
{
// Get the type of element selected in the Project Browser
var treeSelectedType = Repository.GetTreeSelectedItemType();

try
{
switch ( treeSelectedType )
{
case otElement :
{
for (var i=0; i <= 40; i++)
{
var theElement as EA.Element;
theElement = Repository.GetTreeSelectedObject();
ReportInfo("expMultiInstance: " + i);
}
break;
}

default:
{
// Error message
Session.Prompt( "This script does not support items of this type.", promptOK );
}
}
}
catch (err)
{
ReportInfo("expMultiInstance: **Caught exception Name: " + err.Name + ", Message: " + err.Message);
// throw(err);
}
}

expMultiInstance();

Here is the output (note execution interruption after #22):
Code: [Select]
[INFO] expMultiInstance: 0
[INFO] expMultiInstance: 1
[INFO] expMultiInstance: 2
[INFO] expMultiInstance: 3
[INFO] expMultiInstance: 4
[INFO] expMultiInstance: 5
[INFO] expMultiInstance: 6
[INFO] expMultiInstance: 7
[INFO] expMultiInstance: 8
[INFO] expMultiInstance: 9
[INFO] expMultiInstance: 10
[INFO] expMultiInstance: 11
[INFO] expMultiInstance: 12
[INFO] expMultiInstance: 13
[INFO] expMultiInstance: 14
[INFO] expMultiInstance: 15
[INFO] expMultiInstance: 16
[INFO] expMultiInstance: 17
[INFO] expMultiInstance: 18
[INFO] expMultiInstance: 19
[INFO] expMultiInstance: 20
[INFO] expMultiInstance: 21
[INFO] expMultiInstance: 22
[INFO] expMultiInstance: 0
[INFO] expMultiInstance: 1
[INFO] expMultiInstance: 2
[INFO] expMultiInstance: 3
[INFO] expMultiInstance: 4
[INFO] expMultiInstance: 5
[INFO] expMultiInstance: 6
[INFO] expMultiInstance: 7
[INFO] expMultiInstance: 8
[INFO] expMultiInstance: 9
[INFO] expMultiInstance: 10
[INFO] expMultiInstance: 11
[INFO] expMultiInstance: 12
[INFO] expMultiInstance: 13
[INFO] expMultiInstance: 14
[INFO] expMultiInstance: 15
[INFO] expMultiInstance: 16
[INFO] expMultiInstance: 17
[INFO] expMultiInstance: 18
[INFO] expMultiInstance: 19
[INFO] expMultiInstance: 20
[INFO] expMultiInstance: 21
[INFO] expMultiInstance: 22
[INFO] expMultiInstance: 23
[INFO] expMultiInstance: 24
[INFO] expMultiInstance: 25
[INFO] expMultiInstance: 26
[INFO] expMultiInstance: 27
[INFO] expMultiInstance: 28
[INFO] expMultiInstance: 29
[INFO] expMultiInstance: 30
[INFO] expMultiInstance: 31
[INFO] expMultiInstance: 32
[INFO] expMultiInstance: 33
[INFO] expMultiInstance: 34
[INFO] expMultiInstance: 35
[INFO] expMultiInstance: 36
[INFO] expMultiInstance: 37
[INFO] expMultiInstance: 38
[INFO] expMultiInstance: 39
[INFO] expMultiInstance: 40

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Parallel script execution - second run stops first
« Reply #1 on: November 21, 2016, 09:59:58 pm »
I guess you should submit a bug report (bottom right of this page).

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Parallel script execution - second run stops first
« Reply #2 on: November 22, 2016, 08:32:45 am »
I believe you'll find that the bug is whatever is causing you to be able to start a second script before the first finishes.