dockertest icon indicating copy to clipboard operation
dockertest copied to clipboard

Expire breaks code transparency

Open ilyadt opened this issue 5 months ago • 0 comments
trafficstars

Preflight checklist

Ory Network Project

No response

Describe your problem

It took me a lot of time to understand how exactly Expire() works on containers.

As codebase in source code Expire calls <container>/stop?t=<timeout> which stops container immediately. But somehow Expire() does not stop container and waits for timeout.

After some time I realized that it changes stop-signal from <container_stop_signal> to SIGWINCH on container start. It is where the magic happened and container not stopping on <container>/stop?t=<timeout>.

I think it is not good for 2 reasons.

  1. It breaks container lifecycle on stop.
  2. It is not obvious. Looks like black magic.

Related: https://github.com/ory/dockertest/pull/133

Describe your ideal solution

Instead of modifying the container’s stop-signal on start, use the Docker API’s built-in support for custom stop signals: <container>/stop?signal=SIGWINCH&t=<timeout> for the Expire() functionality.

Reference: https://docs.docker.com/reference/api/engine/version/v1.48/#tag/Container/operation/ContainerStop

Workarounds or alternatives

Version

v3.12.0

Additional Context

No response

ilyadt avatar May 21 '25 07:05 ilyadt