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

Unexpected run state encountered #65

Open
vsajip opened this issue Jul 5, 2022 · 3 comments
Open

Unexpected run state encountered #65

vsajip opened this issue Jul 5, 2022 · 3 comments

Comments

@vsajip
Copy link
Member

vsajip commented Jul 5, 2022

When trying to backport this PR, miss-islington failed and advised running cherry_picker from the CLI. When running

cherry_picker 067597522a9002f3b8aff7f46033f10acb2381e4 3.11

It failed with this traceback:

~/projects/cpython/3.11 [3.11|✔] $ Doc/venv/bin/cherry_picker 067597522a9002f3b8aff7f46033f10acb2381e4 3.11
🐍 🍒 ⛏
Now backporting '067597522a9002f3b8aff7f46033f10acb2381e4' into '3.11'
[backport-0675975-3.11 5beb16b77f] gh-92897: Ensure `venv --copies` respects source build property of the creating interpreter (GH-92899)
 Author: Jeremy Kloth <[email protected]>
 Date: Tue Jul 5 10:08:20 2022 -0500
 5 files changed, 76 insertions(+), 40 deletions(-)

Backport PR URL:
https://github.com/python/cpython/compare/3.11...vsajip:backport-0675975-3.11?expand=1
Traceback (most recent call last):
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/bin/cherry_picker", line 8, in <module>
    sys.exit(cherry_pick_cli())
             ^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 645, in cherry_pick_cli
    cherry_picker.backport()
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 400, in backport
    self.cleanup_branch(cherry_pick_branch)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 361, in cleanup_branch
    self.checkout_default_branch()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 226, in checkout_default_branch
    self.run_cmd(cmd)
    ^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.11/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 181, in run_cmd
    output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vinay/.local/lib/python3.12/subprocess.py", line 454, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vinay/.local/lib/python3.12/subprocess.py", line 558, in run
    raise CalledProcessError(retcode, process.args,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subprocess.CalledProcessError: Command '('git', 'checkout', 'main')' returned non-zero exit status 128.

Now I was in the 3.11 branch so I'm not sure it should be doing a git checkout main. But anyway, the PR was created (in that it opened the "Create pull request" page in the browser, which I clicked to confirm - the PR is here. But if I now try to do the same thing for 3.10, I get

~/projects/cpython/3.10 [3.10|✔] $ Doc/venv/bin/cherry_picker 067597522a9002f3b8aff7f46033f10acb2381e4 3.10
🐍 🍒 ⛏
Usage: cherry_picker [OPTIONS] [COMMIT_SHA1] [BRANCHES]...
Try 'cherry_picker -h' for help.

Error: Run state cherry-picker.state=CHECKING_OUT_DEFAULT_BRANCH in Git config is not known.
Perhaps it has been set by a newer version of cherry-picker. Try upgrading.
Valid states are: BACKPORT_PAUSED, UNSET. If this looks suspicious, raise an issue at https://github.com/python/cherry-picker/issues/new.
As the last resort you can reset the runtime state stored in Git config using the following command: `git config --local --remove-section cherry-picker`

I did git config --local --remove-section cherry-picker and tried again, but now I get

~/projects/cpython/3.10 [3.10|✔] $ git config --local --remove-section cherry-picker
~/projects/cpython/3.10 [3.10|✔] $ Doc/venv/bin/cherry_picker 067597522a9002f3b8aff7f46033f10acb2381e4 3.10
🐍 🍒 ⛏
Traceback (most recent call last):
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/bin/cherry_picker", line 8, in <module>
    sys.exit(cherry_pick_cli())
             ^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 645, in cherry_pick_cli
    cherry_picker.backport()
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 375, in backport
    self.fetch_upstream()
    ^^^^^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 173, in fetch_upstream
    self.run_cmd(cmd)
    ^^^^^^^^^^^^^^^^^
  File "/disk2/vinay/projects/cpython/3.10/Doc/venv/lib/python3.12/site-packages/cherry_picker/cherry_picker.py", line 181, in run_cmd
    output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vinay/.local/lib/python3.12/subprocess.py", line 454, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vinay/.local/lib/python3.12/subprocess.py", line 558, in run
    raise CalledProcessError(retcode, process.args,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subprocess.CalledProcessError: Command '['git', 'fetch', 'upstream', '--no-tags']' returned non-zero exit status 1.
@ezio-melotti
Copy link
Member

Now I was in the 3.11 branch so I'm not sure it should be doing a git checkout main

It looks like it successfully backported your PR, and while cleaning up and switching back to main (which is expected at this stage) an error occurred. That left miss-islington in an inconsistent state that you fixed with git config --local --remove-section cherry-picker.

I did git config --local --remove-section cherry-picker and tried again, but now I get

Not sure about this last traceback though. Maybe just network issues or GitHub being down?
It seems you were eventually able to create the PR -- did the same command succeed when you ran it a second time?

@vsajip
Copy link
Member Author

vsajip commented Jul 5, 2022

Yes, it did - perhaps it was a transient network issue. GitHub seemed generally fine - I was able to monitor the tests, close the issue once they completed etc. I just logged this issue to help fix whatever caused the inconsistent state to occur. You can close it if you don't need it for that purpose.

@ezio-melotti
Copy link
Member

I ran into errors in the past that required a git config --local --remove-section cherry-picker. Perhaps miss-islington should clean up after herself in case of failure, even though the current design might be intentional in case people want to complete the backport and/or clean up things manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants