srcds_exporter icon indicating copy to clipboard operation
srcds_exporter copied to clipboard

Connection exception occurred

Open Nerus87 opened this issue 2 years ago • 8 comments

Error: got panic while connecting to server, reconnecting server=starewygi

image

srcds.yaml image

rcon from client console: image

Nerus87 avatar Oct 12 '22 15:10 Nerus87

@Nerus87 Is that with the current latest code from main branch? The version is not set properly so I can't tell.

If you are building locally, I would recommend using make build which uses the promu tool to set up the version info during the build.

What game is that? Are you starting to use the exporter or have you been already running before successfully?

galexrt avatar Oct 13 '22 09:10 galexrt

I didn't build the app, I've just used the last release https://github.com/galexrt/srcds_exporter/releases/tag/v1.4.2 I'm using it for the first time, so I didn't have any other experience with it. The game is Counter-Strike: Source.

Nerus87 avatar Oct 14 '22 08:10 Nerus87

I'm getting the same issue with Insurgency. I can confirm that other rcon clients can connect without error from within the container. Here's the output with debug logging:

/ # /bin/srcds_exporter --config.file /srcds.yaml --log-level debug
INFO[0000] Starting srcds_exporter (version=, branch=, revision=e15457e518bb299fa36bd9bdf1a0ca9aabfda9fa)
INFO[0000] Build context (go=go1.18.10, platform=linux/amd64, user=, date=)
INFO[0000] Caching is disabled by default
DEBU[0000] Connected to server: 127.0.0.1:27015
INFO[0000] Loaded config file
INFO[0000] Enabled collectors:
INFO[0000]  - map
INFO[0000]  - playercount
INFO[0000] Listening on :9137
DEBU[0001] Waiting for collectors
ERRO[0001] got panic while connecting to server, reconnecting  server=insurgency
DEBU[0001] playercount collector succeeded after 0.000025s.
ERRO[0001] got panic while connecting to server, reconnecting  server=insurgency
DEBU[0001] map collector succeeded after 0.000046s.
DEBU[0001] Finished waiting for collectors
DEBU[0001] Updated lastCollectTime to 2023-08-15 04:44:02.854651593 +0000 UTC m=+1.577396704
DEBU[0001] Waiting for outgoing Adapter
DEBU[0001] Finished pushing metrics from metricsCh to outgoingCh
DEBU[0001] Finished waiting for outgoing Adapter

Could you add the error reported by recover() to the log message? This would help users determine what the error is.

solidDoWant avatar Aug 15 '23 04:08 solidDoWant

@solidDoWant I have pushed a commit to main that should log the panic/error message now. Are you able to build from the repo or want me to create a release with that change?

galexrt avatar Aug 15 '23 11:08 galexrt

@galexrt thanks for the change. I built it locally, but FYI I am unable to build a container image via make docker as the dockerfile depends on a non-existent .build directory.

Here's the output when running locally with the latest code from master:

time="2023-08-15T15:15:24-05:00" level=info msg="Starting srcds_exporter (version=, branch=, revision=cf3ed98aebf599d3e2a06bb1fdc090f8ffd14231-modified)"
time="2023-08-15T15:15:24-05:00" level=info msg="Build context (go=go1.21.0, platform=linux/amd64, user=, date=)"
time="2023-08-15T15:15:24-05:00" level=info msg="Caching is disabled by default"
time="2023-08-15T15:15:24-05:00" level=debug msg="Connected to server: 10.44.0.12:27015"
time="2023-08-15T15:15:24-05:00" level=info msg="Loaded config file"
time="2023-08-15T15:15:24-05:00" level=info msg="Enabled collectors:"
time="2023-08-15T15:15:24-05:00" level=info msg=" - playercount"
time="2023-08-15T15:15:24-05:00" level=info msg=" - map"
time="2023-08-15T15:15:24-05:00" level=info msg="Listening on :9137"
time="2023-08-15T15:15:26-05:00" level=debug msg="Waiting for collectors"
time="2023-08-15T15:15:26-05:00" level=error msg="got panic while connecting to server, reconnecting: runtime error: invalid memory address or nil pointer dereference" server=insurgency
time="2023-08-15T15:15:26-05:00" level=debug msg="map collector succeeded after 0.000045s."
time="2023-08-15T15:15:26-05:00" level=error msg="got panic while connecting to server, reconnecting: runtime error: invalid memory address or nil pointer dereference" server=insurgency
time="2023-08-15T15:15:26-05:00" level=debug msg="playercount collector succeeded after 0.000589s."
time="2023-08-15T15:15:26-05:00" level=debug msg="Finished waiting for collectors"
time="2023-08-15T15:15:26-05:00" level=debug msg="Updated lastCollectTime to 2023-08-15 15:15:26.3835836 -0500 CDT m=+1.931926383"
time="2023-08-15T15:15:26-05:00" level=debug msg="Waiting for outgoing Adapter"
time="2023-08-15T15:15:26-05:00" level=debug msg="Finished pushing metrics from metricsCh to outgoingCh"
time="2023-08-15T15:15:26-05:00" level=debug msg="Finished waiting for outgoing Adapter"

solidDoWant avatar Aug 15 '23 20:08 solidDoWant

I'm getting a similar issue with RCON mode enabled. I've filed a fix PR here: https://github.com/galexrt/srcds_exporter/pull/8. Would you mind cutting a new release if you approve and merge this PR?

@Nerus87 if you are trying to use RCON mode as your issue would indicate then you'll need to set servers.<server name>.mode: RCON as shown below:

---
options:
  connectTimeout: 5s
  cacheExpiration: 20s
  cacheCleanupInterval: 12s
servers:
  insurgency:
    address: MY_SERVER_ADDRESS
    rconPassword: MY_RCON_PASSWORD
    mode: RCON

solidDoWant avatar Aug 15 '23 22:08 solidDoWant

Regarding this issue (with ServerQuery instead of RCON mode), Golang is reporting that the UDP connection to the server is closed when this call is made in the underlying serverquery library. That being said, I can confirm via packet capture that the Source server does in fact send the server info back to the exporter client, so I'm not sure why the connection is being prematurely closed.

solidDoWant avatar Aug 15 '23 22:08 solidDoWant

@solidDoWant I have created a new release, in a few minutes the v1.6.0 release should be available.

galexrt avatar Aug 19 '23 10:08 galexrt

Has the v1.6.0 release resolved your issue? If not, please comment and I'll reopen the issue.

galexrt avatar May 30 '24 11:05 galexrt