{"action":"created","comment":{"url":"https://api.github.com/repos/opencontainers/runc/pulls/comments/49391363","id":49391363,"diff_hunk":"@@ -525,6 +525,75 @@ func testCpuShares(t *testing.T, systemd bool) {\n \t}\n }\n \n+func TestPids(t *testing.T) {\n+\ttestPids(t, false)\n+}\n+\n+func TestPidsSystemd(t *testing.T) {\n+\tif !systemd.UseSystemd() {\n+\t\tt.Skip(\"Systemd is unsupported\")\n+\t}\n+\ttestPids(t, true)\n+}\n+\n+func testPids(t *testing.T, systemd bool) {\n+\tif testing.Short() {\n+\t\treturn\n+\t}\n+\n+\trootfs, err := newRootfs()\n+\tok(t, err)\n+\tdefer remove(rootfs)\n+\n+\tconfig := newTemplateConfig(rootfs)\n+\tif systemd {\n+\t\tconfig.Cgroups.Parent = \"system.slice\"\n+\t}\n+\tconfig.Cgroups.Resources.PidsLimit = -1\n+\n+\t// Running multiple processes.\n+\t_, ret, err := runContainer(config, \"\", \"/bin/sh\", \"-c\", \"/bin/true | /bin/true | /bin/true | /bin/true\")\n+\tif err != nil && strings.Contains(err.Error(), \"no such directory for pids.max\") {\n+\t\tt.Skip(\"PIDs cgroup is unsupported\")\n+\t}\n+\tok(t, err)\n+\n+\tif ret != 0 {\n+\t\tt.Fatalf(\"expected fork() to succeed with no pids limit\")\n+\t}\n+\n+\t// Enforce a permissive limit (shell + 6 * true + 3).\n+\tconfig.Cgroups.Resources.PidsLimit = 10\n+\t_, ret, err = runContainer(config, \"\", \"/bin/sh\", \"-c\", \"/bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true\")\n+\tif err != nil && strings.Contains(err.Error(), \"no such directory for pids.max\") {\n+\t\tt.Skip(\"PIDs cgroup is unsupported\")\n+\t}\n+\tok(t, err)\n+\n+\tif ret != 0 {\n+\t\tt.Fatalf(\"expected fork() to succeed with permissive pids limit\")\n+\t}\n+\n+\t// Enforce a restrictive limit limit (shell + 6 * true + 3).","path":"libcontainer/integration/exec_test.go","position":53,"original_position":53,"commit_id":"ed5cd22125aeca9a8aa99ca516a714fd1997e8ae","original_commit_id":"ed5cd22125aeca9a8aa99ca516a714fd1997e8ae","user":{"login":"mrunalp","id":53798,"avatar_url":"https://avatars.githubusercontent.com/u/53798?v=3","gravatar_id":"","url":"https://api.github.com/users/mrunalp","html_url":"https://github.com/mrunalp","followers_url":"https://api.github.com/users/mrunalp/followers","following_url":"https://api.github.com/users/mrunalp/following{/other_user}","gists_url":"https://api.github.com/users/mrunalp/gists{/gist_id}","starred_url":"https://api.github.com/users/mrunalp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrunalp/subscriptions","organizations_url":"https://api.github.com/users/mrunalp/orgs","repos_url":"https://api.github.com/users/mrunalp/repos","events_url":"https://api.github.com/users/mrunalp/events{/privacy}","received_events_url":"https://api.github.com/users/mrunalp/received_events","type":"User","site_admin":false},"body":"s/limit limit/limit/","created_at":"2016-01-11T22:50:02Z","updated_at":"2016-01-11T22:50:02Z","html_url":"https://github.com/opencontainers/runc/pull/446#discussion_r49391363","pull_request_url":"https://api.github.com/repos/opencontainers/runc/pulls/446","_links":{"self":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/comments/49391363"},"html":{"href":"https://github.com/opencontainers/runc/pull/446#discussion_r49391363"},"pull_request":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/446"}}},"pull_request":{"url":"https://api.github.com/repos/opencontainers/runc/pulls/446","id":54194301,"html_url":"https://github.com/opencontainers/runc/pull/446","diff_url":"https://github.com/opencontainers/runc/pull/446.diff","patch_url":"https://github.com/opencontainers/runc/pull/446.patch","issue_url":"https://api.github.com/repos/opencontainers/runc/issues/446","number":446,"state":"open","locked":false,"title":"cgroup: add PIDs cgroup controller support","user":{"login":"cyphar","id":2888411,"avatar_url":"https://avatars.githubusercontent.com/u/2888411?v=3","gravatar_id":"","url":"https://api.github.com/users/cyphar","html_url":"https://github.com/cyphar","followers_url":"https://api.github.com/users/cyphar/followers","following_url":"https://api.github.com/users/cyphar/following{/other_user}","gists_url":"https://api.github.com/users/cyphar/gists{/gist_id}","starred_url":"https://api.github.com/users/cyphar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyphar/subscriptions","organizations_url":"https://api.github.com/users/cyphar/orgs","repos_url":"https://api.github.com/users/cyphar/repos","events_url":"https://api.github.com/users/cyphar/events{/privacy}","received_events_url":"https://api.github.com/users/cyphar/received_events","type":"User","site_admin":false},"body":"This is a fixed up version of the now-reverted #58. The main issue with that code was that **some of** the memory cgroup's limits weren't being set at all if you were using systemd. Unfortunately, I seem to be unable to test the systemd portion (and the systemd test cases for memory don't actually test that the limits cause a process to fail).\r\n\r\nAll other cgroups were unaffected by this bug (as their limits were set using `.Set()`, and were joined either explicitly or using systemd), regardless of whether they were unsupported, partial supported or fully supported by systemd.\r\n\r\nSome testing has revealed that the old setup didn't work either (because `getSubsystemPath` doesn't appear to work as expected).\r\n\r\n/cc @mrunalp @hqhq @vishh @crosbymichael @dqminh ","created_at":"2015-12-20T07:01:25Z","updated_at":"2016-01-11T22:50:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ccbb4466fc0945d6ace2d965510b85a8e2bb6846","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/opencontainers/runc/pulls/446/commits","review_comments_url":"https://api.github.com/repos/opencontainers/runc/pulls/446/comments","review_comment_url":"https://api.github.com/repos/opencontainers/runc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opencontainers/runc/issues/446/comments","statuses_url":"https://api.github.com/repos/opencontainers/runc/statuses/ed5cd22125aeca9a8aa99ca516a714fd1997e8ae","head":{"label":"cyphar:18-add-pids-controller","ref":"18-add-pids-controller","sha":"ed5cd22125aeca9a8aa99ca516a714fd1997e8ae","user":{"login":"cyphar","id":2888411,"avatar_url":"https://avatars.githubusercontent.com/u/2888411?v=3","gravatar_id":"","url":"https://api.github.com/users/cyphar","html_url":"https://github.com/cyphar","followers_url":"https://api.github.com/users/cyphar/followers","following_url":"https://api.github.com/users/cyphar/following{/other_user}","gists_url":"https://api.github.com/users/cyphar/gists{/gist_id}","starred_url":"https://api.github.com/users/cyphar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyphar/subscriptions","organizations_url":"https://api.github.com/users/cyphar/orgs","repos_url":"https://api.github.com/users/cyphar/repos","events_url":"https://api.github.com/users/cyphar/events{/privacy}","received_events_url":"https://api.github.com/users/cyphar/received_events","type":"User","site_admin":false},"repo":{"id":38178794,"name":"runc","full_name":"cyphar/runc","owner":{"login":"cyphar","id":2888411,"avatar_url":"https://avatars.githubusercontent.com/u/2888411?v=3","gravatar_id":"","url":"https://api.github.com/users/cyphar","html_url":"https://github.com/cyphar","followers_url":"https://api.github.com/users/cyphar/followers","following_url":"https://api.github.com/users/cyphar/following{/other_user}","gists_url":"https://api.github.com/users/cyphar/gists{/gist_id}","starred_url":"https://api.github.com/users/cyphar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyphar/subscriptions","organizations_url":"https://api.github.com/users/cyphar/orgs","repos_url":"https://api.github.com/users/cyphar/repos","events_url":"https://api.github.com/users/cyphar/events{/privacy}","received_events_url":"https://api.github.com/users/cyphar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cyphar/runc","description":"runc container cli tools","fork":true,"url":"https://api.github.com/repos/cyphar/runc","forks_url":"https://api.github.com/repos/cyphar/runc/forks","keys_url":"https://api.github.com/repos/cyphar/runc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cyphar/runc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cyphar/runc/teams","hooks_url":"https://api.github.com/repos/cyphar/runc/hooks","issue_events_url":"https://api.github.com/repos/cyphar/runc/issues/events{/number}","events_url":"https://api.github.com/repos/cyphar/runc/events","assignees_url":"https://api.github.com/repos/cyphar/runc/assignees{/user}","branches_url":"https://api.github.com/repos/cyphar/runc/branches{/branch}","tags_url":"https://api.github.com/repos/cyphar/runc/tags","blobs_url":"https://api.github.com/repos/cyphar/runc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cyphar/runc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cyphar/runc/git/refs{/sha}","trees_url":"https://api.github.com/repos/cyphar/runc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cyphar/runc/statuses/{sha}","languages_url":"https://api.github.com/repos/cyphar/runc/languages","stargazers_url":"https://api.github.com/repos/cyphar/runc/stargazers","contributors_url":"https://api.github.com/repos/cyphar/runc/contributors","subscribers_url":"https://api.github.com/repos/cyphar/runc/subscribers","subscription_url":"https://api.github.com/repos/cyphar/runc/subscription","commits_url":"https://api.github.com/repos/cyphar/runc/commits{/sha}","git_commits_url":"https://api.github.com/repos/cyphar/runc/git/commits{/sha}","comments_url":"https://api.github.com/repos/cyphar/runc/comments{/number}","issue_comment_url":"https://api.github.com/repos/cyphar/runc/issues/comments{/number}","contents_url":"https://api.github.com/repos/cyphar/runc/contents/{+path}","compare_url":"https://api.github.com/repos/cyphar/runc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cyphar/runc/merges","archive_url":"https://api.github.com/repos/cyphar/runc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cyphar/runc/downloads","issues_url":"https://api.github.com/repos/cyphar/runc/issues{/number}","pulls_url":"https://api.github.com/repos/cyphar/runc/pulls{/number}","milestones_url":"https://api.github.com/repos/cyphar/runc/milestones{/number}","notifications_url":"https://api.github.com/repos/cyphar/runc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cyphar/runc/labels{/name}","releases_url":"https://api.github.com/repos/cyphar/runc/releases{/id}","created_at":"2015-06-27T23:14:24Z","updated_at":"2015-06-27T23:14:26Z","pushed_at":"2016-01-11T22:30:59Z","git_url":"git://github.com/cyphar/runc.git","ssh_url":"git@github.com:cyphar/runc.git","clone_url":"https://github.com/cyphar/runc.git","svn_url":"https://github.com/cyphar/runc","homepage":"","size":2279,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opencontainers:master","ref":"master","sha":"910752f1f5c8f4d6d201e40af0383a8a7e68ede2","user":{"login":"opencontainers","id":12563465,"avatar_url":"https://avatars.githubusercontent.com/u/12563465?v=3","gravatar_id":"","url":"https://api.github.com/users/opencontainers","html_url":"https://github.com/opencontainers","followers_url":"https://api.github.com/users/opencontainers/followers","following_url":"https://api.github.com/users/opencontainers/following{/other_user}","gists_url":"https://api.github.com/users/opencontainers/gists{/gist_id}","starred_url":"https://api.github.com/users/opencontainers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencontainers/subscriptions","organizations_url":"https://api.github.com/users/opencontainers/orgs","repos_url":"https://api.github.com/users/opencontainers/repos","events_url":"https://api.github.com/users/opencontainers/events{/privacy}","received_events_url":"https://api.github.com/users/opencontainers/received_events","type":"Organization","site_admin":false},"repo":{"id":36960321,"name":"runc","full_name":"opencontainers/runc","owner":{"login":"opencontainers","id":12563465,"avatar_url":"https://avatars.githubusercontent.com/u/12563465?v=3","gravatar_id":"","url":"https://api.github.com/users/opencontainers","html_url":"https://github.com/opencontainers","followers_url":"https://api.github.com/users/opencontainers/followers","following_url":"https://api.github.com/users/opencontainers/following{/other_user}","gists_url":"https://api.github.com/users/opencontainers/gists{/gist_id}","starred_url":"https://api.github.com/users/opencontainers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencontainers/subscriptions","organizations_url":"https://api.github.com/users/opencontainers/orgs","repos_url":"https://api.github.com/users/opencontainers/repos","events_url":"https://api.github.com/users/opencontainers/events{/privacy}","received_events_url":"https://api.github.com/users/opencontainers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opencontainers/runc","description":"runc container cli tools","fork":false,"url":"https://api.github.com/repos/opencontainers/runc","forks_url":"https://api.github.com/repos/opencontainers/runc/forks","keys_url":"https://api.github.com/repos/opencontainers/runc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opencontainers/runc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opencontainers/runc/teams","hooks_url":"https://api.github.com/repos/opencontainers/runc/hooks","issue_events_url":"https://api.github.com/repos/opencontainers/runc/issues/events{/number}","events_url":"https://api.github.com/repos/opencontainers/runc/events","assignees_url":"https://api.github.com/repos/opencontainers/runc/assignees{/user}","branches_url":"https://api.github.com/repos/opencontainers/runc/branches{/branch}","tags_url":"https://api.github.com/repos/opencontainers/runc/tags","blobs_url":"https://api.github.com/repos/opencontainers/runc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opencontainers/runc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opencontainers/runc/git/refs{/sha}","trees_url":"https://api.github.com/repos/opencontainers/runc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opencontainers/runc/statuses/{sha}","languages_url":"https://api.github.com/repos/opencontainers/runc/languages","stargazers_url":"https://api.github.com/repos/opencontainers/runc/stargazers","contributors_url":"https://api.github.com/repos/opencontainers/runc/contributors","subscribers_url":"https://api.github.com/repos/opencontainers/runc/subscribers","subscription_url":"https://api.github.com/repos/opencontainers/runc/subscription","commits_url":"https://api.github.com/repos/opencontainers/runc/commits{/sha}","git_commits_url":"https://api.github.com/repos/opencontainers/runc/git/commits{/sha}","comments_url":"https://api.github.com/repos/opencontainers/runc/comments{/number}","issue_comment_url":"https://api.github.com/repos/opencontainers/runc/issues/comments{/number}","contents_url":"https://api.github.com/repos/opencontainers/runc/contents/{+path}","compare_url":"https://api.github.com/repos/opencontainers/runc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opencontainers/runc/merges","archive_url":"https://api.github.com/repos/opencontainers/runc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opencontainers/runc/downloads","issues_url":"https://api.github.com/repos/opencontainers/runc/issues{/number}","pulls_url":"https://api.github.com/repos/opencontainers/runc/pulls{/number}","milestones_url":"https://api.github.com/repos/opencontainers/runc/milestones{/number}","notifications_url":"https://api.github.com/repos/opencontainers/runc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opencontainers/runc/labels{/name}","releases_url":"https://api.github.com/repos/opencontainers/runc/releases{/id}","created_at":"2015-06-05T23:30:45Z","updated_at":"2016-01-11T19:42:47Z","pushed_at":"2016-01-11T22:15:40Z","git_url":"git://github.com/opencontainers/runc.git","ssh_url":"git@github.com:opencontainers/runc.git","clone_url":"https://github.com/opencontainers/runc.git","svn_url":"https://github.com/opencontainers/runc","homepage":"","size":3838,"stargazers_count":2410,"watchers_count":2410,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":286,"mirror_url":null,"open_issues_count":71,"forks":286,"open_issues":71,"watchers":2410,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/446"},"html":{"href":"https://github.com/opencontainers/runc/pull/446"},"issue":{"href":"https://api.github.com/repos/opencontainers/runc/issues/446"},"comments":{"href":"https://api.github.com/repos/opencontainers/runc/issues/446/comments"},"review_comments":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/446/comments"},"review_comment":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/446/commits"},"statuses":{"href":"https://api.github.com/repos/opencontainers/runc/statuses/ed5cd22125aeca9a8aa99ca516a714fd1997e8ae"}}}}