Comments (11)
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.
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.
That fixed it!
from aws-sam-cli.
Patch is released in v1.118.0. Closing
from aws-sam-cli.
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.
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.
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.
@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.
@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.
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.
Sure, I can run a development version.
And yes, I use the official installers.
from aws-sam-cli.
Related Issues (20)
- SAM build crashes using terraform HOT 9
- Bug: sam local start-api - AttributeError HOT 9
- SAM local invocation with CDK generated template with typescript not able to find module index (index.mjs) HOT 5
- How to add tags with sam deploy HOT 10
- Bug: Got issue when using 1.116.0_1 for deployment HOT 2
- Bug: [WinError 3] The system cannot find the path specified HOT 4
- Feature request: Deploy Lambdas with concurrency HOT 3
- Bug: sam build - EmptyKeyError HOT 1
- Bug: Unable to run sam local invoke on Apple Silicon HOT 14
- Cannot sam local start-api without specifying an image HOT 1
- Bug: sam local start-api - ReadTimeout HOT 3
- Bug: "Timed out while attempting to establish a connection to the container" error after fresh install of Docker and AWS SAM HOT 5
- Bug: sam build - JSONDecodeError HOT 1
- Bug: No new Lambda Versions are deployed with Lambda configurations changes HOT 2
- Bug: Change Parameter's Default value doesn't reflect HOT 4
- Bug: AWS ADOT LAMBDA layer stuck when using local invoke HOT 5
- Bug: AWS::Serverless::Function `ImageUri` with map (ex: using `!Sub`) fails with type error HOT 7
- Bug: Lambda function (with alias) doesn't create a new version after its layer is updated, even if `AutoPublishAliasAllProperties` is set to `true`
- Access to internal enterprise host (Github entreprise) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sam-cli.