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

Race condition #459

Closed
valrusu opened this issue Jun 28, 2024 · 4 comments
Closed

Race condition #459

valrusu opened this issue Jun 28, 2024 · 4 comments

Comments

@valrusu
Copy link
Contributor

valrusu commented Jun 28, 2024

https://github.com/iamseth/oracledb_exporter/blame/29c8869cf60dc5b318236000f09fb69e92846620/collector/collector.go#L316

There is a race condition here, all the goroutines started using function f reference directly the err variable. When more than one change it at the same or close times, you get:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x9f2229]

goroutine 176881 [running]:
github.com/iamseth/oracledb_exporter/collector.(*Exporter).scrape.func2()
.../oracledb_exporter/collector/collector.go:316 +0x13e9
created by github.com/iamseth/oracledb_exporter/collector.(*Exporter).scrape in goroutine 176838
.../oracledb_exporter/collector/collector.go:322 +0x776

@levp7
Copy link

levp7 commented Jul 18, 2024

I'm seeing this issue in version 0.6.0 :

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x9f7509]

goroutine 68477 [running]:
github.com/iamseth/oracledb_exporter/collector.(*Exporter).scrape.func2()
/usr/local/gowork/src/github.com/oracledb_exporter/collector/collector.go:317 +0x1429
created by github.com/iamseth/oracledb_exporter/collector.(*Exporter).scrape in goroutine 68349
/usr/local/gowork/src/github.com/oracledb_exporter/collector/collector.go:323 +0x796

@levp7
Copy link

levp7 commented Jul 19, 2024

I tested the previous release 0.5.2 and I'm also see similar issue :

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x9a825c]

goroutine 58783 [running]:
github.com/iamseth/oracledb_exporter/collector.(*Exporter).scrape.func2()
/home/runner/work/oracledb_exporter/oracledb_exporter/collector/collector.go:315 +0xffc
created by github.com/iamseth/oracledb_exporter/collector.(*Exporter).scrape
/home/runner/work/oracledb_exporter/oracledb_exporter/collector/collector.go:321 +0x94e

@valrusu
Copy link
Contributor Author

valrusu commented Jul 24, 2024

FYI
#460

Yannig pushed a commit that referenced this issue Jul 29, 2024
* Added mutex for access to the err variable written by all metrics collector functions

* Fixed race condition for err variable
@Yannig
Copy link
Collaborator

Yannig commented Aug 3, 2024

Thanks for your PR. It's merged now. Will do a new release with this fix.

@Yannig Yannig closed this as completed Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants