GenericEntityException during Workflow Scheme Migration. No more Workflow Transition possible.

NielsJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 20, 2011

During a workflow scheme migration we got error messages for two of the issues. The root cause is:

ERROR: duplicate key value violates unique constraint "pk_os_historystep")

Now the issues cannot be closed. A similar error occurs:

Could not move to history step for #17061: root cause: while inserting: [GenericEntity:OSHistoryStep][id,10001][caller,myuser][startDate,2010-05-17 20:44:50.207][status,Not Done][owner,][finishDate,2011-12-21 14:19:25.9][actionId,231][stepId,1][dueDate,null][entryId,17061] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep"))

The database driver is PostgreSQL 8.4 JDBC4 managed by pgpool. Full trace during migration:

2011-12-21 10:17:42,007 JiraTaskExectionThread-17 ERROR myuser 617x43760x1 145jeni 10.10.0.249,192.168.1.3 /secure/project/SelectProjectWorkflowSchemeStep2.jspa [workflow.migration.enterprise.EnterpriseWorkflowMigrationHelper] Error occurred while migrating issue to a new workflow for project '...'.
com.atlassian.jira.workflow.WorkflowException: com.opensymphony.workflow.StoreException: Could not move to history step for #17061: root cause: while inserting: [GenericEntity:OSHistoryStep][id,10001][caller,null][startDate,2010-05-17 20:44:50.207][status,open][owner,][actionId,0][stepId,1][dueDate,null][entryId,17061] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep"))
	at com.atlassian.jira.workflow.OSWorkflowManager.migrateIssueToWorkflow(OSWorkflowManager.java:498)
	at com.atlassian.jira.workflow.migration.enterprise.EnterpriseWorkflowMigrationHelper.migrateIssues(EnterpriseWorkflowMigrationHelper.java:455)
	at com.atlassian.jira.workflow.migration.enterprise.EnterpriseWorkflowMigrationHelper.migrate(EnterpriseWorkflowMigrationHelper.java:358)
	at com.atlassian.jira.workflow.migration.WorkflowAsynchMigrator.call(WorkflowAsynchMigrator.java:33)
	at com.atlassian.jira.workflow.migration.WorkflowAsynchMigrator.call(WorkflowAsynchMigrator.java:18)
	at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:359)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at com.atlassian.multitenant.impl.DefaultMultiTenantManager.runForTenant(DefaultMultiTenantManager.java:61)
	at com.atlassian.multitenant.juc.MultiTenantExecutors$WrappedRunnable.run(MultiTenantExecutors.java:160)
	at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:249)
	at java.lang.Thread.run(Thread.java:662)
Caused by: com.opensymphony.workflow.StoreException: Could not move to history step for #17061: root cause: while inserting: [GenericEntity:OSHistoryStep][id,10001][caller,null][startDate,2010-05-17 20:44:50.207][status,open][owner,][actionId,0][stepId,1][dueDate,null][entryId,17061] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep"))
	at com.opensymphony.workflow.spi.ofbiz.OfbizWorkflowStore.moveToHistory(OfbizWorkflowStore.java:289)
	at com.atlassian.jira.workflow.OSWorkflowManager.migrateIssueToWorkflow(OSWorkflowManager.java:480)
	... 14 more
Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:OSHistoryStep][id,10001][caller,null][startDate,2010-05-17 20:44:50.207][status,open][owner,][actionId,0][stepId,1][dueDate,null][entryId,17061] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep"))
	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:156)
	at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:121)
	at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:63)
	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:489)
	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:461)
	at com.opensymphony.workflow.spi.ofbiz.OfbizWorkflowStore.moveToHistory(OfbizWorkflowStore.java:273)
	... 15 more

Any ideas how to cope with that problem? Is it possible to increase some sequence or so?

6 answers

1 accepted

0 votes
Answer accepted
NielsJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 2, 2012

We resolved the problem by cloning and deleting the problematic issues.

0 votes
Viktor Dmitrievich Krivucenko
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 20, 2016

Hello, did you find some solution for this case ? smile I can't close some issues.

0 votes
ObssA
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 5, 2013

Hi,

did you find permanent solution for this case ?

thanks.

0 votes
LE MEE December 9, 2012

I have this problem with a lot of issues. I can't cloning each one

0 votes
Anne Lee August 9, 2012

I need to keep all command and history log of the problematic issue, how should I do to clone this issue completely?

NielsJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2012

When cloning an Issue you have an option to clone all attachments. Unfortunately comments are not cloned. Maybe this plugin provides a solution: https://marketplace.atlassian.com/plugins/com.atlassian.cpji.cpji-jira-plugin

If this doesn't solve your problem please open a new question to reach more people than just me :-)

0 votes
NielsJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 1, 2012

The cause seems to be a database inconsistency that can be discovered by running the following query (if there are no results there is no inconsistency of this type):

select id from os_currentstep
intersect
select id from os_historystep;

Atlassian Support is still investigating for a solution to remove this inconsistency.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events