Back in 2012 after the release of BPM 11g PS4FP I wrote a blog entry on Instance Patching, what it was and how it worked.
Remember, instance patching is redeployment of a composite on the same Revision ID with “keep running instances” option, as opposed to instance migration which follows deployment of a new composite with a new Revision ID and selected instances migrated from the old to the new revision.
I’ve decided to revisit the subject in a little more detail on the back of an issue a customer had with instance patching…. they’d redeployed a composite after making a very small “compatible” change to the BPM process and subsequently found that they could not instantiate new instances. This blog will detail why this situation happened and how to recover from it.
Walk-through of the Issue
Revisit the Process
From the previous blog entry we had a very simple process with three human activities and file write….
….we instantiated several instances and progressed them to various different human activities….
Make an Incompatible Change to the Process
As in the prior blog entry, if we make an incompatible change to the process model then instances should not be able to be automatically patched.
Add an embedded subprocess with a new human activity (exactly as we did in the prior blog)….
…deploy this with the same “Revision ID’ and “Keep running instances” option….
Now if we go into the BPM Workspace we should see the BPM component suspended (as in the prior blog)….
…strange, no pending components….
…and all instances successfully patched !
This is an improvement since the PS4FP release of the product, now the engine can handle more complicated changes to the process when instance patching.
Let’s try removing the embedded subprocess and redeploy….
…it failed to deploy that time. We’ll need to “force” it as per the prior blog entry….
…and now it deploys….
Investigate the Suspended Instances
Looking in the BPM Workspace under the “Process Tracking” tab we can see the process is “Pending”….
… and the instances are all suspended….
Try Creating a New Process Instance
Now, it may be that investigation needs to be done on these existing instances before it can be decided what to do with them.
In the meantime, let us create a new instance (from the EM “test” or wherever) and look at the flow trace….
… this is strange ! The Service (WS endpoint) has been invoked but the process itself has not… what is happening here ?
Let us look at the state of the composite and the process in EM….
… the process is clearly “Up”.
…and so is the composite.
Very strange !
Examine the Composite
Maybe there is a problem with the composite itself. The best way to check this is to export the deployed composite from EM….
…save the exported composite and open it up….
…and let us look at the source, in particular the BPM component….
That looks like the culprit…. the BPM component has been suspended within the composite.
Why is this ? This is standard behavior, if all instances have not been patched then new instances cannot be created.
Resume the Suspended Instances
Let us resume (in bulk) all the suspended instances from the BPM Workspace….
That has worked….
no “Pending Components”….
…and no suspended process instances.
Let us try creating a new instance (from EM for example)…
…it works !
(Wrong) Conclusion !
That’s all we need to do then, patch all the existing instances and we can create new instances.
Well…. not really, what if for business reasons we can’t patch all the suspended instances until we’ve investigated them individually but we still need to create new instances ?
Let us create some more suspended instances by deploying with another embedded subprocess (same Revision ID and “keep instances running”)….
…which is compatible.
And deploying again (same Revision ID and “keep instances running”) after removing the embedded subprocess….
…which is an incompatible change….
Now, we can’t simply patch all the suspended instances this time because we need to investigate them individually first…. what can we do ?
Find the MBean
The property we found earlier in the extracted composite….
…is also available in an MBean….
Within the Enterprise Manger navigate to the “System MBean Browser”….
…and within this, navigate to….
<Application Defined MBeans><oracle.soa.config><Server: server-name><SCAComposite><composite-name><SCAComposite.SCAComponent><component-name>
…where the text in red is relevant to your server/composite/component.
…Expand attribute 14…
…there it is !
We can set it to “false” here and “apply” the change.
Creating a new process instance (in EM)…
NB: This attribute change will not survive a server restart !
…unless the attribute is persisted… the reason for this is that the state is persisted in MDS and on server restart this state is reloaded from MDS and overwrites any changes made. How do we persist this change ?
Let us go back to the MBean Browser and choose the “Operations” tab, in it we can choose the “save” operation…
…click on “save” and then on the “Invoke” button….
…and now the attribute is persisted to MDS….
(Another Wrong) Conclusion !
So that’s it… all we need to do is to change the attribute to “false” in the MBean and we’re good to go.
In fact what we have learned is that, if the change is compatible then all instances are automatically patched and we have nothing to worry about.
Automatic Patching Limit
I know of several customers having encountered this.
Essentially, only 100 instances are patched automatically for a compatible change.
You may think your change is compatible and you may expect all the instances to be patched, but you may be wrong.
You should always check, in the BPM Workspace or via the API, for the success or otherwise of the deployment and instance patching.
What possible justification can there be for this limit of 100 ?
On redeployment the BPM engine will attempt to patch all instances in one transaction. In the past, before the limit was implemented, some customers ran into problems with OOMs, and rollbacks etc… As a result a (seemingly arbitrary) limit of 100 was implemented to avoid these issues.
You must be aware that if you have more than 100 running instances of the composite then not all of the instances will be automatically patched. You will need to patch the remaining instances either individually or in bulk from either the BPM Workspace or via the API.
Instance patching is a very powerful feature of BPM 11g (and 12c) but customers need to be aware of how it works and what limitations there are to it. In this blog post we have delved deeper into the workings of instance patching and provided mechanisms for manipulating it as a customer’s business requires.
All site content is the property of Oracle Corp. Redistribution not allowed without written permission