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

Segfault with psutil.net_connections() #512

Closed
wowi42 opened this issue Jun 10, 2014 · 8 comments
Closed

Segfault with psutil.net_connections() #512

wowi42 opened this issue Jun 10, 2014 · 8 comments

Comments

@wowi42
Copy link

wowi42 commented Jun 10, 2014

Hi
I have a little segfault with psutil on FreeBSD 10 :

wowi@wowi.io:/root# uname -a
FreeBSD wowi.io 10.0-RELEASE-p3 FreeBSD 10.0-RELEASE-p3 #0: Tue May 13 18:31:10 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
wowi@wowi.io:/root# python
Python 2.7.6 (default, May 15 2014, 18:58:42)
[GCC 4.2.1 Compatible FreeBSD Clang 3.3 (tags/RELEASE_33/final 183502)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.net_connections()
Segmentation fault (core dumped)

Python come directly from pkg, and psutil version is 2.1.1
Peace

@giampaolo
Copy link
Owner

Sorry for replying so late. I've never bumped into this issue. As such the only thing I can suggest is to try to debug the problem yourself and post here in case you collect some useful information.

@lucien2k
Copy link

I've run into the same problem myself with python2.7.9 on freebsd 10.

It threw these warnings while installing via pip:
Collecting psutil
Using cached psutil-2.2.1.tar.gz
Installing collected packages: psutil
Running setup.py install for psutil
building '_psutil_bsd' extension
cc -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -DNDEBUG -fPIC -DPSUTIL_VERSION=221 -I/usr/local/include/python2.7 -c psutil/_psutil_bsd.c -o build/temp.freebsd-10.1-RELEASE-p5-amd64-2.7/psutil/_psutil_bsd.o
psutil/_psutil_bsd.c:106:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
psutil/_psutil_bsd.c:1160:44: warning: field precision should have type 'int', but argument has type 'unsigned long' [-Wformat]
path, sizeof(path), "%._s",
~~^~
psutil/_psutil_bsd.c:2004:41: warning: field precision should have type 'int', but argument has type 'unsigned long' [-Wformat]
snprintf(path, sizeof(path), "%._s",
~~^~
3 warnings generated.
cc -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -DNDEBUG -fPIC -DPSUTIL_VERSION=221 -I/usr/local/include/python2.7 -c psutil/_psutil_common.c -o build/temp.freebsd-10.1-RELEASE-p5-amd64-2.7/psutil/_psutil_common.o
cc -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -DNDEBUG -fPIC -DPSUTIL_VERSION=221 -I/usr/local/include/python2.7 -c psutil/arch/bsd/process_info.c -o build/temp.freebsd-10.1-RELEASE-p5-amd64-2.7/psutil/arch/bsd/process_info.o
cc -shared -pthread -Wl,-rpath,/usr/lib:/usr/local/lib -Wl,-rpath=/usr/lib:/usr/local/lib -fstack-protector build/temp.freebsd-10.1-RELEASE-p5-amd64-2.7/psutil/_psutil_bsd.o build/temp.freebsd-10.1-RELEASE-p5-amd64-2.7/psutil/_psutil_common.o build/temp.freebsd-10.1-RELEASE-p5-amd64-2.7/psutil/arch/bsd/process_info.o -L/usr/local/lib -ldevstat -lpython2.7 -o build/lib.freebsd-10.1-RELEASE-p5-amd64-2.7/_psutil_bsd.so
building '_psutil_posix' extension
cc -fno-strict-aliasing -O2 -pipe -fstack-protector -fno-strict-aliasing -DNDEBUG -fPIC -I/usr/local/include/python2.7 -c psutil/_psutil_posix.c -o build/temp.freebsd-10.1-RELEASE-p5-amd64-2.7/psutil/_psutil_posix.o
cc -shared -pthread -Wl,-rpath,/usr/lib:/usr/local/lib -Wl,-rpath=/usr/lib:/usr/local/lib -fstack-protector build/temp.freebsd-10.1-RELEASE-p5-amd64-2.7/psutil/_psutil_posix.o -L/usr/local/lib -lpython2.7 -o build/lib.freebsd-10.1-RELEASE-p5-amd64-2.7/_psutil_posix.so
Successfully installed psutil-2.2.1

Python 2.7.9 (default, Jan 28 2015, 05:37:45)
[GCC 4.2.1 Compatible FreeBSD Clang 3.3 (tags/RELEASE_33/final 183502)] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.

import psutil
psutil.net_connections()
Segmentation fault (core dumped)

@lucien2k
Copy link

Ok I did some more testing this morning.

The good news seems to be that its fixed in the master version. I tried 2.2.1 from pip and from source and both had the same seg fault issue, but using the master version I was able to use it correctly.

Based on the history of commits to the bsd files (and from glancing at the code), I suspect its this one fix: 5feb936

Thanks Giampaolo, and lets hope its fixed in 2.2.2!

@giampaolo
Copy link
Owner

Mmmm no, unfortunately I think it's unlikely that commit has anything to do with this.

@lucien2k
Copy link

Hmm, well the good news is it definitely seems better. I've played around quite a lot now and no more seg faults with the master version.

@giampaolo
Copy link
Owner

OK, I'm going to close this out then.

@giampaolo
Copy link
Owner

I've just bumped into this myself. Reopening.

@giampaolo giampaolo reopened this Feb 19, 2015
@giampaolo
Copy link
Owner

OK I think I've fixed this in f37b720

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

No branches or pull requests

3 participants