podman-desktop icon indicating copy to clipboard operation
podman-desktop copied to clipboard

During image "start", if the container creation fails, the user doesn't get any message

Open feloy opened this issue 1 year ago • 3 comments

Bug description

When trying to create a container, if the creation fails, no error is displayed on the screen.

After some investigation, I can see that the exception is not thrown from the call to libpodApi.podmanAttach (https://github.com/containers/podman-desktop/blob/main/packages/main/src/plugin/container-registry.ts#L1709).

After binary-searching which commit introduced the regression, I can see the problem happens since the PR #6128

Operating system

mac os

Installation Method

Installer from website/GitHub releases

Version

next (development version)

Steps to reproduce

  • Go to Images page
  • "Start" an image
  • Choose a non free port, to make the creation fail
  • You should have a message displayed in red at the bottom of the form, but no one appears

Relevant log output

No response

Additional context

No response

feloy avatar Mar 11 '24 14:03 feloy

Another way to make it fail is to change entrypoint or command to an invalid path

jeffmaury avatar Mar 11 '24 14:03 jeffmaury

Adding some logs in the docker-modem library, here s the difference I can see before and after updating to Node 20 + Electron 29.

Before, a 409 response is returned after the attach query. After, there is no response.

attach-ok

attach-err

feloy avatar Mar 13 '24 16:03 feloy

Removing this patch from libpod-dockerode.ts fixes the problem, but I'm not completely sure of the implications of removing it:

      // patch the modem to not send any data. By default dockerode send query parameters as JSON payload
      // but podman REST API will then echo the response, so send empty data '' instead
      const originalBuildRequest = this.modem.buildRequest;
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      this.modem.buildRequest = function (options: unknown, context: any, data: unknown, callback: unknown) {
        if (context.allowEmpty && context.path.includes('/attach?')) {
          data = '';
        }
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        return originalBuildRequest.call(this, options, context, data, callback);
      };

feloy avatar Mar 13 '24 16:03 feloy