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

panic: runtime error: invalid memory address or nil pointer dereference #20

Open
luma91 opened this issue Jan 3, 2020 · 9 comments
Open

Comments

@luma91
Copy link

luma91 commented Jan 3, 2020

Trying to run in portainer, getting this error in the logs when accessing the metrics page which kills the container.

@luma91
Copy link
Author

luma91 commented Jan 3, 2020

Same issue trying to run this directly in a ubuntu vm

2020/01/03 14:57:42 failed to get session: invalid character '<' looking for beginning of value
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7bad29]

@metalmatze
Copy link
Owner

I would guess that it is most likely an authentication issues, as the exporter expects JSON to be returned in the response but something else is read from the body.

@metalmatze
Copy link
Owner

It shouldn't panic though...

@luma91
Copy link
Author

luma91 commented Jan 10, 2020

Hmm. I dont have a user / pass for my transmission. Do you think that might do it?
Update: Okay I set a basic user / pass in my transmission server and now transmission exporter works.

@DanielYWoo
Copy link

same here

appuser@home-nas:/opt/exporter_transmission$ docker logs exporter_transmission
2020/03/30 15:52:31 starting transmission-exporter
2020/03/30 15:52:31 no .env present
2020/03/30 15:52:32 failed to get session stats: invalid character '<' looking for beginning of value
2020/03/30 15:52:32 failed to get session: invalid character '<' looking for beginning of value
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7bbc6f]

goroutine 6 [running]:
main.(*SessionStatsCollector).Collect(0xc0000968a0, 0xc000180060)
	/go/src/github.com/metalmatze/transmission-exporter/cmd/transmission-exporter/session_stats_collector.go:118 +0xcf
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:430 +0x19d
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:522 +0xe12

@andrzejressel
Copy link

I got this error when I was using hostname that was not in rpc-host-whitelist

@northys
Copy link

northys commented Mar 13, 2022

@metalmatze it happens for me when transmission is moving files from download directory to final destination which causes timeouts of transmission rpc. the whole transmission is stuck at this point because it's single thread app and when it copies files it doesn't do anything else.

when the copying completes it starts to work again though... it looks like bad handling of rpc errors / timeouts but i'm not a golang dev so i don't understand the code much.

transmission-exporter_1  | 2022/03/13 00:07:16 failed to get session stats: Post http://172.17.0.1:9091/transmission/rpc: dial tcp 172.17.0.1:9091: i/o timeout
transmission-exporter_1  | panic: runtime error: invalid memory address or nil pointer dereference
transmission-exporter_1  | [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7bbc6f]
transmission-exporter_1  | 
transmission-exporter_1  | goroutine 41 [running]:
transmission-exporter_1  | main.(*SessionStatsCollector).Collect(0xc0001221e0, 0xc00011e0c0)
transmission-exporter_1  | 	/go/src/github.com/metalmatze/transmission-exporter/cmd/transmission-exporter/session_stats_collector.go:118 +0xcf
transmission-exporter_1  | github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
transmission-exporter_1  | 	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:430 +0x19d
transmission-exporter_1  | created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
transmission-exporter_1  | 	/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:522 +0xe12

@metalmatze
Copy link
Owner

Thanks for commenting with that feedback. I wasn't aware of the single-threaded nature of Transmission and this being a root cause. 👍

@northys
Copy link

northys commented Mar 14, 2022

I checked the exporter code and from that little I know about golang I would say there should be no problem. You are correctly checking that err is nil but the code seems tk go through that condition and later fails because there is no data in the response.

Do you have any idea what could be the cause of this error?

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

5 participants