Open Bug 1856589 Opened 2 years ago Updated 5 months ago

mach try --push-to-lando leaves repo in an unclean state if terminated early (ctrl-c / error)

Categories

(Conduit :: Lando, defect)

Production
Desktop
macOS
defect

Tracking

(Not tracked)

REOPENED

People

(Reporter: Gijs, Assigned: sheehan)

References

(Blocks 1 open bug)

Details

STR:

  1. run ./mach try --push-to-lando
  2. futz up your auth0 thingy. Once you "use" the code once, you can't retry. And ./mach try just sits on the commandline with "Waiting...................". There doesn't appear to be any way of getting another code other than exiting and re-running the command
  3. give up and ctrl-c on the commandline

ER:

repo is clean

AR:

% hg st
! try_task_config.json

I had to manually revert this before I could try again.

This is a problem with the existing VCS pushing to try as well, though I suppose we are more likely to hit it due to the Auth0 user interaction required after the try_task_config.json is created. I have a fix for this incoming.

Assignee: nobody → sheehan
Duplicate of this bug: 1859621
Summary: mach try --push-to-lando leaves repo in an unclean state when ctrl-c'd → mach try --push-to-lando leaves repo in an unclean state if terminated early (ctrl-c / error)

I tried to reproduce this today using the STR on a Mercurial repo (start mach try fuzzy, select some tasks, <C-c> while waiting for interaction in the browser) but it seems try_task_config.json is no longer marked as a missing file. On the Git side, glandium's work in bug 1500188 causes the try commit to never make it into the VCS, so this is no longer an issue there.

Closing this out since I think it has been resolved since the bug was opened, please re-open if I am mistaken.

Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED

Looks like this was resolved by bug 1905493.

Duplicate of bug: 1905493
Resolution: FIXED → DUPLICATE

I am hitting this today after requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: https://api.lando.services.mozilla.com/try/patches. After this, the try commit that was created is the current HEAD, and try_task_config.json has been removed in the working dir only. Output when this happens:

apehrson@apehrson-42665 m-c-2 % ./mach try again
estimates: Runs 88 tasks (50 selected, 38 dependencies)
estimates: Total task duration 16:07:44
estimates: In the shortest 49% of durations
estimates: Should take about 1:53:02 (Finished around 2025-01-20 15:20)
Note: `--push-to-lando` is now the default behaviour of `mach try`.
Note: Use `--push-to-vcs` to push changes to try directly.
Auth0 token validated.
Using 5904a2d552f20438e7ad97da0c18095bc3598190 as the hg base commit.
Submitting stack of 21 nodes and the try commit.
Patches gathered for submission.
Submitting patches to Lando.
Error running mach:

    mach try again

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke ``./mach busted`` to check if this issue is already on file. If it
isn't, please use ``./mach busted file try`` to report it. If ``./mach busted`` is
misbehaving, you can also inspect the dependencies of bug 1543241.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

requests.exceptions.HTTPError: 502 Server Error: Bad Gateway for url: https://api.lando.services.mozilla.com/try/patches

  File "/Users/apehrson/Dev/m-c-2/tools/tryselect/mach_commands.py", line 379, in try_again
    return run(command_context, **kwargs)
  File "/Users/apehrson/Dev/m-c-2/tools/tryselect/mach_commands.py", line 174, in run
    return mod.run(**kwargs)
           ~~~~~~~^^^^^^^^^^
  File "/Users/apehrson/Dev/m-c-2/tools/tryselect/selectors/again.py", line 149, in run
    return push_to_try(
        "again", message.format(msg=msg), try_task_config=try_task_config, **pushargs
    )
  File "/Users/apehrson/Dev/m-c-2/tools/tryselect/push.py", line 267, in push_to_try
    push_to_lando_try(vcs, commit_message, changed_files)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/apehrson/Dev/m-c-2/tools/tryselect/lando.py", line 434, in push_to_lando_try
    response_json = lando_api.post_try_push_patches(
        patches, patch_format, base_commit
    )
  File "/Users/apehrson/Dev/m-c-2/tools/tryselect/lando.py", line 391, in post_try_push_patches
    response_json = self.post(self.lando_try_api_url, request_json_body)
  File "/Users/apehrson/Dev/m-c-2/tools/tryselect/lando.py", line 360, in post
    response.raise_for_status()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/apehrson/Dev/m-c-2/third_party/python/requests/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)

Sentry event ID: 0689414c529c47b88381c270fe125141

(In reply to :Gijs (he/him) from comment #0)

STR:

% hg st
! try_task_config.json

The ! means the file was deleted but is still tracked. I.e. not only did the script leave the try commit behind, but it also created a local diff to it preventing a simple hg prune -r .. I see the same output for my issue hitting an error.

Bug 1905493 cannot have fixed this because it only adds a path to removing that file in an untracked manner. I thought it was the cause here but since this bug exists and predates bug 1905493, the issue must have existed before then as well.

If I ctrl+c once ./mach try again says Auth0 token validated. I can reproduce the original issue, but in addition to the 502 Server Error: Bad Gateway issue, the try commit has been removed. It's a weird state where hg status says the file is tracked but removed, and no other command I tried acknowledges the file (blame, log). This on macOS with hg 6.8.1. hg rm try_task_config.json fixes this state.

Status: RESOLVED → REOPENED
No longer duplicate of bug: 1905493
Resolution: DUPLICATE → ---
You need to log in before you can comment on or make changes to this bug.