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

XMLWordPrintable

    • 8.2
    • 4
    • Severity 2 - Major
    • 3

      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. Edit Issues 
      2. Add an attachment to the issue while still on the Edit screen
      3. Before completing the issue edition, delete the attachment
      4. Attempt to attach the same file again. (It doesn't matter if you attach the file to the same issue or a different), it needs to be done through the Edit Screen

      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:

            Assignee:
            Unassigned
            Reporter:
            Suddha
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: