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)
- Add Rust support to aws cli --use-container builds HOT 1
- Cannot find module 'app' when using "hello world typescript" example HOT 10
- Bug: AWS::Serverless::Function ImageUri with function (ex: using !If) fails with type error HOT 3
- Bug: Template not rendered correctly HOT 4
- Why does aws-sam-cli not support debug mode on os runtime (provided.al2 / provided.al2023)? HOT 4
- Bug: sam local start-api fails to initialise lambda function containers within podman/toolbox container HOT 4
- Feature request: support Finch HOT 2
- Bug: sam local invoke - SSLError HOT 2
- start-api debug port failure HOT 1
- start-api debug port fails HOT 5
- Bug: `sam local invoke` takes client environment variable value over defined value in template.yaml HOT 3
- Sam build with project references in adjacent directory (.NET8 NativeAOT) HOT 4
- `sam sync` with typescript not updating Lambda layer code in Lambda function HOT 5
- Bug: Docker 4.33 + Provided.al2 Image error HOT 9
- Bug: SAM Deployment Issue: Bootstrap File Not Found Despite Successful Build and Upload HOT 1
- Bug: sam pipeline init - ResourceNotFoundException HOT 1
- Bug: Official example for CDK is not working HOT 1
- Bug: Runtime.ImportModuleError for Typescript Lambda function defined using CDK HOT 2
- Feature request: Run Node tests as part of sam build HOT 1
- Bug: sam build --container-env-var is not working 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.