Skip to content

Example config cause panic #219

Closed
Closed

Description

@dawid-remitly

Describe the bug
Running test config from https://cloudprober.org/getting-started/ cause panic

Cloudprober Version v0.12.1

To Reproduce

cat > /tmp/cloudprober.cfg <<EOF
probe {
  name: "google_homepage"
  type: HTTP
  targets {
    host_names: "www.google.com"
  }
  interval_msec: 5000  # 5s
  timeout_msec: 1000   # 1s
}
EOF
$ cloudprober -config_file /tmp/cloudprober.cfg
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x40 pc=0x1039a3704]

goroutine 45 [running]:
github.com/cloudprober/cloudprober/probes/http.(*Probe).httpRequestForTarget(0x140001f72b0, {{0x1400031a18c, 0xe}, 0x0, {0x0, 0x0, 0x0}, 0x0, {0x0, 0x0, ...}})
	/Users/runner/work/cloudprober/cloudprober/probes/http/request.go:98 +0x104
github.com/cloudprober/cloudprober/probes/http.(*Probe).startForTarget(0x140001f72b0, {0x1042ba3c0, 0x14000456740}, {{0x1400031a18c, 0xe}, 0x0, {0x0, 0x0, 0x0}, 0x0, ...}, ...)
	/Users/runner/work/cloudprober/cloudprober/probes/http/http.go:483 +0xf0
github.com/cloudprober/cloudprober/probes/http.(*Probe).updateTargetsAndStartProbes.func2({{0x1400031a18c, 0xe}, 0x0, {0x0, 0x0, 0x0}, 0x0, {0x0, 0x0, 0x0}}, ...)
	/Users/runner/work/cloudprober/cloudprober/probes/http/http.go:578 +0x138
created by github.com/cloudprober/cloudprober/probes/http.(*Probe).updateTargetsAndStartProbes
	/Users/runner/work/cloudprober/cloudprober/probes/http/http.go:574 +0x53c

Additional context
tested on darwin-x86_64 and darwin-arm64, same result

Activity

  1. added
    bug
    on Nov 25, 2022
  2. manugarg commented on Nov 25, 2022

    @manugarg
    Contributor

    Good catch. Last change made http_probe a requires stanza. You can fix it for now by adding an empty http_probe stanza to your probe config. I'll follow up with a fix soon.

  3. added this to the v0.12.2 milestone on Nov 27, 2022
  4. vancouverwill commented on Jan 3, 2023

    @vancouverwill

    Good catch. Last change made http_probe a requires stanza. You can fix it for now by adding an empty http_probe stanza to your probe config. I'll follow up with a fix soon.

    yep changing the example config to the below got it working for me

    cat > /tmp/cloudprober.cfg <<EOF
    probe {
      name: "google_homepage"
      type: HTTP
      targets {
        host_names: "www.google.com"
      }
      interval_msec: 5000  # 5s
      timeout_msec: 1000   # 1s 
      http_probe {}
    }
    EOF
    

    Note the example works with older versions of cloudprober, I got it working with cloudprober/cloudprober:v0.11.8 for example.

  5. manugarg commented on Jan 5, 2023

    @manugarg
    Contributor

    Sorry for the delay in fixing this one. Yes, I made a change recently that's causing this panic.

  6. vancouverwill commented on Jan 5, 2023

    @vancouverwill

    Sorry for the delay in fixing this one. Yes, I made a change recently that's causing this panic.

    Hey no worries at all. I just used your suggestion and put the example of that config, as that worked for me and incase it was useful for anyone else 😄

  7. manugarg commented on Jan 26, 2023

    @manugarg
    Contributor

    Ha, it seems that my change didn't really fix it, see #236. Reopening it. Cc: @pa-vpap.

  8. manugarg commented on Jan 26, 2023

    @manugarg
    Contributor

    #237 for the real fix. Apologies for the incorrect fix last time. Ideal fix to catch such regressions will be to implement #224.

    @pa-vpap, in the meantime, you can either use the "master" tag (in a few minutes) or just add an empty http_probe config: http_probe {} to the probe stanza.

  9. modified the milestones: v0.12.2, v0.12.3 on Jan 26, 2023
  10. manugarg commented on Jan 26, 2023

    @manugarg
    Contributor

    I've verified that master image works with the given config. Closing this bug again. I'll release v0.12.3 soonish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions