Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-75557

Jira renames attachments unexpectedly when there are stale temporary attachments (caused by JRASERVER-71824)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • 8.20.10
    • Issue - Attachments
    • None

    Description

      Issue Summary

      Due to JRASERVER-71824 if there are stale temporary attachment entries in the DB table tempattachmentsmonitor, Jira creates attachments with "filename*-n*.ext" postfix.

      This is reproducible on Data Center: yes

      Steps to Reproduce

      1. Attempt to attach a "large" attachment with a filename that's unique for example "unique-name.pdf" and cancel the upload before the attachment can finish
      2. Attempt to attach the same file again. (It doesn't matter if you attach the file to the same issue or a different)

      Expected Results

      Jira attaches the "unique-name.pdf" file with the same name (because there's no "real" attachment with that name anywhere)

      Actual Results

      Jira will attach the file by renaming it to "unique-name-1.pdf"

      Workaround

      The reason for this bug is there is/are stale temp attachments both in the filesystem and in the database.

      • Identify the stale temporary attachments from the DB:
        SELECT * FROM tempattachmentsmonitor WHERE file_name LIKE '%unique-name%';
        • The expected output would show you one or more temp attachments with the same filename.extension or filename-n.extension - Note the temporary_attachment_id column values
      • On each jira nodes' local home you'll find these files with the name temporary_attachment_id in <JIRA-HOME>/caches/tmp_attachments
        • delete those files matching the temporary_attachment_id from the SQL statement output from each node in Jira Datacenter
      • Now DELETE the entries from the DB
        DELETE FROM tempattachmentsmonitor where temporary_attachment_id = 'tempxxxxxxxx';

      After deleting the temp attachment entries from the DB - the cache will be loaded again and now when you attach the file with the same name it will not rename it unexpectedly.

      Additional Info:

      This is not a 100% perfect portrayal of the process. This is intended to shed some light on how this works and where it breaks:

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              smitra2@atlassian.com Suddha
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: