genuinetools / netns

Runc hook (OCI compatible) for setting up default bridge networking for containers.
MIT License
224 stars 37 forks source link

fix some netns ls command errors #9

Closed lifubang closed 6 years ago

lifubang commented 6 years ago

Before the commit https://github.com/genuinetools/netns/commit/eec8db671002a92e48748e2ce36f8be0c392cb94 :

netns ls command always return:

no networks found

Because without openDB, the db field is always nil.

After fix this error, there'll be new errors:

unexpected fault address 0x7efdcdab7070
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7efdcdab7070 pc=0x4f3ee8]

goroutine 1 [running]:
runtime.throw(0x6ddfa4, 0x5)
    /opt/go/src/runtime/panic.go:616 +0x81 fp=0xc420053ab8 sp=0xc420053a98 pc=0x42b061
runtime.sigpanic()
    /opt/go/src/runtime/signal_unix.go:395 +0x211 fp=0xc420053b08 sp=0xc420053ab8 pc=0x43f611
net.IP.String(0x7efdcdab7070, 0x4, 0x4, 0x1, 0x1)
    /opt/go/src/net/ip.go:278 +0x3c8 fp=0xc420053c40 sp=0xc420053b08 pc=0x4f3ee8
main.(*listCommand).Run(0x87d718, 0x712640, 0xc42007eae0, 0xc420090000, 0x0, 0x0, 0x3, 0x6)
    /root/gocode/src/github.com/genuinetools/netns/list.go:33 +0x1ba fp=0xc420053dc0 sp=0xc420053c40 pc=0x644c4a
github.com/genuinetools/netns/vendor/github.com/genuinetools/pkg/cli.(*Program).run(0xc4200c4000, 0x712640, 0xc42007eae0, 0xc420090000, 0x2, 0x2, 0x712640, 0xc42007eae0, 0x4120e8)
    /root/gocode/src/github.com/genuinetools/netns/vendor/github.com/genuinetools/pkg/cli/cli.go:173 +0x365 fp=0xc420053e78 sp=0xc420053dc0 pc=0x642715
github.com/genuinetools/netns/vendor/github.com/genuinetools/pkg/cli.(*Program).Run(0xc4200c4000)
    /root/gocode/src/github.com/genuinetools/netns/vendor/github.com/genuinetools/pkg/cli/cli.go:88 +0x170 fp=0xc420053f18 sp=0xc420053e78 pc=0x642240
main.main()
    /root/gocode/src/github.com/genuinetools/netns/main.go:126 +0x4a1 fp=0xc420053f88 sp=0xc420053f18 pc=0x645311
runtime.main()
    /opt/go/src/runtime/proc.go:198 +0x212 fp=0xc420053fe0 sp=0xc420053f88 pc=0x42c8d2
runtime.goexit()
    /opt/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420053fe8 sp=0xc420053fe0 pc=0x456761

Because n.IP address is lost. The commit https://github.com/genuinetools/netns/commit/7f2448bed53551e4635cbe610fb3eadf2ba15491 is aim to fix this error.

After fix: netns ls

IP                  LOCAL VETH          PID                 STATUS              NS FD
172.19.0.2          netnsv0-1116        1116                running             5
codecov[bot] commented 6 years ago

Codecov Report

Merging #9 into master will not change coverage. The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master       #9   +/-   ##
=======================================
  Coverage   48.52%   48.52%           
=======================================
  Files           5        5           
  Lines         272      272           
=======================================
  Hits          132      132           
  Misses         98       98           
  Partials       42       42
Impacted Files Coverage Δ
network/list.go 0% <0%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9d3c817...0d2bd97. Read the comment docs.

jessfraz commented 6 years ago

thanks!

lifubang commented 5 years ago

@jessfraz for https://github.com/opencontainers/runc/issues/201#issuecomment-432990567 Shall we need to make a new release? Or else lots of body like me will meet the same error. Thank you.

alexellis commented 5 years ago

cc - I also ran into this issue and was kind of confused, also with issues disabled what's the best way to provide feedback on bugs @jessfraz ?