Comments (5)
Hello Bar
I can't reproduce this. It works fine for me as shown below:
irb(main):001:0> require 'lxc'
=> true
irb(main):002:0> c = LXC::Container.new('ruby')
=> #<LXC::Container:0x00000001da0920>
irb(main):003:0> c.create('ubuntu')
Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 ...
Copy /var/cache/lxc/trusty/rootfs-amd64 to /var/lib/lxc/ruby/rootfs ...
Copying rootfs to /var/lib/lxc/ruby/rootfs ...
...
=> #<LXC::Container:0x00000001da0920>
irb(main):004:0> c.start
=> #<LXC::Container:0x00000001da0920>
irb(main):005:0> c.stop
=> #<LXC::Container:0x00000001da0920>
irb(main):006:0>
Does it work for you when you use the lxc command line tools?
# lxc-create -n test -t ubuntu
# lxc-start -n test
# lxc-stop -n test
from ruby-lxc.
Hi ,
When using the command line tool the stop works, to reproduce try to initiate a command as in LXC.command and ls /tmp or something along those lines.
Sent from Blue Mail
On Dec 18, 2014, 14:53, at 14:53, Andre Nathan [email protected] wrote:
Hello Bar
I can't reproduce this. It works fine for me as shown below:
irb(main):001:0> require 'lxc' => true irb(main):002:0> c = LXC::Container.new('ruby') => #<LXC::Container:0x00000001da0920> irb(main):003:0> c.create('ubuntu') Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 ... Copy /var/cache/lxc/trusty/rootfs-amd64 to /var/lib/lxc/ruby/rootfs ... Copying rootfs to /var/lib/lxc/ruby/rootfs ... ... => #<LXC::Container:0x00000001da0920> irb(main):004:0> c.start => #<LXC::Container:0x00000001da0920> irb(main):005:0> c.stop => #<LXC::Container:0x00000001da0920> irb(main):006:0>
Does it work for you when you use the lxc command line tools?
# lxc-create -n test -t ubuntu # lxc-start -n test # lxc-stop -n test
Reply to this email directly or view it on GitHub:
#27 (comment)
from ruby-lxc.
I managed to reproduce the freeze after using attach.
As a workaround, you can use c.attach(wait: true) { ... }
and then c.stop
won't freeze.
I'll look into what's going on when wait
is false
.
from ruby-lxc.
OK, I remembered how this API is supposed to work. You either pass wait: true
or you have to wait for the child yourself:
irb(main):001:0> require 'lxc'
=> true
irb(main):002:0> c = LXC::Container.new('ruby')
=> #<LXC::Container:0x00000001206ba0>
irb(main):003:0> c.start
=> #<LXC::Container:0x00000001206ba0>
irb(main):004:0> pid = c.attach {}
=> 29503
irb(main):005:0> Process.wait(pid)
=> 29503
irb(main):006:0> c.stop
=> #<LXC::Container:0x00000001206ba0>
I guess the motivation for this is the possibility to call attach multiple times without having to wait for each child process to finish sequentially (ie, call Process.waitall
at the end of the script, before calling LXC::Container#stop
).
On the other hand, it seems to me that the most common use-case is to have wait: true
, so I think I'll change the default value of this option. This would change the API though, so probably it would have to wait (no pun intended) for a new major version release.
from ruby-lxc.
Thanks for the explanation and fast responses,
Setting wait:true as default is a smart move, thanks for this gem :)
from ruby-lxc.
Related Issues (20)
- c.config_item('lxc.mount.entry') sometimes returns a string instead of array HOT 2
- clone using overlayfs snapshot HOT 3
- missing liblxc when installing HOT 3
- how to run lxc commands HOT 2
- #attach, #run_command and stdout HOT 6
- zombie process after (attach and run_command) HOT 3
- how to set release and architecture during creation of container HOT 2
- Capturing the exit status of commands inside the container HOT 2
- starting ephemeral containers HOT 4
- clone segfaults with the latest lxc release HOT 2
- LXC.run_command path issue HOT 2
- Error installing gem with Rubinius HOT 11
- destroying containers from code doesn't sync with lxc-ls HOT 5
- undefined symbol: lxc_strerror HOT 4
- save_config doesn't save cgroup related settings
- gem fails to install on ubuntu 18.04 HOT 8
- Cannot fork after attaching in ruby >= 2.6 HOT 2
- ruby-lxc broken by liblxc 4.0.4: undefined symbol: lxc_config_parse_arch HOT 2
- Segmentation fault when creating a container
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruby-lxc.