Skip to main content
1-Visitor
June 11, 2018
Solved

Launched workflow continues to relaunch on it's own infinitely

  • June 11, 2018
  • 4 replies
  • 5785 views

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? 

Best answer by Dobrisa

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. 

4 replies

15-Moonstone
June 13, 2018

Can you share your workflow template ?

Dobrisa1-VisitorAuthor
1-Visitor
June 13, 2018

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");
Dobrisa1-VisitorAuthor
1-Visitor
June 13, 2018

ObsoleteWorkFlow.png

22-Sapphire I
June 19, 2018

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.

15-Moonstone
June 21, 2018

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....

13-Aquamarine
June 20, 2018

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

22-Sapphire I
June 20, 2018

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.

Dobrisa1-VisitorAuthorAnswer
1-Visitor
June 28, 2018

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.