prometheus / prometheus/node_exporter

Plugin.open throws runtime error while doing make build, but works when i do static build "go build"

Open
#1,012 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
13.8k
Forks
2.7k
Avg merge
1d 23h
Merged PRs (30d)
8

Description

I have plugin collector in which I am calling plugin.open to load the go plugin shared library file (*.so). It failed while doing the make build of node exporter. It actually fails at test of collector as part of make build.

Actually it works when i tried to run the same code by building via "go build" binary.

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x0]

runtime stack:
runtime.throw(0xaec358, 0x2a)
/root/go/src/runtime/panic.go:616 +0x81
runtime.sigpanic()
/root/go/src/runtime/signal_unix.go:372 +0x28e

goroutine 1 [syscall]:
runtime.cgocall(0x8beb30, 0xc4201c7718, 0x9e4e80)
/root/go/src/runtime/cgocall.go:128 +0x64 fp=0xc4201c76e8 sp=0xc4201c76b0 pc=0x402124
plugin._Cfunc_pluginOpen(0xc420232000, 0xc4201448d8, 0x0)
_cgo_gotypes.go:71 +0x4e fp=0xc4201c7718 sp=0xc4201c76e8 pc=0x81153e
plugin.open.func1(0xc420232000, 0xc4201448d8, 0xc420170cf0)
/root/go/src/plugin/plugin_dlopen.go:74 +0xac fp=0xc4201c7750 sp=0xc4201c7718 pc=0x81270c
plugin.open(0xc420170cc0, 0x30, 0x3, 0xc420170cc0, 0x30)
/root/go/src/plugin/plugin_dlopen.go:74 +0x357 fp=0xc4201c7a08 sp=0xc4201c7750 pc=0x8119a7
plugin.Open(0xc420170cc0, 0x30, 0x1f, 0xc4201706af, 0xe)
/root/go/src/plugin/plugin.go:32 +0x35 fp=0xc4201c7a40 sp=0xc4201c7a08 pc=0x811215
github.com/prometheus/node_exporter/collector.newPluginCollector(0x101c3f0, 0xc42019ed40, 0xc42019f510)
/root/work/src/github.com/prometheus/node_exporter/collector/plugin.go:64

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at collector/plugin.go:64, where newPluginCollector calls plugin.Open, and reproduce the failure through the collector test during make build. Compare that behavior with the same code built using go build, then identify what differs in the two build paths. Done means the collector test no longer hits the reported SIGSEGV during make build.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.