Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin: Getting panic when opening plugins that imports "gopacket" and "net" #20451

Closed
Bigomby opened this issue May 22, 2017 · 4 comments
Closed
Labels
FrozenDueToAge help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@Bigomby
Copy link

Bigomby commented May 22, 2017

Details

go version

go version go1.8.1 linux/amd64

go env

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/diego/Documentos"
GORACE=""
GOROOT="/home/diego/.gvm/gos/go1.8.1"
GOTOOLDIR="/home/diego/.gvm/gos/go1.8.1/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build314688111=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

Description

If a plugin imports the "gopacket" package and another plugin imports the "net" package, the app will panic when opening both plugins.

The panic seems to occur only with these packages and only if opened in that specific order ("gopacket", then "net").

The panic occurs at the second plugin.Open() :

panic: interface conversion: *net.IPAddr is not net.sockaddr: missing method sockaddr

goroutine 1 [running]:
plugin.lastmoduleinit(0x7f6f70000a90, 0xc42000e030, 0x7f6f70001af0, 0x45, 0x7b5f40)
	/home/diego/.gvm/gos/go1.8.1/src/runtime/plugin.go:60 +0x5e6
plugin.open(0x53154f, 0xa, 0x0, 0x0, 0x0)
	/home/diego/.gvm/gos/go1.8.1/src/plugin/plugin_dlopen.go:72 +0x25d
plugin.Open(0x53154f, 0xa, 0xc42000c460, 0x0, 0x0)
	/home/diego/.gvm/gos/go1.8.1/src/plugin/plugin.go:30 +0x35
main.main()
	/home/diego/Documentos/src/github.com/Bigomby/testsock/cmd/main.go:14 +0xa4

Plugin 1

package main

import (
	"time"

	"github.com/google/gopacket/pcap"
)

func main() {}

func Plugin1() {
	pcap.OpenLive("lo", 1024, false, 1*time.Second)
}

Plugin 2

package main

import "net"

func main() {}

func Plugin2() {
	net.Dial("ip:udp", "0.0.0.0")
}

Main

package main

import "plugin"

func main() {
	plugin.Open("plugin1.so")
	plugin.Open("plugin2.so")
}
@Bigomby Bigomby changed the title Getting panic opening plugins that imports "gopacket" and "net" Getting panic when opening plugins that imports "gopacket" and "net" May 22, 2017
@bradfitz bradfitz changed the title Getting panic when opening plugins that imports "gopacket" and "net" plugin: Getting panic when opening plugins that imports "gopacket" and "net" May 22, 2017
@bradfitz bradfitz added help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels May 22, 2017
@bradfitz bradfitz added this to the Go1.9Maybe milestone May 22, 2017
@bradfitz
Copy link
Contributor

/cc @crawshaw

@Bigomby
Copy link
Author

Bigomby commented May 26, 2017

The problem seems to happen with the "net" plugin, not the "gopacket" plugin. The following code also make the app crash:

package main

import (
  "plugin"
  "github.com/rcrowley/go-metrics"
)

func main() {
  metrics.NewCounter()
  plugin.Open("plugin2.so") // The "net" plugin
}

UPDATE: Removing "net" package inside "github.com/rcrowley/go-metrics" makes the app not to panic.

@bradfitz bradfitz modified the milestones: Go1.9Maybe, Go1.10 Jun 7, 2017
@MissingRoberto
Copy link

seeing this issue too

@crawshaw
Copy link
Member

I believe this is fixed at HEAD. Tested here on darwin/amd64.

Please let me know if you still see it at HEAD.

@golang golang locked and limited conversation to collaborators Sep 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants