Skip to content

Handle Errno::EPERM errors when composing bundle #3698

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

egiurleo
Copy link
Contributor

@egiurleo egiurleo commented Jul 30, 2025

Motivation

We have Errno::EPERM errors being reported on telemetry when the server attempts to compose the bundle. This happens when the user's environment does not have permissions to read their Gemfile.lock.

Implementation

This rescues the error and then returns from the compose_bundle method as we likely do not have sufficient permissions to finish.

Automated Tests

I've added an automated test.

Copy link
Contributor Author

egiurleo commented Jul 30, 2025


How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@egiurleo egiurleo force-pushed the ignore-operation-not-permitted branch from bc30fa2 to d638388 Compare July 30, 2025 20:20
@egiurleo egiurleo marked this pull request as ready for review July 30, 2025 20:21
@egiurleo egiurleo requested a review from a team as a code owner July 30, 2025 20:21
@egiurleo egiurleo added server This pull request should be included in the server gem's release notes other Changes that aren't bugfixes, enhancements or breaking changes labels Jul 30, 2025
@@ -1388,6 +1388,9 @@ def compose_bundle(message)
rescue Bundler::LockfileError => e
send_message(Error.new(id: id, code: BUNDLE_COMPOSE_FAILED_CODE, message: e.message))
return
rescue Errno::EPERM
# If the user doesn't have permission to perform read operations, we can't compose the bundle
return
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if it makes sense to return here -- my understanding is we can't compose the bundle without more permissions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will depend on why we're getting the permission issue. When you invoke Bundler.default_lockfile, it will keep searching for a Gemfile and Gemfile.lock pair in parent directories until it reaches home.

Are we 100% sure that the permission issue is coming from reading the lockfile and not from trying to read the parent directories?

The issue could be that there's simply no bundle in the project and the user didn't give permissions to the editor for accessing any of the parent directories. In that case, returning early would not be correct because we can still compose the bundle as long as there's no lockfile and the user has permissions for the current directory.

@egiurleo egiurleo requested review from alexcrocha and vinistock July 30, 2025 20:23
Base automatically changed from ignore-network-down-error to main July 30, 2025 21:08
Some of these errors have been reported to our telemetry. For now, it makes
sense to rescue the error and ignore it because it means that the user's
environment does not have permissions to read their lockfile, which means
we can't compose the bundle.
@egiurleo egiurleo changed the base branch from main to graphite-base/3698 July 31, 2025 14:23
@egiurleo egiurleo force-pushed the ignore-operation-not-permitted branch from d638388 to f0b38fd Compare July 31, 2025 14:23
@egiurleo egiurleo changed the base branch from graphite-base/3698 to ignore-http-error July 31, 2025 14:23
Base automatically changed from ignore-http-error to main July 31, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
other Changes that aren't bugfixes, enhancements or breaking changes server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants