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.
    • felfertF Offline
      felfert
      last edited by

      @thomas_3037 @wechselberg-nisboerge_3629

      Another idea (just to find common parts of our proget installations or rule-out differences):

      • In my proget, I use the embedded postgres as db
      • The proget container itself is running on Rocky 9 in a quadlet.

      Cheers
      -Fritz

      1 Reply Last reply Reply Quote 0
      • W Offline
        wechselberg.nisboerge_3629
        last edited by wechselberg.nisboerge_3629

        My setup:

        • Host is Ubuntu 24.04 LTS
        • Running proget in a quadlet
        • Using embedded Database
        • With a caddy as a reverse proxy in front of it
        • Caddy also running in a quadlet
        • proget and caddy in a common podman network
        • Caddyfile as simple as possible:
        <hostname {
            tls <certpath> <keypath>
            reverse_proxy http://proget:80
        }
        
        1 Reply Last reply Reply Quote 0
        • atrippA Offline
          atripp inedo-engineer @felfert
          last edited by

          Hi @inedo_1308

          Just tested this 25.0.9-ci.6. Unfortunately, there is neither a stacktrace shown in GUI nor in stdout/stderr on the docker container that runs proget itself :-(

          Sorry but just to confirm, you looked in the Admin > Diagnostic Center?

          Basically, I just changed the code from this...

          if (error.StatusCode >= 500 || context.Response.HeadersWritten)
             WUtil.LogFeedException(error.StatusCode, feed, context, error);
          

          ...to this...

          if (error.StatusCode == 500)
             WUtil.LogFeedException(error.StatusCode, feed, context, error);
          

          I really don't see how that wouldn't work to log it. I guess, next thing I could try is to write the stack trace in the detail.

          Thanks,
          Alana

          felfertF 2 Replies 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:

            Sorry but just to confirm, you looked in the Admin > Diagnostic Center?

            Yes, exactly. Also: Before perfoming the test, i deleted all messages (there were some unrelated errors from another feed). After the 500 happened, I did a reload in the browser and it still said "There are no errors to display."

            Cheers
            -Fritz

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

              @atripp BTW it's getting weirder by the minute,
              I now have created a second instance as a sandbox for testing and there I tried a bisection of the proget versions (starting from 25.0.2 until I reached 25.0.9-ci.6) and was NOT able to reproduce the error with that sandbox instance. I did two test variants: The first sequence of tests was using the default DB (mssql). After that, I recreated the sandbox VM from scratch ant repeated the sequece of tests after migrating proget to postgres with 25.0.2 installed.
              I did this, because the "production" instance was using postgres and was migrated very early after 25.0 was released.

              After learning that I cannot reproduce the error that way, I then had another idea: Performing a DB export on the production proget and importing that on the sandbox. Unfortunately, the import does not work: In the form for importing, I chose upload, then selected the DB-export but after some short time it simply said "Not found" in the form. No errors were shown in the diag center either.

              Next steps (tomorrow - its 3 in the morning here) will be:

              • Freshly recreate the sandbox with 25.0.9-ci.6 and migrated to postgres.
              • Stop the proget container
              • Copy the content of all mapped docker volumes (/var/proget/{backup,database,extensions,packages}) from "production" to sandbox
              • Start proget container
              • Retry to reproduce the error on the sandbox

              Will report back when i have more results

              Cheers
              -Fritz

              atrippA 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:

                Basically, I just changed the code from this...

                if (error.StatusCode >= 500 || context.Response.HeadersWritten)
                    WUtil.LogFeedException(error.StatusCode, feed, context, error);
                

                ...to this...

                if (error.StatusCode == 500)
                    WUtil.LogFeedException(error.StatusCode, feed, context, error);
                

                That change looks wrong to me, because (error.StatusCode == 500) is more specific/restrictive than (error.StatusCode >= 500 || context.Response.HeadersWritten)
                In other words: It logs less than before.

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

                  @inedo_1308 thanks for continuing to help us figure this out

                  Do you mind trying inedo/proget:25.0.9-ci.7?

                  I'm thinking it's some kind of middleware bug (our code? .NET code? who knows), and I can't see why the logging code I added didn't log that in diagnostic center.

                  Whatever the case, we can see the error JSON is being written: {"errors":[{"code":"UNKNOWN","message":"Nullable object must have a value.","detail":[]}]} ... so I just added the stack trace to detail element.

                  FYI, the code:

                  catch (Exception ex)
                  {
                      WriteError(context, DockerException.Unknown(ex.Message), feed, w => w.WriteValue(ex.StackTrace)); // I added the final argument
                  }
                  
                  ....
                  
                  private static void WriteError(AhHttpContext context, DockerException error, DockerFeed? feed, Action<JsonTextWriter>? writeDetail = null)
                  {
                      /// code from before that should have worked
                      if (error.StatusCode == 500)
                          WUtil.LogFeedException(error.StatusCode, feed, context, error);
                  
                      if (!context.Response.HeadersWritten)
                      {
                          context.Response.Clear();
                          context.Response.StatusCode = error.StatusCode;
                          context.Response.ContentType = "application/json";
                  
                          using var jsonWriter = new JsonTextWriter(context.Response.Output);
                          jsonWriter.WriteStartObject();
                          jsonWriter.WritePropertyName("errors");
                          jsonWriter.WriteStartArray();
                  
                          jsonWriter.WriteStartObject();
                          jsonWriter.WritePropertyName("code");
                          jsonWriter.WriteValue(error.ErrorCode);
                          jsonWriter.WritePropertyName("message");
                          jsonWriter.WriteValue(error.Message);
                          jsonWriter.WritePropertyName("detail");
                          jsonWriter.WriteStartArray();
                          writeDetail?.Invoke(jsonWriter);
                          jsonWriter.WriteEndArray();
                          jsonWriter.WriteEndObject();
                  
                          jsonWriter.WriteEndArray();
                          jsonWriter.WriteEndObject();
                      }
                  }
                  
                  felfertF 1 Reply Last reply Reply Quote 0
                  • atrippA Offline
                    atripp inedo-engineer @felfert
                    last edited by

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

                    That change looks wrong to me, because (error.StatusCode == 500) is more specific/restrictive than (error.StatusCode >= 500 || context.Response.HeadersWritten)
                    In other words: It logs less than before.

                    Good spot / good find -- though we never actually raise anything except 500 anyway, so i thought it would be fine 🙄

                    public static DockerException Unknown(string message) => new DockerException(500, "UNKNOWN", message);
                    

                    Anyway wriiting the detail to that array will hpefully be caught.

                    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:

                      Do you mind trying inedo/proget:25.0.9-ci.7?

                      Coming up in a few minutes ...

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

                        @inedo_1308

                        Nope, like before: Nothing in the diag center and on the container's output, only this:

                        Aug 29 03:53:54 gsg1repo.graudatastorage.intern systemd-proget[538207]:       Request finished HTTP/1.1 GET http://proget.graudatastorage.intern/0x44/proget/Inedo.ProGet.WebApplication.Controls.Layout.NotificationBar/GetNotifications - 200 30 - 7.0388ms
                        Aug 29 03:53:58 gsg1repo.graudatastorage.intern systemd-proget[538207]: info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
                        Aug 29 03:53:58 gsg1repo.graudatastorage.intern systemd-proget[538207]:       Request finished HTTP/1.1 PATCH http://proget.graudatastorage.intern/v2/testing/xts-addon-webui/blobs/uploads/ca81bc12-62b5-47f9-9bb3-7ef9b8c1530a - 202 0 - 19396.8436ms
                        Aug 29 03:53:58 gsg1repo.graudatastorage.intern systemd-proget[538207]: info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
                        Aug 29 03:53:58 gsg1repo.graudatastorage.intern systemd-proget[538207]:       Request starting HTTP/1.1 PUT http://proget.graudatastorage.intern/v2/testing/xts-addon-webui/blobs/uploads/ca81bc12-62b5-47f9-9bb3-7ef9b8c1530a?digest=sha256%3Acf93e1bb05f4874a5923244a5600fbc0091ef87879b6c780e7baced4b409daa0 - application/octet-stream 0
                        Aug 29 03:53:58 gsg1repo.graudatastorage.intern systemd-proget[538207]: A 500 error occurred in testing: Nullable object must have a value.
                        Aug 29 03:53:58 gsg1repo.graudatastorage.intern systemd-proget[538207]: info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
                        Aug 29 03:53:58 gsg1repo.graudatastorage.intern systemd-proget[538207]:       Request finished HTTP/1.1 PUT http://proget.graudatastorage.intern/v2/testing/xts-addon-webui/blobs/uploads/ca81bc12-62b5-47f9-9bb3-7ef9b8c1530a?digest=sha256%3Acf93e1bb05f4874a5923244a5600fbc0091ef87879b6c780e7baced4b409daa0 - 500 1091 application/json 162.3468ms
                        
                        felfertF 1 Reply Last reply Reply Quote 0
                        • felfertF Offline
                          felfert @felfert
                          last edited by felfert

                          Hold on. The second number in the last line:

                          ... - 500 1091 application/json 162.3468ms
                          

                          The 500 obviously is the status code. Is the second number the body size of the error response. If yes, that is more than before (in the previous tests, the second number was 90) and I will reveal that, If I do a wireshark dump .... just a minute ...

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

                            This post is deleted!
                            1 Reply Last reply Reply Quote 0
                            • felfertF Offline
                              felfert
                              last edited by

                              Got it from the wireshark dump:

                              HTTP/1.1 500 Internal Server Error
                              Date: Fri, 29 Aug 2025 02:08:39 GMT
                              Server: Kestrel
                              Content-Length: 1091
                              Content-Type: application/json
                              Cache-Control: private
                              Content-Range: 0-32281444
                              Vary: Accept-Encoding,Authorization
                              X-ProGet-Version: 25.0.9.7
                              X-ProGet-Edition: free
                              Docker-Distribution-API-Version: registry/2.0
                              Connection: close
                              
                              {"errors":[{"code":"UNKNOWN","message":"Nullable object must have a value.","detail":["   at System.Nullable`1.get_Value()\n   at Inedo.ProGet.Feeds.Docker.DockerFeed.VerifyAndInstallBlobUpload(String uploadId, DockerDigest digest, String mediaType) in C:\\Users\\builds\\AppData\\Local\\Temp\\InedoAgent\\BuildMaster\\192.168.44.60\\Temp\\_E588882\\Src\\src\\ProGet\\Feeds\\Docker\\DockerFeed.cs:line 381\n   at Inedo.ProGet.WebApplication.SimpleHandlers.Docker.DockerHandler.ProcessBlobUploadAsync(AhHttpContext context, WebApiContext apiContext, DockerFeed feed, String repositoryName, String uploadId) in C:\\Users\\builds\\AppData\\Local\\Temp\\InedoAgent\\BuildMaster\\192.168.44.60\\Temp\\_E588882\\Src\\src\\ProGet\\WebApplication\\SimpleHandlers\\Docker\\DockerHandler.cs:line 200\n   at Inedo.ProGet.WebApplication.SimpleHandlers.Docker.DockerHandler.ProcessRequestAsync(AhHttpContext context) in C:\\Users\\builds\\AppData\\Local\\Temp\\InedoAgent\\BuildMaster\\192.168.44.60\\Temp\\_E588882\\Src\\src\\ProGet\\WebApplication\\SimpleHandlers\\Docker\\DockerHandler.cs:line 92"]}]}
                              
                              atrippA 1 Reply Last reply Reply Quote 0
                              • atrippA Offline
                                atripp inedo-engineer @felfert
                                last edited by

                                @inedo_1308 finally!!! nice find :)

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

                                  In case you're curious, here is #381

                                  49baf0bd-fa8f-4b1d-bf03-bcc7775cedd8-{23102B2B-0A1F-4CD1-B54C-71137AB85636}.png

                                  .... and now to figure out what could possibly be null in that specific area 🙄

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

                                    Hmmm the only possibility I can see is that DockerBlobs_CreateOrUpdateBlob is returning NULL , which is failing conversion to int dockerBlobId. That's the only nullable converstion on that line.

                                    There's gotta be some kind of bug with this postresql procedure. Maybe a race condition??

                                    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
                                    
                                        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 $$;
                                    

                                    Anyway we'll study that another day.. at least we think we know specifically where the issue is.

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

                                      @atripp Tomorrow I will compare this function's code on my "production" proget with that on the sandbox. Just to be shure.

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

                                        @inedo_1308 sounds good!

                                        The code would almost certainly be the same, since it hasn't been updated since we did the PostgreSQL version of the script.

                                        So, I think it's a race condition, though I don't know how it would happen. However, if it's a race condition, then it should be solved with an UPDLOCK (or whatever) in PostgreSQL.

                                        1. SELECT finds no matching blob in the database (thus DockerBlob_Id is null)
                                        2. ... small delay ...
                                        3. UPDATE finds the matching blob because it was added (thus a row gets added to insert)
                                        4. INSERT does run because there is a row in inserted
                                        5. A NULL DockerBlob_Id is returned

                                        If you're able to patch the procedure, could you add FOR UPDATE as follows? We are still relatively to PostgreSQL so I don't know if this the right way to do it in this case.

                                        I think a second SELECT could also work, but I dunno.

                                        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
                                        
                                            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"
                                           FOR UPDATE;
                                        
                                            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 felfert

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

                                          The code would almost certainly be the same, since it hasn't been updated since we did the PostgreSQL version of the script.

                                          You are right "production" and sandbox showed the same function

                                          If you're able to patch the procedure, could you add FOR UPDATE as follows? We are still relatively to PostgreSQL so I don't know if this the right way to do it in this case.

                                          Did that, verified that the function actually has changed and did another test. Unfortunately this did not help, error was exactly the same like in my above wireshark dump.
                                          Or does one have to "compile" the function somehow after replacing? (I never dealt with SQL functions before and in general have very limited SQL knowledge.)

                                          Cheers,
                                          -Fritz

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

                                            BTW:
                                            Did you guys generate a different password for the postgres DB than for MSQL
                                            during migration?

                                            I'm asking, because i vaguely remember that i could access the postgres DB using the same password (taken from the mssql connection-string environment var).

                                            Now, this didn't work anymore and I had to disable password-auth in pg_hba.conf in order to use pg_dump and psql inside the proget container.

                                            Thanks
                                            -Fritz

                                            atrippA 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
                                            • 2 / 3
                                            • First post
                                              Last post
                                            Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation