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

OpenTelemetry should not fail on context reloads #3841

Closed
frommeyerc opened this issue Aug 13, 2021 · 6 comments
Closed

OpenTelemetry should not fail on context reloads #3841

frommeyerc opened this issue Aug 13, 2021 · 6 comments
Labels
bug Something isn't working repro provided

Comments

@frommeyerc
Copy link
Contributor

Describe the bug
When using the spring-autoconfiguration integration and restarting the spring context (e.g. user spring-dev-tools) the new context fails to start. the reason is that the open-tracing integration tries to create and register a new version of the opentracing sdk. As this is build as enforced singleton an exception is thrown.

Interestingly there is a method called #resetForTest() that actually nulls the static field holding the globalOpenTelemetry.

Steps to reproduce

  • Add the spring autoconfiguration to a spring-boot project
  • Configure the spring-dev-tools
  • Start the server
  • Change code to trigger a hot reload
  • Observe issue.

What did you expect to see?
I expected the context to come up again without issue.

What did you see instead?
The context failing with a BeanInstatiationException

What version are you using?
1.4.1-alpha

Environment
Compiler: Eclipse Java 11
OS: "Ubuntu 20.04"

@frommeyerc frommeyerc added the bug Something isn't working label Aug 13, 2021
@jkwatson
Copy link
Contributor

Interesting. I suspect that the spring integration shouldn't be setting the global at all.

@anuraaga
Copy link
Contributor

anuraaga commented Aug 14, 2021

I'm not too familiar with how the reload works but am reading this

https://docs.spring.io/spring-boot/docs/current/reference/html/using.html#using.devtools.restart.customizing-the-classload

It seems to imply that only projects open in the IDE are loaded in the restart classloader. Since we'd expect our library to be included as a build dependency jar, it should be in the base classloader. Any idea why the Otel configuration is restarted or an approach to prevent it?

@trask
Copy link
Member

trask commented Aug 14, 2021

@frommeyerc can you provide a repro for this issue that we can use to investigate?

@frommeyerc
Copy link
Contributor Author

I should be able to compile s.th. in a couple of days.

@frommeyerc
Copy link
Contributor Author

I created a repository here: https://github.com/frommeyerc/otel-demo/tree/master/opentelemetry-refresh
The simple Spring-Boot application does nothing but exposing a hello world http endpoint. If started with

mvn spring-boot:run

from the command line it will start on port 8080. If you modify the code it will automatically try to reload the context and fail with an exception.

iNikem pushed a commit that referenced this issue Sep 24, 2021
@iNikem
Copy link
Contributor

iNikem commented Sep 27, 2021

Fixed by #4051

@iNikem iNikem closed this as completed Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working repro provided
Projects
None yet
Development

No branches or pull requests

6 participants