-
Notifications
You must be signed in to change notification settings - Fork 471
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
SAM: slow build time when building multiple functions #2024
Comments
SAM CLI, version 1.31.0 |
I am getting this in info... But no template is getting generated at this path.. This is the verbose info |
It's taking 40 minutes to build? Also, what runtime is this? Currently, the build part of the process does not refresh the timeout timer, so it ends up timing out after the build unfortunately. Some additional logging output from the build step could be useful. In the meantime, you can bump the timeout time by looking for the setting |
I have already increased the timeout to 5 mins |
The timeout includes the build step as well. What exactly is taking so long with the build step? Log output during the build step would be helpful if it doesn't contain any sensitive info. |
Actually, if I try to run this command sam invoke manually through the AWS sam CLI, it works if I change the template path to project directory not build folder in temp. |
2021-09-13 11:53:07 [INFO]: 2021-09-13 11:53:07 [INFO]: Commands you can use next[] Invoke Function: sam local invoke -t ....\Users\divi\AppData\Local\Temp\aws-toolkit-vscode\vsctkoix4CJ\output\template.yaml 2021-09-13 11:53:08 [INFO]: 2021-09-13 11:53:08,006 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': 'c9c25f8a-53db-4fd3-9f6eaasdddf', 'installationId': '1a826a9e-a1b6-4433-a466-516974faa653', 'sessionId': '0099eec7-c7c4-4d57-be4d-eacfda4e810e', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.8', 'samcliVersion': '1.31.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'duration': 2646025, 'exitReason': 'success', 'exitCode': 0}}]} 2021-09-13 11:53:10 [INFO]: 2021-09-13 11:53:10,431 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=2) 2021-09-13 11:53:10 [INFO]: Build complete. Command stopped: "sam local invoke" |
I will not able to share many logs...Can it be an issue related to Telemetry? |
@JadenSimon 2021-09-14 23:51:20 [INFO]: 2021-09-14 23:51:20,866 | --base-dir is not presented, adjusting uri . relative to 2021-09-14 23:51:21 [INFO]: 2021-09-14 23:51:21,377 | Unique function build definition found, adding as new ( After this step its taking lot of time Every time i start debug, SAM: command exited (code: null): PID 2064: |
Unlikely, though we ought to be cleaning up errors rather than logging them like that.
Are they not being deleted? This is separate (but important) bug.
Ah this could be it. The 'Timeout while waiting for command' was throwing me off, making me think the timing was the issue. Just to be sure, the time between the start of the build and the start of Our support for |
More Info Also, I have one more system(not having access currently) on which I set it up 1 month ago, it's working perfectly fine on it....However, taking 40 mins on it...but at least I was able to debug it... Even the timeout was also not manipulated on that Something i found in template.yml |
This timeout is separate from the debugging timeout, so it wouldn't have an impact. Are you able to debug a basic SAM application? You can create one using the |
I think I made that silly mistake. You were right, I increased it from 5 minutes to 1 hour (3,600,000) and it worked... One last question 2021-09-15 00:37:07 [INFO]: 2021-09-15 00:37:07,130 | Copying artifacts from C:\Users\divi\AppData\Local\Temp\aws-toolkit-vscode\vsctk4l5CEL\output\aFunction to C:\Users\divi\AppData\Local\Temp\aws-toolkit-vscode\vsctk4l5CEL\output\bFunction So in order to copy every function, it takes around 1.5 min and I have 15 such function. |
Does it still take around ~40 min to build with just SAM CLI alone? This blog post has some parameters you can try. You can add them to the build command by adding "sam": {
"buildArguments": ["arg1", "arg2", "arg3"]
} If none of that works, it's possible that SAM CLI is unable to do any caching since we are creating temporary directories for each run/debug loop. So the toolkit might need to figure out a way to preserve build artifacts per user-workspace, or at least have this be configurable. |
Related: 5e522a7
We have plans to remove/avoid the need for the temporary directory. Related: #1988 |
As of now, I tried to keep only one function in template.yml, which I want to debug and now the performance is good. But facing another issue related to AWS X-RAY |
Could this issue be relevant? aws/aws-sam-cli#217 |
not relevant to this and I will try adding build arguments tomorrow. |
@JadenSimon @justinmk3 Stack Trace 021-09-18 04:03:25 [INFO]: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Looks related to the Toolkit's use of a temporary build dir #2050 |
A potential workaround may be to specify |
See this comment for how to use |
Describe the bug
I am trying to Debug using vs code and AWS toolkit .. when I click on debug it builds it successfully but when it calls sam invoke it tries to search it the built folder but is not able to find it there.
To Reproduce
Build the project, add the configuration in launch.json
and click on the debug
Expected behavior
I am not able to debug and it is taking 40 min in order to get to the error.
Screenshots
Desktop (please complete the following information):
OS: Windows
VS Code About
Version: 1.60.0 (system setup)
Commit: e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff
Date: 2021-09-01T10:41:52.311Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.18363
Toolktit Version: AWS Toolkit v1.29.0
Docer Version : v1.16.1
Additional context
The text was updated successfully, but these errors were encountered: