Giter VIP home page Giter VIP logo

Comments (11)

mndeveci avatar mndeveci commented on June 22, 2024 2

I've added some logs and also an early return if we receive file open event. Can you pull this branch and test it on your side? https://github.com/mndeveci/aws-sam-cli/tree/add_logs_for_file_watchers

You need to create a python virtual environment with python3.11, activate it and run make init. After that, in that virtual environment, you should have samdev available. And you can try samdev sync ...{additional parameters}.

What I've seen so far, we are getting constant file opened event if you do touch template.yaml or vim template.yaml. And once we receive an event, we do load the file and do some comparison to decide whether we need to trigger an infra sync (deployment) or not. So loading that file and comparing it might be causing your high CPU usage.

Let me know if this branch fixes issue on your side, we can then move forward and raise a PR for the fix.

from aws-sam-cli.

mndeveci avatar mndeveci commented on June 22, 2024 1

Running touch template.yaml in another terminal also didn't trigger this issue on my side. I saw that you are using a linux OS (Ubuntu) I can try to reproduce it on that machine and get back to you.

from aws-sam-cli.

cshenrik avatar cshenrik commented on June 22, 2024 1

That fixed it!

from aws-sam-cli.

github-actions avatar github-actions commented on June 22, 2024 1

Patch is released in v1.118.0. Closing

from aws-sam-cli.

cshenrik avatar cshenrik commented on June 22, 2024

Found out that it is triggered by touch template.yaml. So whenever I open template.yaml in my vscode, sam sync will instantly consume all CPU. This renders sam sync --watch rather difficult to use.

from aws-sam-cli.

mndeveci avatar mndeveci commented on June 22, 2024

Hi @cshenrik thanks for reporting this issue.

Are you using any plugin in VSCode which might be changing the file constantly? We are listening to file change events which is published by OS, and we usually drop the ones which doesn't change the file (open event for instance).

I've quickly tested the scenario locally, but SAM CLI is not showing a high CPU usage like 100%.

from aws-sam-cli.

cshenrik avatar cshenrik commented on June 22, 2024

Hi @mndeveci,
I can reproduce the behaviour without VSCode running. Just using touch template.yaml while sam sync --watch --region us-east-1 is running.

from aws-sam-cli.

mndeveci avatar mndeveci commented on June 22, 2024

@cshenrik I've tried on a linux machine as well, however it doesn't spike the CPU usage. Are there any more details that can help us to re-produce the issue on our side?

from aws-sam-cli.

cshenrik avatar cshenrik commented on June 22, 2024

@mndeveci, I've tested it on older versions of sam-cli, and I found that it has been introduced in v1.97.0. I cannot reproduce it on earlier versions.

Let me know what I can do to help.

from aws-sam-cli.

mndeveci avatar mndeveci commented on June 22, 2024

Thanks for pinning the issue. I can see that we bumped the watchdog dependency to a major version which is used for listening file changes. I've quickly checked their repository but I couldn't find any relevant issue there.

We can add more debug logs to see which event is getting triggered with your setup, and use that information (to see which even is getting triggered and causing high cpu usage) to open an issue on their repo. Would you be able to run a development version of SAM CLI and try that with additional logs?

I forgot to ask but how do you install SAM CLI, are you using official installers or an alternative method?

from aws-sam-cli.

cshenrik avatar cshenrik commented on June 22, 2024

Sure, I can run a development version.

And yes, I use the official installers.

from aws-sam-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.