Comments (14)
I dont think it is a Go issue, network namespaces should be ok in Go. However, I don't believe network configuration is transferred when interfaces are moved into a new namespace (as the config belongs to the other network stack) so you always need to configure after moving to the new namespace.
from opengcs.
My reading of the code is that, eth0
get's configured in the root namespace via configureNetworkAdapter()
and that works fine from my logging. @justincormack you are right in that the current config gets lost when the adapter is moved into the new namespace, but moveAdapterIntoNamespace()
gathers the current configuration of eth0
, moves the interface into the new namespace, and then re-applies the configuration in the new namespace.
The article linked in the OP seems to suggest that, even if one does a runtime.LockOSThread()
(as suggested in the netns
package, it's still possible, if blocking system calls are executed, the code get executed afterwards on a different thread which is not in the new namespace. libnetwork
also seems to bend over backwards to re-exec in some case to execute some code in the new namespace.
from opengcs.
Oh I see. Yes in that case it will be an issue, yes. Starting another process is easiest then.
from opengcs.
from opengcs.
FYI, I have been working on a fix, it compiles, now I need test :)
https://github.com/rn/opengcs/tree/net
from opengcs.
Thanks for root causing this bug! That's a really interesting (and annoying in this case) quirk of the Go runtime. Let me know if you need any help with the fix! I'd be happy to look it over at any point during development!
from opengcs.
I've force pushed an update. I was able to test the new binary manually on a standard Linux system (with a veth
pair) and it works without a problem.
However, the integration with gcs
does not work and I get an error when trying to run, but there is no meaningful error in the daemon logs. Is there way of getting at /tmp/gcs.log
? The utility VM is already gone, so hcsdiag
is of no help...
from opengcs.
Try setting this key to the given value (value 1). It should keep the utility VM alive even on error.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\Debug]
"PreserveVmOnErrorDestruct"=dword:00000001
from opengcs.
@beweedon I tried:
$regPath="HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\Debug\"
New-Item -Path $regPath -Force
New-ItemProperty -Path $regPath -Name PreserveVmOnErrorDestruct -PropertyType DWORD -Value 1
And the VM does not stick around. I've also rebooted, just to make sure. I'm on insider build: 16241.1001. Any idea?
from opengcs.
Oh, ugh, that registry key might not work in this case. Do you have the ability to attach WinDbg and break on C++ errors (Debug > Event Filters, then set C++ EH to enabled)? This should break in before the VM is destructed.
from opengcs.
It's been two years since I last used windbg
and that was for remote kernel/driver debug. I may need some more details...but generally yes
from opengcs.
NM thanks to a colleague I managed to get windbg to work and got an intriguing error. debugging
from opengcs.
Ah, it turns out there was an additional issue with the code, namely the netlink Link
object may change after the interface was moved to the new namespace in https://github.com/Microsoft/opengcs/blob/master/service/gcs/core/gcs/networking.go#L208
Interfaces are indexed by number and numbers are namespaced too. With a very simple setup you may get lucky that eth0
happens to be index 2 in both the root namespace and the new container namespace. With the LinuxKit kernel that was not the case so we gathered all the info for, say eth0
and then tried to re-apply them to a different interface once the namespace was entered.
from opengcs.
Thanks so much for figuring out this problem! I'm reviewing your changes now!
from opengcs.
Related Issues (20)
- execProcess should handle v2 external process
- V2 should support hot add/remove of NIC
- V2 exec process should consider UVMId
- Shutdown of UVM should send response to HCS
- bridge should make sure kernel version is 4.14.23 or greater
- In stress test, failed to get SCSI device name HOT 2
- [feature request] add version parameter HOT 2
- Error on run container with transparent network HOT 2
- Unspecified Error (0X80004005) and Failed to connect NIC
- init does too little and too much
- File ULIMITs HOT 1
- Intermittent DNS failures when running Alpine containers in user-defined docker-compose network
- vet error: set declared but not used HOT 1
- some "docker exec" commands fail with a cryptic error HOT 3
- LCOW: Docker Volumes don't support some fs operations that bind mounts support - CreateFile access denied HOT 2
- json.Unmarshal is incorrectly used
- json.Unmarshal is incorrectly used
- I would like to ask for some wrong answers HOT 4
- OT: Where to find tools/information about Hyper-V root on Linux
- Who owns C:\Program Files\Linux Containers? HOT 3
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 opengcs.