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

Dockerfile language server hangs #3347

Closed
willfrey opened this issue Dec 3, 2021 · 8 comments · Fixed by #3355
Closed

Dockerfile language server hangs #3347

willfrey opened this issue Dec 3, 2021 · 8 comments · Fixed by #3355

Comments

@willfrey
Copy link

willfrey commented Dec 3, 2021

I'm having the Dockerfile language server hang repeatedly. The only fix is for me to manually kill the process in a terminal.

Does this occur consistently? Yes
Repro steps:

  1. Start writing an instruction in a Dockerfile that requires two or more arguments, e.g.
# ...
COPY . .
# ...
  1. Watch the Dockerfile language server eat up 99% of the CPU

Version: 1.18.0
OS: darwin
OS Release: 21.1.0
Product: Visual Studio Code
Product Version: 1.62.3
Language: en

@rcjsuen
Copy link
Contributor

rcjsuen commented Dec 3, 2021

@willfrey Thanks for the bug report. Something similar was reported a few weeks back in #3312 but the other person could not reproduce it anymore. Given that we're not seeing widespread reports of this and a Dockerfile with an instruction that has two arguments are a dime a dozen (like your example, a lot of people use COPY to move source code and build artifacts around), I'm not sure it is purely contingent on just an instruction that has two arguments.

Would you be able to share the following information?

  1. Please attach a screenshot that shows the 99% CPU usage. Since you are on macOS I presume you were observing this via Activity Monitor?
  2. Please share a complete copy of your Dockerfile so I can try to open it and reproduce the problem.

Thank you for your assistance.

@willfrey
Copy link
Author

willfrey commented Dec 6, 2021

@rcjsuen Thanks for the reply!

It seems to be better behaved today but I will keep an eye out for if it acts up again. If it does, I'll follow up on here.

@bwateratmsft
Copy link
Collaborator

I guess I'll close this for now, please let us know if it reoccurs @willfrey! Thanks!

@willfrey
Copy link
Author

willfrey commented Dec 7, 2021

@rcjsuen @bwateratmsft It's happening 🙃

# syntax=docker/dockerfile:1.3-labs

ARG PYTHON_VERSION=3.9.9
ARG POETRY_VERSION=1.1.12

FROM python:${PYTHON_VERSION} AS python

FROM python AS poetry
SHELL [ "/bin/bash", "-o", "pipefail", "-c" ]
ARG POETRY_VERSION
RUN <<EOF
curl --silent --show-error --location https://install.python-poetry.org | PYTHONUSERBASE=/usr/local XDG_DATA_HOME=/usr/local/libexec python3 -
rm --recursive /root/.cache
EOF
CMD [ "/bin/sh" ]

WORKDIR /
FROM poetry AS requirements
WORKDIR /var/tmp
COPY pyproject.toml poetry.lock ./
RUN poetry export --output /requirements.txt --without-hashes
WORKDIR /

FROM poetry AS build
WORKDIR /var/tmp
COPY pyproject.toml poetry.lock README.md ./
COPY src src
RUN <<EOF
python3 -m venv .venv && poetry build --format wheel
mv dist/*.whl /
rm --recursive .venv dist
EOF
WORKDIR /

Screen Shot 2021-12-07 at 5 50 27 PM
Screen Shot 2021-12-07 at 5 49 27 PM
Screen Shot 2021-12-07 at 5 52 48 PM

@rcjsuen
Copy link
Contributor

rcjsuen commented Dec 7, 2021

@willfrey Thanks for the screenshots and Dockerfile! WIll investigate...

@rcjsuen
Copy link
Contributor

rcjsuen commented Dec 7, 2021

@willfrey I've opened rcjsuen/dockerfile-language-service#99 to track this. The issue seems to be contingent on your build stage being the same name as an image.

Instead of...

FROM python:${PYTHON_VERSION} AS python

...if you change it to something like...

FROM python:${PYTHON_VERSION} AS python-base

....or anything else, it should be fine.

Thank you so much for reporting this. Have a great day! :)

@willfrey
Copy link
Author

willfrey commented Dec 8, 2021

Interesting! Thank you for the workaround 🙂

@bwateratmsft
Copy link
Collaborator

This is now released in Docker extension version 1.19.0.

@microsoft microsoft locked and limited conversation to collaborators Jan 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants