Skip to content
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

Snippet bot is exhausting memory in Cloud Functions #1134

Closed
JustinBeckwith opened this issue Nov 16, 2020 · 10 comments
Closed

Snippet bot is exhausting memory in Cloud Functions #1134

JustinBeckwith opened this issue Nov 16, 2020 · 10 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@JustinBeckwith
Copy link
Contributor

Seeing this in the logs today:

Error: memory limit exceeded. Function invocation was interrupted.

Search query for logs:

severity=ERROR
resource.labels.function_name="snippet_bot"
@JustinBeckwith JustinBeckwith added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Nov 16, 2020
@tmatsuo
Copy link
Contributor

tmatsuo commented Nov 16, 2020

Not 100% sure, but it seems like it is happening on few repos:

googleapis/google-api-python-client
and
googleapis/go-genproto

I'll try to debug the bot with my clone.

@tmatsuo
Copy link
Contributor

tmatsuo commented Nov 16, 2020

Hm, I'm buffled.

The bot works perfectly fine with a test PR:
googleapis/go-genproto#494

So it's not repo specific. Maybe the payloads are somehow corrupted and it causes some kind of infinite loop?

@tmatsuo
Copy link
Contributor

tmatsuo commented Nov 17, 2020

I think I spotted a PR which likely caused the memory death:
googleapis/go-genproto#493

3443 files were deleted in a single PR.

@tmatsuo tmatsuo added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Nov 17, 2020
@tmatsuo
Copy link
Contributor

tmatsuo commented Nov 17, 2020

Downgrading to P2 since it's not a widespread issue.

@tmatsuo
Copy link
Contributor

tmatsuo commented Nov 17, 2020

The bot is using parse-diff which accepts a string for the diff. We pass around the 75MB of string several times. I guess that the string is copied multiple times.

@JustinBeckwith
Copy link
Contributor Author

I bumped the function from 512MB to 1GB - let's do that, and keep an eye on the loggies

@tmatsuo
Copy link
Contributor

tmatsuo commented Nov 17, 2020

The other one is: googleapis/google-api-python-client#1059

2704 files affected. The diff is ~180MB.

@tmatsuo
Copy link
Contributor

tmatsuo commented Nov 17, 2020

The request for the above PR went through, amusingly it took 539 seconds (almost 9 minutes).

snippet_boturs0tuecwwy6 Function execution took 538793 ms, finished with status code: 200

@tmatsuo
Copy link
Contributor

tmatsuo commented Nov 17, 2020

Interestingly the go-genproto pr took about 10 seconds.

l5rfsoage2jn Function execution took 10902 ms, finished with status code: 200

This is because this PR only deletes the files whereas the other one modifies the files (and the bot is fetching all the files).

@tmatsuo
Copy link
Contributor

tmatsuo commented Nov 17, 2020

It's still possible that we'll see similar memory errors, but I feel good now because the bot can handle such significant PRs without dying now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants