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)
- Feature request: Prune Old Versions HOT 2
- Bug: `sam build` Ignores Files in dist/ Directory When Specified in .gitignore HOT 2
- Bug: DBProxyTargetGroup Creation is very slow when using SAM deploy HOT 3
- Bug: sam build - JSONDecodeError HOT 1
- Bug: `sam init` error: "could not clone repo" (non-zero exit status 128) HOT 10
- Bug: parsing Ref in template.json is incorrect HOT 3
- Bug: sam validate - UnexpectedRuleException HOT 5
- Bug: Numpy In Lambda Layer HOT 3
- Bug: sam pipeline bootstrap --oidc-provider gitlab with a custom gitlab url creates an identity provider with excessive `/` suffix HOT 4
- Bug: Serverless Api: Incorrect handling of !If statement HOT 3
- Feature request: Resolve AWS::Include transform intrinsic for DefinitionBody in validate HOT 2
- Bug: sam local invoke - InvalidParameterValueException HOT 1
- Bug: sam build can't check the JVM version on gradle >= v8.9 HOT 2
- Bug: Sam build hanging in github-actions HOT 3
- Feature request: Add `dotnet` BuildMethod in addition to `dotnet7` HOT 3
- Binary execution issues in SAM CLI container due to read-only file system HOT 3
- Bug: sam deploy started failing HOT 2
- --debug-port not working in SAM Local Invoke on Windows HOT 3
- SAM Build Not Mounting Lambda Code in `/var/task` During `sam local start api` on Windows HOT 2
- sam local start-api cannot parse lambda authorizer correctly HOT 2
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.