Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Conversation

@LK4D4
Copy link
Contributor

@LK4D4 LK4D4 commented Dec 19, 2014

Now NotifyOnOOM is in cgroups package and should be used with path to memory cgroup, which can be obtained from container State

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should change the function sigs to take the map[string]string for the actual paths that we setup like RemovePaths and Stats now take?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I don't know, it need only one cgroup as I see.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but passing the cgroups like this it has to regenerate the path dynamically instead of using the static path initially used and setup.

@LK4D4
Copy link
Contributor Author

LK4D4 commented Dec 19, 2014

@crosbymichael I just removed systemd/notify_linux.go and fs/notify_linux.go. So now user of cgroups.NotifyOnOOM should pass right path for memory cgroup.

@LK4D4 LK4D4 changed the title Systemd notify oom OOM Notify refactoring Dec 21, 2014
@LK4D4
Copy link
Contributor Author

LK4D4 commented Dec 21, 2014

ping @vmarmol @vishh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about exposing an API at libcontainer package level that will take 'state' as an argument instead of exposing this? That way users of this API need not interpret libcontainer 'state'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe then as method of State? Why argument?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for not having state as an argument. But a method of state seems weird
to me. One option is to wait for the new API to get rid of the state
argument.

On Sun, Dec 21, 2014 at 8:51 AM, Alexander Morozov <[email protected]

wrote:

In cgroups/notify_linux.go
#307 (diff)
:

  •   return nil, err
    

- }

  • return notifyOnOOM(d)
    -}

-func notifyOnOOM(d *data) (<-chan struct{}, error) {

  • dir, err := d.path("memory")
  • if err != nil {
  •   return nil, err
    

- }

+// NotifyOnOOM returns channel on which you can expect event about OOM,
+// if process died without OOM this channel will be closed.
+// dir should be path to memory cgroup
+func NotifyOnOOM(dir string) (<-chan struct{}, error) {

Maybe then as method of State? Why argument?


Reply to this email directly or view it on GitHub
https://github.com/docker/libcontainer/pull/307/files#r22148698.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'm agree. I'll fix now.

@LK4D4
Copy link
Contributor Author

LK4D4 commented Dec 22, 2014

@vishh I made changes, no NotifyOnOOM is libcontainer package function and has libcontainer.State as argument.

notify_linux.go Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Update description.

Now there is function NotifyOnOOM in libcontainer package, which
receives *libcontainer.State as argument.

Signed-off-by: Alexander Morozov <[email protected]>
@LK4D4
Copy link
Contributor Author

LK4D4 commented Dec 22, 2014

Fixed comment and commit message.

@vishh
Copy link
Contributor

vishh commented Dec 22, 2014

LGTM. @LK4D4 are you working on a fix to retry cgroups deletion?

@LK4D4
Copy link
Contributor Author

LK4D4 commented Dec 22, 2014

@vishh Yes, right now.

@rjnagal
Copy link
Contributor

rjnagal commented Dec 22, 2014

LGTM

1 similar comment
@mrunalp
Copy link
Contributor

mrunalp commented Dec 23, 2014

LGTM

mrunalp pushed a commit that referenced this pull request Dec 23, 2014
@mrunalp mrunalp merged commit 6423c8d into docker-archive:master Dec 23, 2014
ColinHuang pushed a commit to fcwu/docker that referenced this pull request Jan 5, 2015
This commit contains changes for docker:
* user.GetGroupFile to user.GetGroupPath docker-archive/libcontainer#301
* Add systemd support for OOM docker-archive/libcontainer#307
* Support for custom namespaces docker-archive/libcontainer#279, docker-archive/libcontainer#312
* Fixes moby#9699 docker-archive/libcontainer#308

Signed-off-by: Alexander Morozov <[email protected]>
@LK4D4 LK4D4 deleted the systemd_notify_oom branch April 28, 2015 22:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants