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

[Bug]: HotRod run failed if using the old env variable #5759

Closed
asatt opened this issue Jul 17, 2024 · 2 comments · Fixed by #5760
Closed

[Bug]: HotRod run failed if using the old env variable #5759

asatt opened this issue Jul 17, 2024 · 2 comments · Fixed by #5760

Comments

@asatt
Copy link

asatt commented Jul 17, 2024

What happened?

The HotRod can fail if we try to run it in Kubernetes with Jaeger Agent (with a Service name jaeger-agent) or with one of the old parameters like JAEGER_AGENT_PORT (that have OTEL_EXPORTER_* alternatives).

During a short investigation, I found the issue added after PR #5437.
After removing expvar the method

jaegerclientenv2otel.MapJaegerToOtelEnvVars(logger)

here https://github.com/jaegertracing/jaeger/blob/main/examples/hotrod/cmd/root.go#L59
now calling with a non-initialized logger variable.

As a result, the logger in jaegerclientenv2otel.MapJaegerToOtelEnvVars will fail
https://github.com/jaegertracing/jaeger/blob/main/internal/jaegerclientenv2otel/envvars.go#L57
with nil pointer.

Steps to reproduce

  1. Add in ENV the variable like JAEGER_AGENT_HOST=<value> or JAEGER_AGENT_PORT=<value> (in Kubernetes deployment or for local run)
  2. Run HotRod

Expected behavior

It should run as usual, without exceptions, and print in logs

Replacing deprecated Jaeger SDK env var %s with OpenTelemetry env var %s

Relevant log output

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa6d5c5]
goroutine 1 [running]:
go.uber.org/zap.(*Logger).clone(...)
 go.uber.org/[email protected]/logger.go:318
go.uber.org/zap.(*Logger).Sugar(...)
 go.uber.org/[email protected]/logger.go:147
github.com/jaegertracing/jaeger/internal/jaegerclientenv2otel.MapJaegerToOtelEnvVars(0x0)
 github.com/jaegertracing/jaeger/internal/jaegerclientenv2otel/envvars.go:57 +0x1a5
github.com/jaegertracing/jaeger/examples/hotrod/cmd.onInitialize()
 github.com/jaegertracing/jaeger/examples/hotrod/cmd/root.go:59 +0x29
github.com/spf13/cobra.(*Command).preRun(...)
 github.com/spf13/[email protected]/command.go:1019
github.com/spf13/cobra.(*Command).execute(0x1221740, {0x128eb40, 0x0, 0x0})
 github.com/spf13/[email protected]/command.go:929 +0x5a2
github.com/spf13/cobra.(*Command).ExecuteC(0x1221180)
 github.com/spf13/[email protected]/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
 github.com/spf13/[email protected]/command.go:1041
github.com/jaegertracing/jaeger/examples/hotrod/cmd.Execute()
 github.com/jaegertracing/jaeger/examples/hotrod/cmd/root.go:46 +0x26
main.main()
 ./main.go:11 +0xf

Screenshot

No response

Additional context

I'm using the HotRod with the ENV OTEL_EXPORTER_OTLP_ENDPOINT. By mistake, I deployed the deprecated Jaeger Agent (as a DaemonSet) with a Kubernetes Service jaeger-agent name. So Kubernetes injected the ENV JAEGER_AGENT_PORT inside the HotRod pod and the HotRod started crashing with the error.

Jaeger backend version

v1.58.x

SDK

No response

Pipeline

No response

Stogage backend

Cassandra

Operating system

Linux

Deployment model

Kubernetes, binaries

Deployment configs

No response

@asatt asatt added the bug label Jul 17, 2024
@yurishkuro yurishkuro added help wanted Features that maintainers are willing to accept but do not have cycles to implement good first issue Good for beginners and removed help wanted Features that maintainers are willing to accept but do not have cycles to implement good first issue Good for beginners labels Jul 17, 2024
@yurishkuro
Copy link
Member

Thanks for reporting. Fix #5760

@Manoramsharma
Copy link
Contributor

I was just about to make those changes 😄

FlamingSaint pushed a commit to FlamingSaint/jaeger that referenced this issue Jul 20, 2024
…gertracing#5760)

## Which problem is this PR solving?
- Resolves jaegertracing#5759 

## Description of the changes
- Invoke mapping function (which takes logger) after the logger is
initialized
- It is safe to do because none of the env vars control the logic for
logger initialization

## How was this change tested?
- `$ JAEGER_AGENT_PORT=xyz go run ./examples/hotrod  all`
- Before the change this command would cause a panic

Signed-off-by: Yuri Shkuro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants