Uploaded image for project: 'Mender'
  1. Mender
  2. MEN-2385

[deployments] 'Inaccessible' files left on storage after 'Artifact not unique' response

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
    • Days in progress:
      4

      Description

      When you upload the same artifact again and again you get `{"error":"Artifact not unique","request_id":"546fd431-8e6c-4036-a4ac-e4eb72894865"}` response and db contains only 1 entry about the artifact (which is expected) but in s3 bucket I see a lot of files (which is not expected). I assume that all those files except 1 which has reference in db are inaccessible due to missing links.

      db entry:

      > db.images.find({})
      { "_id" : "cab16283-e3a8-40a4-9935-3fa858fa108c", "meta" : { "description" : "" }, "meta_artifact" : { "name" : "release-1_1.7.0", "device_types_compatible" : [ "raspberrypi3" ], "info" : { "format" : "mender", "version" : 2 }, "signed" : false, "updates" : [ { "typeinfo" : { "type" : "rootfs-image" }, "files" : [ { "name" : "mender-artifact787038970", "checksum" : "c3ca032b3ede300159369487df34215ff6c266d7c26c353a481cdfd188c31c98", "size" : NumberLong(222298112), "date" : ISODate("2019-01-02T16:27:55Z") } ], "metadata" : null } ] }, "modified" : ISODate("2019-02-27T08:40:48.501Z") }
      >
      

      s3 bucket content:

      aws s3 ls s3://<bucket-name>
      2019-02-27 10:45:33   60476928 111ffbca-bf65-4bfe-8d68-60a7bb9ddff1
      2019-02-27 10:52:23   60476928 1e637652-1605-49f0-b9e1-1e5db74bbf17
      2019-02-27 10:42:44   60476928 258aae74-2f86-4f22-82fe-6cdf20925ce0
      2019-02-27 10:48:17   60476928 3147d5cd-36ae-4bc5-a3c7-47f793d3022f
      2019-02-27 11:04:40   60476928 3a4ea46d-ecab-49f5-8630-8e96ca22649c
      2019-02-27 10:59:13   60476928 4a060edb-0fec-4f67-9b3c-0efc13b9213d
      2019-02-27 10:53:45   60476928 71a7d3b7-89c3-4b1e-b3d9-6477647066cb
      2019-02-27 10:51:01   60476928 80c9c566-d5c4-4367-83c7-96e3a878df52
      2019-02-27 11:00:35   60476928 886b56e9-5ee5-4830-94dd-534065a9fda1
      2019-02-27 11:06:02   60476928 8e22b395-a64b-406a-b971-af2d5747049c
      2019-02-27 11:03:18   60476928 93fce9e2-39f7-4ed3-81c2-0f594580c250
      2019-02-27 11:07:24   60476928 9bdbff36-46e8-4c6b-94ed-0ac177c6aa13
      2019-02-27 10:56:29   60476928 9c404020-2446-4fc1-9950-4506f4e4b26f
      2019-02-27 10:55:07   60476928 9d70e3e7-74ae-4f50-a9d3-41b1a67a297f
      2019-02-27 10:49:39   60476928 b8ae437f-3593-4a51-b051-d3880d5abf16
      2019-02-27 10:57:51   60476928 ba1f68d2-4000-451a-87a3-4f8ad16221e7
      2019-02-27 11:01:56   60476928 bf29af81-5e77-42c7-9886-6034ae1e480a
      2019-02-27 10:44:11   60476928 c3a834e4-4837-48bf-87b8-f6819e5dd9d3
      2019-02-27 10:39:39   60476928 cab16283-e3a8-40a4-9935-3fa858fa108c
      2019-02-27 10:46:55   60476928 cd886dbf-59e5-42a9-8e0b-250e77ccaf6e
      

      way of uploading an artifact:

      HOST='your-fqdn'
      LOGIN_URL="https://${HOST}/api/management/v1/useradm/auth/login"
      ARTIFACTS_URL="https://${HOST}/api/management/v1/deployments/artifacts"
      JWT=$(curl -X POST -u <username>:<password> ${LOGIN_URL})
      FILE=${HOME}/raspberrypi3_release_1_1.7.0.mender
      SIZE=$(ls -l ${FILE} | awk {'print $5'})
      
      while true; do time curl -X POST -H "Authorization: Bearer $JWT" -F "size=${SIZE}" -F "artifact=@$FILE" $ARTIFACTS_URL ; echo --- ; done
      real	1m21.929s
      user	0m0.107s
      sys	0m0.101s
      ---
      {"error":"Artifact not unique","request_id":"408fc31b-3d6e-42e6-bcfb-c1123435402d"}
      real	1m22.028s
      user	0m0.120s
      sys	0m0.073s
      ---
      {"error":"Artifact not unique","request_id":"2ced4750-914e-4a13-95ae-df432848cf3d"}
      real	1m27.453s
      user	0m0.082s
      sys	0m0.106s
      ---
      {"error":"Artifact not unique","request_id":"71b114d5-52fa-4686-b9bf-8bc26781828e"}
      real	1m21.936s
      user	0m0.096s
      sys	0m0.115s
      ---
      {"error":"Artifact not unique","request_id":"a9a8d396-b013-4cdf-82f0-5bbcff927843"}
      real	1m21.898s
      user	0m0.082s
      sys	0m0.103s
      ---
      {"error":"Artifact not unique","request_id":"67b6ab16-77c5-4405-bf4c-2355cf6a7c10"}
      real	1m21.790s
      user	0m0.130s
      sys	0m0.063s
      ---
      {"error":"Artifact not unique","request_id":"89613d16-5302-45d2-a486-4cd2c06d5a27"}
      real	1m21.947s
      user	0m0.095s
      sys	0m0.132s
      ---
      {"error":"Artifact not unique","request_id":"a6b5aea6-757a-4147-a17b-494cd47108f6"}
      real	1m22.107s
      user	0m0.105s
      sys	0m0.085s
      ---
      {"error":"Artifact not unique","request_id":"e1e67e18-16e8-4257-b234-9ed6140e8a94"}
      real	1m21.871s
      user	0m0.098s
      sys	0m0.074s
      ---
      {"error":"Artifact not unique","request_id":"1dd22299-2279-4204-ad04-ec589e6f9b07"}
      real	1m21.867s
      user	0m0.053s
      sys	0m0.149s
      ---
      {"error":"Artifact not unique","request_id":"49a547f5-4d96-404a-bf68-5fc38407f99c"}
      real	1m21.825s
      user	0m0.074s
      sys	0m0.121s
      ---
      {"error":"Artifact not unique","request_id":"e8eea49f-3615-4464-9c11-cf620aa14859"}
      real	1m22.175s
      user	0m0.086s
      sys	0m0.093s
      ---
      {"error":"Artifact not unique","request_id":"b607ca14-70e0-4639-968b-bbd519981859"}
      real	1m21.733s
      user	0m0.080s
      sys	0m0.125s
      ---
      {"error":"Artifact not unique","request_id":"546fd431-8e6c-4036-a4ac-e4eb72894865"}
      real	1m22.033s
      user	0m0.088s
      sys	0m0.102s
      ---
      {"error":"Artifact not unique","request_id":"3abd575e-db34-4b00-a9d0-5bb519a5f147"}
      real	1m21.930s
      user	0m0.111s
      sys	0m0.086s
      ---
      {"error":"Artifact not unique","request_id":"efb8c8d6-5128-4c25-91ac-a20b6b55e0fb"}
      real	1m21.838s
      user	0m0.088s
      sys	0m0.130s
      ---
      {"error":"Artifact not unique","request_id":"85009d00-ee12-441c-815e-c099940ebfd9"}
      real	1m21.787s
      user	0m0.081s
      sys	0m0.091s
      ---
      {"error":"Artifact not unique","request_id":"38ba4750-22b1-48a1-9f7a-3ca04ce551b4"}
      real	1m21.912s
      user	0m0.079s
      sys	0m0.119s
      ---
      {"error":"Artifact not unique","request_id":"14c4be08-cc03-4691-97c7-e2058eaef7a4"}
      real	1m22.035s
      user	0m0.082s
      sys	0m0.102s
      ---
      {"error":"Artifact not unique","request_id":"6037676f-907d-4a53-8fd4-55bbbc1ea6dc"}
      real	1m22.125s
      user	0m0.112s
      sys	0m0.067s
      ---
      

      logs from deployments container:

      time="2019-02-27T10:27:22Z" level=error msg="Removing file: InvalidParameter: 1 validation error(s) found.\n- minimum field size of 1, DeleteObjectInput.Key.\n: Artifact not unique" file=routing.go func="controller.(*SoftwareImagesController).NewImage-fm" line=199 request_id=6037676f-907d-4a53-8fd4-55bbbc1ea6dc user_id=67643de1-a29b-471d-9031-4b6995d301d5
      time="2019-02-27T10:27:22Z" level=error msg="Artifact not unique" file=images.go func="controller.(*SoftwareImagesController).NewImage" line=237 request_id=6037676f-907d-4a53-8fd4-55bbbc1ea6dc user_id=67643de1-a29b-471d-9031-4b6995d301d5
      time="2019-02-27T10:27:22Z" level=info msg="422 5186824μs POST /api/management/v1/deployments/artifacts HTTP/1.1 - curl/7.58.0" file=middleware.go func="accesslog.(*AccessLogMiddleware).MiddlewareFunc.func1" line=60 request_id=6037676f-907d-4a53-8fd4-55bbbc1ea6dc user_id=67643de1-a29b-471d-9031-4b6995d301d5
      

        Attachments

          Activity

            People

            • Assignee:
              kjaskiewicz Krzysztof Jaśkiewicz
              Reporter:
              olmi Alex Miliukov
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel