Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    proget 500 Internal server error when pushing to a proget docker feed

    Scheduled Pinned Locked Moved Support
    55 Posts 6 Posters 140 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • atrippA Offline
      atripp inedo-engineer @felfert
      last edited by

      @felfert amazing!! That script will come in handy when we need to help users patch their instance; we can also try to add something that allows you to patch via the UI as well!!

      felfertF 1 Reply Last reply Reply Quote 0
      • felfertF Offline
        felfert @atripp
        last edited by

        @atripp said in proget 500 Internal server error when pushing to a proget docker feed:

        we can also try to add something that allows you to patch via the UI as well!!

        Huh? Well, I don't think this would be such a good idea. I assume you guys already have some code in proget for upgrading your DB-Schema when a new version is required. That's where the function should be replaced. This script is only meant as a intermediate solution until you guys have updated the function.

        Cheers
        -Fritz

        atrippA 1 Reply Last reply Reply Quote 0
        • atrippA Offline
          atripp inedo-engineer @felfert
          last edited by atripp

          Hi @felfert ,

          As an update, we'd are planning on this pattern instead of row/table locking (PG-3104). It gives us a lot more control and makes it a lot easier to avoid deadlocks.

          I still can't reproduce the issue, but I see no reason this won't work.

          CREATE OR REPLACE FUNCTION "DockerBlobs_CreateOrUpdateBlob"
          (
              "@Feed_Id" INT,
              "@Blob_Digest" VARCHAR(128),
              "@Blob_Size" BIGINT,
              "@MediaType_Name" VARCHAR(255) = NULL,
              "@Cached_Indicator" BOOLEAN = NULL,
              "@Download_Count" INT = NULL,
              "@DockerBlob_Id" INT = NULL
          )
          RETURNS INT
          LANGUAGE plpgsql
          AS $$
          BEGIN
          
          	-- avoid race condition when two procs call at exact same time
          	PERFORM PG_ADVISORY_XACT_LOCK(HASHTEXT(CONCAT_WS('DockerBlobs_CreateOrUpdateBlob', "@Feed_Id", LOWER("@Blob_Digest"))));
          
              SELECT "DockerBlob_Id"
                INTO "@DockerBlob_Id"
                FROM "DockerBlobs"
               WHERE ("Feed_Id" = "@Feed_Id" OR ("Feed_Id" IS NULL AND "@Feed_Id" IS NULL))
                 AND "Blob_Digest" = "@Blob_Digest";
          
              WITH updated AS
              (
                  UPDATE "DockerBlobs"
                     SET "Blob_Size" = "@Blob_Size",
                         "MediaType_Name" = COALESCE("@MediaType_Name", "MediaType_Name"),
                         "Cached_Indicator" = COALESCE("@Cached_Indicator", "Cached_Indicator")
                   WHERE ("Feed_Id" = "@Feed_Id" OR ("Feed_Id" IS NULL AND "@Feed_Id" IS NULL)) 
                     AND "Blob_Digest" = "@Blob_Digest"
                  RETURNING *
              )        
              INSERT INTO "DockerBlobs"
              (
                  "Feed_Id",
                  "Blob_Digest",
                  "Download_Count",
                  "Blob_Size",
                  "MediaType_Name",
                  "Cached_Indicator"
              )
              SELECT
                  "@Feed_Id",
                  "@Blob_Digest",
                  COALESCE("@Download_Count", 0),
                  "@Blob_Size",
                  "@MediaType_Name",
                  COALESCE("@Cached_Indicator", 'N')
              WHERE NOT EXISTS (SELECT * FROM updated)
              RETURNING "DockerBlob_Id" INTO "@DockerBlob_Id";
          
              RETURN "@DockerBlob_Id";
          
          END $$;
          
          felfertF 1 Reply Last reply Reply Quote 0
          • felfertF Offline
            felfert @atripp
            last edited by

            @atripp I tested this one and it works.

            However:
            In the meantime, i have updated to the released 25.0.9 (aka latest) and now I cannot reproduce the error either - even if I explicitely revert the function to the old one where it produced the error before 😕

            So I'm afraid that i might not be a reliable tester for this specific error anymore.

            Cheers
            -Fritz

            1 Reply Last reply Reply Quote 1
            • P Offline
              pariv_0352
              last edited by

              I updated to 25.0.9 as well, and still have the issue.

              atrippA 1 Reply Last reply Reply Quote 0
              • atrippA Offline
                atripp inedo-engineer @pariv_0352
                last edited by

                @pariv_0352 the code is not fixed in 25.0.9

                However, inedo/proget:25.0.10-ci.5 will have the new code that should prevent this error

                P 1 Reply Last reply Reply Quote 0
                • P Offline
                  pariv_0352 @atripp
                  last edited by

                  @atripp said in proget 500 Internal server error when pushing to a proget docker feed:

                  the code is not fixed in 25.0.9

                  Yes, I got it, just to clarify that I still have the error, so you can use me as tester )

                  Should I try 25.0.10-ci.5+ or wait for release?

                  stevedennisS 1 Reply Last reply Reply Quote 0
                  • stevedennisS Offline
                    stevedennis inedo-engineer @pariv_0352
                    last edited by

                    Hi @pariv_0352,

                    Thanks! I'd try out 25.0.10-ci.10 -- it should work in theory! And if not then we'll just need to fix it anyway :)

                    Thanks,
                    Steve

                    P 1 Reply Last reply Reply Quote 0
                    • P Offline
                      pariv_0352 @stevedennis
                      last edited by

                      @stevedennis
                      I’ll try it as soon as it’s out :)

                      1 Reply Last reply Reply Quote 0
                      • P Offline
                        pariv_0352
                        last edited by

                        I have installed 25.0.10 release. I can't reproduce the error anymore.

                        1 Reply Last reply Reply Quote 0
                        • T Offline
                          thomas_3037
                          last edited by

                          I upgraded to 25.0.11-ci12 and have the problem. Its even worst then before, the workaround doesn't work any time.

                          atrippA 1 Reply Last reply Reply Quote 0
                          • atrippA Offline
                            atripp inedo-engineer @thomas_3037
                            last edited by

                            Hi @thomas_3037 ,

                            The specific issue was already fixed; I'm going to close it because whatever your experiencing is different and the "history" in this long winding thread will only make it harder to understand ,

                            Please "start from the scratch" as if you never read this.

                            Thanks,
                            Alana

                            1 Reply Last reply Reply Quote 0

                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                            With your input, this post could be even better 💗

                            Register Login
                            • 1
                            • 2
                            • 3
                            • 3 / 3
                            • First post
                              Last post
                            Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation