Skip to main content
1-Visitor
Jun 11, 2018 4:33 PM UTC
Solved

Launched workflow continues to relaunch on it's own infinitely

I need some help. I created a relatively simple workflow (reused from another workflow we have) that takes a file, changes the state to Obsolete, moves it to a separate folder and starts a timer. After the timer is done, an activity is launched asking an Assignee to take some action. When that's completed, another timer starts followed by another activity (same as the first one) and then the workflow ends. 

There are no loops in the workflow. There's barely any code! The only code that exists is the "move file to folder" java code. 

Somehow every time I go to initiate this workflow it initiates and then continues to do so on its own until i disable the workflow template. Now that I know to look for this, I normally catch it after it's only initiated about 200 times or so. The issue is also that the activities sends an email and the first time this happen, Windchill sent me 1800 emails before I was able to shut down the workflow. 

Am I missing something easy here? Where else should I look to see what's causing this infinite loop? 

DobrisaAnswer
1-Visitor
Jun 28, 2018 8:42 PM UTC

Problem is solved! 

In the workflow template, what was causing the infinite loop was the initial "Set state" robot. The action that kicked off the workflow is a "Set State" from any state to a resulting state of "Obsolete". In the workflow, the first set state change is on that PBO to "Obsolete" so the workflow gets re-kicked off.... forever and ever. 

PTC Tech support (Aniket Davkhar) found this and pointed it out. Removing any set state robots from the workflow is the solution since the initial "set state" action puts the PBO into the desired state as is. 

18 replies

15-Moonstone
Jun 13, 2018 7:11 AM UTC

Can you share your workflow template ?

Translate
Dobrisa1-VisitorAuthor
1-Visitor
Jun 13, 2018 2:47 PM UTC

This is the workflow:

 

The code in the "Move file to folder" is:

// Check if a PBO has been assigned to the process
if (primaryBusinessObject !=null) {
	try {
		wt.folder.Folder f = wt.folder.FolderHelper.service.getFolder( "myFolderNameGoesHere",((wt.inf.container.WTContained)primaryBusinessObject).getContainerReference());
		
		//move the PBO to the test folder
		wt.folder.FolderHelper.service.changeFolder((wt.folder.FolderEntry)primaryBusinessObject, f);
 	}
	catch ( wt.util.WTException wex ) {
 		System.out.println( "Cannot move "+ primaryBusinessObject.getDisplayIdentifier( )+" because "+ wex.getLocalizedMessage());
	}
}
else
 // if a PBO has not been assigned to the Process
 System.out.println( "Primary business object is NULL");
Translate
Dobrisa1-VisitorAuthor
1-Visitor
Jun 13, 2018 2:49 PM UTC

ObsoleteWorkFlow.png

Translate
22-Sapphire I
Jun 19, 2018 3:43 PM UTC

Known as the "spiral of death" 🙂

I once sent 40,000 emails from Windchill from a workflow process that included email - not good.  Worth it always to test on a non-prod system not connected to email server.

 

Don't see anything in the code below.  Must be something else going on not shown.

Suggest commenting out all code in this robot and seeing if it still loops.

Translate
15-Moonstone
Jun 21, 2018 11:43 AM UTC

Not directly linked to OP but for email i use MailHog in test server. He prevent all modification on workflow for testing email template, notifications etc....

Translate
13-Aquamarine
Jun 20, 2018 2:17 PM UTC

Hi,

 

have you checked if the Obsolete state has the same workflow process defined in the Life Cycle template?

If this is the case, and you are doing a Set State to Obsolete in your workflow, it can be launching a new worklow instance each time.

 

Regards

Translate
22-Sapphire I
Jun 20, 2018 4:44 PM UTC

Really good thought to look for this.

It absolutely drives me crazy that on first save of a new lifecycle template, the system automatically applies an additional workflow process for some states.  On landing on that state (generally caused by the workflow mapped to the first state), an additional process starts.  This can build without limit.  Useful if each state's workflow process only dumps the PBO to the next state and then ends, but death spiral if both continue in parallel.

Translate
Dobrisa1-VisitorAuthorAnswer
1-Visitor
Jun 28, 2018 8:42 PM UTC

Problem is solved! 

In the workflow template, what was causing the infinite loop was the initial "Set state" robot. The action that kicked off the workflow is a "Set State" from any state to a resulting state of "Obsolete". In the workflow, the first set state change is on that PBO to "Obsolete" so the workflow gets re-kicked off.... forever and ever. 

PTC Tech support (Aniket Davkhar) found this and pointed it out. Removing any set state robots from the workflow is the solution since the initial "set state" action puts the PBO into the desired state as is. 

Translate