Coder Social home page Coder Social logo

Comments (17)

anki-code avatar anki-code commented on May 24, 2024

Is there a way to repeat this?

from xonsh.

clstaudt avatar clstaudt commented on May 24, 2024

I am not sure what changed for the crash to appear.

The crashing version is

➤ xonsh.version
'0.14.2'

from xonsh.

Qyriad avatar Qyriad commented on May 24, 2024

Does it happen consistently for you though?

from xonsh.

clstaudt avatar clstaudt commented on May 24, 2024

It happens often enough so that I had to switch my shell back to fish. But not reproducible, I don't know what exactly triggers the crash.

from xonsh.

anki-code avatar anki-code commented on May 24, 2024

Please add the xonfig command output.

from xonsh.

clstaudt avatar clstaudt commented on May 24, 2024
➤ xonfig
+------------------+---------------------+
| xonsh            | 0.14.2              |
| Python           | 3.12.0              |
| PLY              | 3.11                |
| have readline    | True                |
| prompt toolkit   | 3.0.41              |
| shell type       | prompt_toolkit      |
| history backend  | json                |
| pygments         | 2.17.2              |
| on posix         | True                |
| on linux         | False               |
| on darwin        | True                |
| on windows       | False               |
| on cygwin        | False               |
| on msys2         | False               |
| is superuser     | False               |
| default encoding | utf-8               |
| xonsh encoding   | utf-8               |
| encoding errors  | surrogateescape     |
| xontrib          | []                  |
| RC file 1        | /Users/cls/.xonshrc |
+------------------+---------------------+

from xonsh.

mltucker avatar mltucker commented on May 24, 2024

I have also started getting this error after a recent update (installed via homebrew on an m1 macbook). In my case it's not the ctrl+c interrupt that seems to be the problem, but just now and then running a command (most recently git diff HEAD and even ls ~/Library/Logs/Homebrew) will just hang for 10 seconds before I cancel it with ctrl+c (though it will hang for hours if left alone). Then I'll get a similar stack trace like @clstaudt and then I'll restart xonsh.

Mostly this happened to me within tmux, but I was also able to reproduce it in a new Terminal.app window without tmux.

from xonsh.

anki-code avatar anki-code commented on May 24, 2024

Hi @mltucker! I'm also mac m1 user and xonsh installed from conda and everything is perfect for me. Could you please alsoo paste the xonfig output.

from xonsh.

mltucker avatar mltucker commented on May 24, 2024

@anki-code

+------------------+-------------------+
| xonsh            | 0.14.3            |
| Python           | 3.12.1            |
| PLY              | 3.11              |
| have readline    | True              |
| prompt toolkit   | 3.0.41            |
| shell type       | prompt_toolkit    |
| history backend  | json              |
| pygments         | 2.17.2            |
| on posix         | True              |
| on linux         | False             |
| on darwin        | True              |
| on windows       | False             |
| on cygwin        | False             |
| on msys2         | False             |
| is superuser     | False             |
| default encoding | utf-8             |
| xonsh encoding   | utf-8             |
| encoding errors  | surrogateescape   |
| xontrib          | []                |
| RC file 1        | /Users/m/.xonshrc |
+------------------+-------------------+

I use zoxide but otherwise my xonshrc is barebones.

from xonsh.

anki-code avatar anki-code commented on May 24, 2024

Thanks @mltucker ! I'm using py 3.11 but you and the reporter are on 3.12. Maybe this is an upstream issue around prompt-toolkit and asyncio on 3.12. It will be cool to have a try to repeat this issue on 3.11 to confirm this.

from xonsh.

mltucker avatar mltucker commented on May 24, 2024

@anki-code it's very strange because my python --version gives me 3.11.7 and brew edit xonsh says it depends on [email protected]. I see that I have both 3.11 and 3.12 installed. I can't uninstall [email protected] since "it is required by llvm and xonsh, which are currently installed". Is there a way I can tell xonsh which python to use?

from xonsh.

anki-code avatar anki-code commented on May 24, 2024

@mltucker please read the section about xonsh and package managers to understand how it works. Read as much as possible examples after this section.

from xonsh.

