Comments (6)
Hey @dijkstracula,
Thank you so much for the super detailed report and also for the sample code to reproduce it!
I'll try to take a look at it but unfortunately I'm crazy busy nowadays :/
Not sure whether double fork would be a solution, need to try it :) @tych0 do you have any suggestions?
from go-lxc.
You can set the container's daemonize
flag via container.WantDaemonize(true)
, which should invoke liblxc's code to close these fds. It also implies a few other things about forking that you might or might not want, I don't remember exactly the specifics.
We could also replicate lxc_check_inherited
in golang, but it might make more sense to somehow expose it in a nicer way to liblxc. But maybe just setting daemonize will be enough, so I'd suggest you try that first :)
from go-lxc.
Thank you, @tych0! It appears that in the repro case setting WantDaemonize(true)
seems to avoid the race. Today I'll backport the "fix" in the service at work (which was, unfortunately, just to shell out to the LXC CLI :( ) and see if that also solves our issue.
Do you reckon that this ought to be the default setting for go-lxc containers? Is there a reason why application developers would not want this flag enabled by default?
from go-lxc.
On Mon, Sep 26, 2016 at 08:46:16AM -0700, Nathan Taylor wrote:
Thank you, @tych0! It appears that in the repro case setting
WantDaemonize(true)
seems to avoid the race. Today I'll backport the "fix" in the service at work (which was, unfortunately, just to shell out to the LXC CLI :( ) and see if that also solves our issue.Do you reckon that this ought to be the default setting for go-lxc containers? Is there a reason why application developers would not want this flag enabled by default?
Possibly, although someone should look at what the repercussions are
for setting it by default. It implies a bunch of things, and I don't
remember exactly what they are :).
Probably it shouldn't be go-lxc making this decision to change the
default, but liblxc itself, since it is the one providing the C api.
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#66 (comment)
from go-lxc.
@tych0 @dijkstracula ah sorry for not mentioning that, for some reason I assumed you already tried WantDaemonize. You should also be able set WantCloseAllFds to instruct liblxc to do the same.
from go-lxc.
Apologies for the delay!
Yes, it turns out WantDaemonize was the thing I wanted; unclear how I kept missing it.
from go-lxc.
Related Issues (20)
- incorrect status code from runCommandStatus
- Wrong cgroup file for KernelMemoryLimit
- CgroupItem and pids namespace HOT 1
- undefined reference to `lxc_config_item_is_supported' HOT 5
- Support working without template
- ERROR: Creating container faled + other error HOT 2
- DefaultConfigPath not consistent with GetConfigPath and SetConfigPath HOT 1
- tag semantic releases HOT 3
- starting the container failed HOT 11
- Version checking checks compile time version rather than runtime
- Failed to create loopback storage
- Import path to gopkg.in/lxc/go-lxc.v2 breaks module replacement HOT 5
- Build failed when specify ldflags -static HOT 1
- create example not working HOT 1
- Create fails when custom dir is specified; possible use-after-free?
- HasAPIExtension does not work because liblxc version check is broken HOT 1
- How to create new virtual machine? HOT 2
- console: handle escape character specification HOT 1
- container: add ConsoleLog() API extension
- Wait() function isn't blocking HOT 1
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 go-lxc.