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

pyrasite-shell hangs on Arch Linux #75

Open
purboo opened this issue Sep 18, 2018 · 10 comments
Open

pyrasite-shell hangs on Arch Linux #75

purboo opened this issue Sep 18, 2018 · 10 comments

Comments

@purboo
Copy link

purboo commented Sep 18, 2018

It works pretty well on Ubuntu 18.04. However, when I run pyrasite-shell <pid> on Arch Linux, I got the following errors:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
0x00007f9e956f3197 in select () from /usr/lib/libc.so.6

'PyGILState_Ensure' has unknown return type; cast the call to its declared return type
'PyRun_SimpleString' has unknown return type; cast the call to its declared return type
History has not yet reached $1.

^CTraceback (most recent call last):
  File "/usr/bin/pyrasite-shell", line 11, in <module>
    load_entry_point('pyrasite==2.0', 'console_scripts', 'pyrasite-shell')()
  File "/usr/lib/python2.7/site-packages/pyrasite/tools/shell.py", line 30, in shell
    ipc.connect()
  File "/usr/lib/python2.7/site-packages/pyrasite/ipc.py", line 95, in connect
    self.wait()
  File "/usr/lib/python2.7/site-packages/pyrasite/ipc.py", line 151, in wait
    (clientsocket, address) = self.server_sock.accept()
  File "/usr/lib/python2.7/socket.py", line 206, in accept
    sock, addr = self._sock.accept()
KeyboardInterrupt

May I know how to resolve this issue? Thanks.

diamond-lizard pushed a commit to diamond-lizard/pyrasite that referenced this issue Oct 24, 2018
@diamond-lizard
Copy link

This change to injector.py fixed the issue for me.

@bertsky
Copy link

bertsky commented Feb 14, 2019

This appears to be detached from develop here. Is this by accident? Maybe @diamond-lizard should make a PR again?

@gdgrc
Copy link

gdgrc commented Mar 19, 2019

My python application is run by user A. When I try to use pyrasite-shell, it reminds me of running it by user root and I do that. Then, Permission denies comes out which means the application needed to be injected can not open the inject code( you can see the pyrasite code. it makes a tmp file by mkstemp which leads to only the creator can read this file. So, the application can not read.). Then I try to make pyrasite-shell run by user A . I fix it.

@irmatov
Copy link

irmatov commented Apr 12, 2019

@lmacken can you look into diamond-lizard@d1e2301 commit? It really helps to get pyrasite working on Ubuntu 18.04 too with some alternate python versions.

@darkvertex
Copy link

Hi @lmacken, found this issue while searching for the same error. Getting it on an Ubuntu 18.04 Docker container and the commit @irmatov mentions fixes it for me.

That said, Docker's default security policies don't allow ptrace, which is needed by gdb, which is needed by pyrasite. What made it work for me was to do RUN echo kernel.yama.ptrace_scope = 0 > /etc/sysctl.d/10-ptrace.conf in my Dockerfile at build time, then do my docker run call with --cap-add=SYS_PTRACE --security-opt seccomp=unconfined. I'm on Docker 19.03.2 btw.

@darkvertex
Copy link

By the way if anyone wants to pip-install the "fixed" version, remember pip supports installing from git repos, so you can point it to the fixed fork like so:

pip install git+https://github.com/diamond-lizard/pyrasite.git

@marlemion
Copy link

marlemion commented Feb 20, 2021

Still does not work on recent arch. Installed both pip pyrasite and the git version. gdb is also installed. Cannot connect to any of my running python processes:

 pyrasite-shell 2987678
^CTraceback (most recent call last):
  File "/usr/bin/pyrasite-shell", line 33, in <module>
    sys.exit(load_entry_point('pyrasite==2.0', 'console_scripts', 'pyrasite-shell')())
  File "/usr/lib/python3.9/site-packages/pyrasite/tools/shell.py", line 30, in shell
    ipc.connect()
  File "/usr/lib/python3.9/site-packages/pyrasite/ipc.py", line 95, in connect
    self.wait()
  File "/usr/lib/python3.9/site-packages/pyrasite/ipc.py", line 151, in wait
    (clientsocket, address) = self.server_sock.accept()
  File "/usr/lib/python3.9/socket.py", line 293, in accept
    fd, addr = self._accept()
KeyboardInterrupt

gdb version is 10.1

@vkomarov-r7
Copy link

vkomarov-r7 commented Aug 23, 2021

Tried to run it as well, got the following output after enabling verbose mode:

[New LWP 31]
[New LWP 32]
[New LWP 442]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f6cff8e3aff in __GI___poll (fds=0x7fff888d4308, nfds=1, timeout=60000) at ../sysdeps/unix/sysv/linux/poll.c:29
[Inferior 1 (process 1) detached]

29\t../sysdeps/unix/sysv/linux/poll.c: No such file or directory.
'PyGILState_Ensure' has unknown return type; cast the call to its declared return type
'PyRun_SimpleString' has unknown return type; cast the call to its declared return type
History has not yet reached $1.

@mikeeastin
Copy link

Still does not work on recent arch. Installed both pip pyrasite and the git version. gdb is also installed. Cannot connect to any of my running python processes:

 pyrasite-shell 2987678
^CTraceback (most recent call last):
  File "/usr/bin/pyrasite-shell", line 33, in <module>
    sys.exit(load_entry_point('pyrasite==2.0', 'console_scripts', 'pyrasite-shell')())
  File "/usr/lib/python3.9/site-packages/pyrasite/tools/shell.py", line 30, in shell
    ipc.connect()
  File "/usr/lib/python3.9/site-packages/pyrasite/ipc.py", line 95, in connect
    self.wait()
  File "/usr/lib/python3.9/site-packages/pyrasite/ipc.py", line 151, in wait
    (clientsocket, address) = self.server_sock.accept()
  File "/usr/lib/python3.9/socket.py", line 293, in accept
    fd, addr = self._accept()
KeyboardInterrupt

gdb version is 10.1

anyone fix this ?

@luochen1990
Copy link

Any one who is collaborator can help to click this:

https://github.com/lmacken/pyrasite/compare/lmacken:develop...diamond-lizard:develop?expand=1

I'm trying to create a merge request, but failed with:

Pull request creation failed. Validation failed: must be a collaborator

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

10 participants