mltucker avatar mltucker commented on May 24, 2024

@anki-code thanks! I've uninstalled xonsh from homebrew and instead now run it from conda3. I believe I'm seeing the same issue, though now it looks a bit different. Sometimes commands (most recently git add -p) will just hang. Ctrl+C closes the tmux window instead of quitting the process and showing the error message that @clstaudt reported above (which I used to also see). I will report back.

from xonsh.

mltucker avatar mltucker commented on May 24, 2024

@anki-code OK, I reproduced it again and this time recorded my screen. Just for a frame or two the error message popped up. Here's a screenshot:

image

Possibly the reason the message briefly flashed and closed my terminal window is that instead of fixing my path issues, I made a script /usr/local/bin/xonsh with:

#!/bin/bash

/opt/miniconda3/bin/xonsh $@

Here's my xonfig, this time with python 3.11:

+------------------+-------------------+
| xonsh            | 0.14.4            |
| Python           | 3.11.7            |
| PLY              | 3.11              |
| have readline    | True              |
| prompt toolkit   | 3.0.42            |
| shell type       | prompt_toolkit    |
| history backend  | json              |
| pygments         | 2.17.2            |
| on posix         | True              |
| on linux         | False             |
| on darwin        | True              |
| on windows       | False             |
| on cygwin        | False             |
| on msys2         | False             |
| is superuser     | False             |
| default encoding | utf-8             |
| xonsh encoding   | utf-8             |
| encoding errors  | surrogateescape   |
| xontrib          | []                |
| RC file 1        | /Users/m/.xonshrc |
+------------------+-------------------+

from xonsh.

anki-code avatar anki-code commented on May 24, 2024

Weird error with asyncio.

I made a script /usr/local/bin/xonsh

It's not needed if you're doing right. Basically if you want to just have a shell you can install xonsh from brew's python via pip and have it in PATH:

# zsh
cat ~/.zshrc | grep brew
# eval "$(/opt/homebrew/bin/brew shellenv)"

which xonsh 
# /opt/homebrew/bin/xonsh

which python
# /opt/homebrew/bin/python

python -V
# Python 3.11.6

xonsh
[p for p in $PATH if 'brew/bin' in p]
# ['/opt/homebrew/bin']

This allows to run xonsh from zsh.

from xonsh.

anki-code avatar anki-code commented on May 24, 2024

OR if you're using conda:

conda activate base

[p for p in $PATH if 'conda' in p]
# /Users/user/miniconda3/bin

wooooooooooow
during I prepared the example to you I found that after conda activate base the Ctrl+C command hangs the terminal.
It's soooooo weird :)

Yeah, I can repeat this with this stack:

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/xonsh/procs/posix.py", line 310, in _signal_int
    signal.pthread_kill(threading.get_ident(), signal.SIGINT)
  File "/opt/homebrew/lib/python3.11/site-packages/xonsh/procs/posix.py", line 310, in _signal_int
    signal.pthread_kill(threading.get_ident(), signal.SIGINT)
  File "/opt/homebrew/lib/python3.11/site-packages/xonsh/procs/posix.py", line 310, in _signal_int
    signal.pthread_kill(threading.get_ident(), signal.SIGINT)
  [Previous line repeated 994 more times]
  File "/opt/homebrew/lib/python3.11/site-packages/xonsh/procs/posix.py", line 309, in _signal_int
    if xt.on_main_thread() and not xp.ON_WINDOWS:
       ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/xonsh/tools.py", line 1234, in on_main_thread
    return threading.current_thread() is threading.main_thread()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1461, in current_thread
    return _active[get_ident()]
                   ^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded while calling a Python object

I can't repeat this on xonsh --no-rc

from xonsh.

anki-code avatar anki-code commented on May 24, 2024

I found that issue appeared starting from prompt-toolkit 3.0.41 where asyncio was introduced (prompt-toolkit/python-prompt-toolkit@8c60193).

To fix this just downgrade the prompt-toolkit version:

xpip uninstall -y prompt-toolkit
xpip install prompt-toolkit==3.0.40

The issue was reported to upstream - prompt-toolkit/python-prompt-toolkit#1853

from xonsh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.