Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser pods not termitating #429

Open
yurii-kryvosheia opened this issue Aug 9, 2024 · 9 comments
Open

Browser pods not termitating #429

yurii-kryvosheia opened this issue Aug 9, 2024 · 9 comments

Comments

@yurii-kryvosheia
Copy link

We are noticing numerous Chrome browser pods that are left running without termination.

Steps to reproduce:

  1. Run tests
  2. Wait for the browser pods to appear
  3. Restart the moon pod using the command kubectl -n moon rollout restart deployment moon or delete the pods.
  4. Stop tests

If you repeat these steps from the beginning, you will see an increasing number of idle, unterminated pods that need to be manually deleted. These pods are visible in the UI.

@aandryashin
Copy link
Member

aandryashin commented Aug 9, 2024 via email

@yurii-kryvosheia
Copy link
Author

@aandryashin
What if we don't have "defender" container? 🤔 Just a "ca-certs" and a "browser".

@aandryashin
Copy link
Member

aandryashin commented Aug 9, 2024 via email

@yurii-kryvosheia
Copy link
Author

Here's the values for the moon2 chart, version 2.7.1. Nothing fancy.

    licenseSecretName: moon-license
    deployment:
      experimentalUI: true
      nodeSelector:
        scope: "moon"
      tolerations:
        - key: "Moon"
          operator: "Equal"
          value: "true"
          effect: "NoSchedule"

    customIngress:
      enabled: true
      annotations:
        alb.ingress.kubernetes.io/target-type: ip
        alb.ingress.kubernetes.io/healthcheck-path: /ui/
        alb.ingress.kubernetes.io/success-codes: 200,201,404
        alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]'
      ingressClassName: "ops"
      host: "moon.domain.com"
      paths:
        - path: /wd/hub
          port: 4444
        - path: /playwright
          port: 4444
        - path: /devtools
          port: 4444
        - path: /api
          port: 9090
        - path: /ui
          port: 9090
    ingress:
      enabled: false

    browsers:
      default:
        annotations:
          karpenter.sh/do-not-disrupt: "true"
        nodeSelector:
          scope: "moon"
        tolerations:
          - key: "Moon"
            operator: "Equal"
            value: "true"
            effect: "NoSchedule"

And that's how browser pod looks like
image
What could possibly be the issue?

@aandryashin
Copy link
Member

aandryashin commented Aug 9, 2024 via email

@yurii-kryvosheia
Copy link
Author

Playwright pods are terminated when client connection to moon closed

Based on your response, if I terminate the moon pods, the connection is closed so browser pods should terminate. However, this is not happening.

@aandryashin
Copy link
Member

aandryashin commented Aug 9, 2024 via email

@yurii-kryvosheia
Copy link
Author

The whole point of the issue is that moon doesn't terminate the browser pods whose tests are completed even after 5 minutes timeout.

@vania-pooh
Copy link
Member

@yurii-kryvosheia you don't get what we are trying to explain. In Selenium every command is a separate HTTP request, so the only way to detect browser pods idle for a long time is measuring time between HTTP request. This is where timeout comes into play. In Playwright \ Puppeteer things are working completely differently. All commands are being transferred through one permanent web-socket connection. This connection is closed when Playwright tests finish. Moon is watching such connections and automatically deletes such pods. Two possible reasons why this could not happen are:

  1. Connection is not really closed, because of frozen CI builds. Just check that node.js processes do not remain alive.
  2. Connection is closed on load balancer (so test considers everything went good) but not closed between load balancer and Moon. This is rare, but also possible.
  3. There is an issue deleting browser pods via Kubernetes API. To check this version - try to filter Moon logs by pod id:
$ kubectl logs -lapp=moon -c moon -n moon 2>&1 | grep playwright-chrome-XXXX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants