# Bug JIM-349 - Parallel import of multiple projects fails with "PG::QueryCancelled"

Project: Stream Jira to OpenProject data Migrator
Status: review failed
URL: https://community.openproject.org/work_packages/JIM-349

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Immediate |
| Module |  |
| Target versions | 18.0.0 |
| Observed in versions |  |
| Sprint | Sprint 25.11.-01.12.2026 |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Alfonso Mancilla |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

#### **The problem**

Each Jira issue is imported in one transaction: the work package with its comments, history, etc. When that transaction writes a row that the whole import shares, the row stays locked until the transaction commits. So issues from other projects being imported in parallel that need the same row have to wait. Currently, our import does such writes in two places:

*   **Reference rows**: at the start of its transaction, every issue upserts the import&#x27;s rows in jira\_open\_project\_references for its type, status and priority.
    
*   **The workflow**: every issue rewrites the workflow of its type. It deletes the type&#x27;s status transitions and inserts them again.
    

Most issues across projects use the same few types, statuses and priorities. So on instances with many projects, the project jobs end up waiting for each other, and those rows get written one issue at a time. Once a wait goes past the database statement timeout (90s in production), the query is cancelled and the job fails with this error.

**Possible fixes:**

1.  Keep the current import structure but stop writing those import wide shared rows on every issue:
    
    1.  **Reference rows: c**hange the reference upsert to `ON CONFLICT DO NOTHING` instead of `ON CONFLICT UPDATE`
        
    2.  **Workflow**: &nbsp;move the workflow creation out of the per-issue transaction (e.g into one job that runs after the work packages). Each issue only adds its status to its type&#x27;s workflow when it&#x27;s missing.
        
2.  Create all types, statuses and priorities, with their reference rows and workflows, in one job before the work package stage (similar to how it&#x27;s done with custom fields and labels).
    

### Steps to reproduce

1.  Start a Jira import with several hundreds of projects and tens of thousands of issues
    

### What is the buggy behavior?

*   The import fails with technical errors (s. screenshot below)
    

### What is the expected behavior?

1.  The import should pass
    

### Screenshots and other files

<br>

_<img class="op-uc-image op-uc-image_inline" src="https://community.openproject.org/api/v3/attachments/926770/content"><img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/926770/content">_

### Environment information

_Please check and fill out the following details to help us identify in what versions and distributions of OpenProject the error occurs_

**OpenProject installation type**

*   [ ] Cloud edition
*   [ ] On-Premise
*   [ ] Packaged installation
*   [x] Docker All-in-one container
*   [ ] Docker-compose installation
*   [ ] Other (please specify)

**OpenProject version**

_18-rc_

<br>

**Browser**

*   [ ] Chrome
*   [ ] Firefox
*   [ ] Safari
*   [ ] Mobile Safari
*   [x] Other (please specify) DuckDuckGoGo

**Operating System**

*   [ ] Windows
*   [x] Mac OS X
*   [ ] Mobile iOS
*   [ ] Mobile Android
*   [ ] Linux (please specify distro)
*   [ ] Chrome OS
*   [ ] Other (please specify)

**Language**

*   [x] English
*   [ ] German
*   [ ] Other:
