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

Potential crash due to pthread_setaffinity_np() and cpuset #695

Closed
moreati opened this issue Jun 18, 2015 · 3 comments
Closed

Potential crash due to pthread_setaffinity_np() and cpuset #695

moreati opened this issue Jun 18, 2015 · 3 comments

Comments

@moreati
Copy link
Contributor

moreati commented Jun 18, 2015

I run a weird mashup of Ubuntu 15.04 and Linux kernel 4.1.0-040100rc1-generic. As a result if I search with ag the following happens:

alex@martha:~$ /usr/local/bin/ag foo
ERR: error in pthread_setaffinity_np(): Invalid argument

This doesn't occur on a vanilla 15.04 installation, as far as I know only I'm affected. I'm only reporting this bug for reference, feel free to close it as WONTFIX

It's fine if I disable affinity

(v)alex@martha:~$ /usr/local/bin/ag --noaffinity foo
go/src/llvm.org/llvm/Makefile.rules
2116:check-footprint:
...

I believe this is due to cpuset being somehow enabled, and having a policy restricting processes to the 0th core:

alex@martha:~$ mount | grep cpuset
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset,clone_children)
alex@martha:~$ grep Cpus /proc/self/status
Cpus_allowed:   01
Cpus_allowed_list:  0

The relevant documentation is http://man7.org/linux/man-pages/man3/pthread_setaffinity_np.3.html#ERRORS:

  EINVAL (pthread_setaffinity_np()) The affinity bit mask mask contains
         no processors that are currently physically on the system and
         permitted to the thread according to any restrictions that may
         be imposed by the "cpuset" mechanism described in cpuset(7).
@ggreer
Copy link
Owner

ggreer commented Jun 18, 2015

Maybe ag could just warn or print an error instead of dying. Would that be better for you?

@moreati
Copy link
Contributor Author

moreati commented Jun 18, 2015

That would be fine, but as I said this is not a priority by any means. alias ag=ag --noaffinity is a very satisfactory workaround.

@ggreer
Copy link
Owner

ggreer commented Jun 18, 2015

Alright. It's fixed in master.

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