How to fix the issue when a snapshot deployment fails with an error java.io.IOException: Failed to parse snapshot archive
Problem
During the deployment of a Jira snapshot, an error occurs java.io.IOException: Failed to parse snapshot archive
and Caused by: java.util.zip.ZipException: zip END header not found
, indicating a failure to parse the snapshot archive. Additionally, issues such as duplicate entries, SQL exceptions, and data migration problems are also encountered.
Symptoms
Error message:
Failed to parse snapshot archive '/opt/atlassian/jira/temp/snapshot****/*****.zip'
Duplicate object errors, specifically with the 'Parent-Child Link'.
Integrity check failures indicate multiple errors and warnings.
SQL exceptions such as
Duplicate entry '******' for key 'PRIMARY'
NullPointerExceptions in logs.
Issues are not visible post-deployment despite the application of configuration changes.
Attachment-related errors were reported during deployment.
Root Cause Analysis
The root cause can be any of the following:
Corrupted Snapshot Archive: The snapshot archive is corrupted, leading to parsing failures.
Duplicate Entries: Duplicate issue link types in the Jira database, causing integrity check failures.
SQL Exceptions: Configuration issues in the database are leading to integrity constraint violations.
NullPointerExceptions: The browser or a proxy/firewall is terminating the request. Potential issues with request handling or database integrity.
Attachment Errors: Missing or corrupted attachments causing deployment errors.
Resolution
Below are the resolutions depending on the root causes. You can follow any of the resolutions depending on the root cause you encounter.
Step 1: Addressing Snapshot Archive Parsing Error
Recreate the Export: If an error like the one below is reported, recreate the export, as the files are likely corrupted.
java.io.IOException: Failed to parse snapshot archive '/opt/atlassian/jira/temp/snapshot****/******.zip'. at com.botronsoft.jira.rollout.impl.SnapshotUnzippingServiceImpl.parseArchive(SnapshotUnzippingServiceImpl.java:133) at com.botronsoft.jira.rollout.impl.SnapshotUnzippingServiceImpl.initiateOperation(SnapshotUnzippingServiceImpl.java:73)
Zip END header not found: If the
Caused by: java.util.zip.ZipException: zip END header not found
error is found during a Configuration Manager for Jira (CMJ) snapshot deployment like the one below, try the suggestions mentioned in the article here: How to resolve zip END header not found errorCaused by: java.util.zip.ZipException: zip END header not found at java.base/java.util.zip.ZipFile$Source.zerror(Unknown Source) at java.base/java.util.zip.ZipFile$Source.findEND(Unknown Source) at java.base/java.util.zip.ZipFile$Source.initCEN(Unknown Source)
Exclude Attachments: The attachment metadata (filename, creator, create date, etc.) is small enough to always be included in the snapshot. However, including the attachment files can make the snapshot grow very large. If attachments are included in the export, exclude them and manually migrate them. Refer to Moving Attachments.
Step 2: Resolving Duplicate Entries
If there is a Duplicate Object with an error related to ‘Parent-Child Link’ as the one below, then perform the two SQL queries shown in the following subsection:
Duplicate object,Error,Parent-Child Link,"Issue Link Type <a href=""http://abc.com/secure/admin/EditLinkType!default.jspa?id=12345"" target=""_blank"">'Parent-Child Link'</a> has duplicates. This may cause errors during deploy.",Parent-Child Link (Issue Link Type)
Identify Duplicates:
Delete Duplicates: Based on the integrity check results, delete the duplicate entry. Here is an example.
Rename Duplicate Link Type: Alternatively, rename the duplicate issue link type via the Jira UI to resolve the conflict.
Step 3: Addressing SQL Exceptions
If the errors are related to SQL Exceptions, as the one below:
Review MySQL Configuration: Ensure that the MySQL configuration is correct. Refer to Duplicate Entry for Key PRIMARY for detailed steps.
Step 4: Resolving NullPointerExceptions and Request Termination Issues
If the errors are related to java.lang.NullPointerException
as the one below
Check for Termination Issues: Review the request handling to ensure that a proxy or firewall is not terminating it. Refer to Timeout or Proxy Error.
Ensure Proper Request Handling: Verify that the NullPointerException does not occur, which could be due to interrupted or malformed requests for the browser or a proxy/firewall terminating the request.
Step 5: Handling Attachment Errors
Delete and Reimport: Delete issues associated with missing attachments and reimport them.
Redeploy Attachments: Ensure that attachment errors are resolved before redeploying.
Post-Deployment Steps
Reindex Jira: Run a reindexing operation to ensure all issues and configurations are correctly indexed and visible.
Verify issues visibility: Confirm that all issues are visible and configurations are correctly applied post-redeployment.
By following the resolution steps, you can effectively resolve the common errors encountered during Jira snapshot deployments. To prevent data loss, ensure that you perform database backups before making any changes.