You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[🐛 Bug]: "java.lang.IllegalStateException: Context has not been changed" error is thrown by Selenium server running in a hub mode during attempt to add node when using OpenTelemetry instrumentation agent
#15552
Open
AndriyShykin opened this issue
Apr 2, 2025
· 4 comments
"java.lang.IllegalStateException: Context has not been changed" exception is thrown by Selenium server running in a hub mode, and the node is not added.
java --version output:
java 21.0.3 2024-04-16 LTS
Java(TM) SE Runtime Environment (build 21.0.3+7-LTS-152)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.3+7-LTS-152, mixed mode, sharing)
Selenium hub is started by command:
java -javaagent:opentelemetry-javaagent.jar -jar selenium-server-4.30.0.jar hub --log-level fine
Selenium node is started by command:
java -jar selenium-server-4.30.0.jar node
Relevant log output
07:42:02.332 DEBUG [LocalDistributor.add] - Exception while adding Node http://***.***.**.**:5555
java.lang.IllegalStateException: Context has not been changed
at org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryContext.createSpan(OpenTelemetryContext.java:59)
at org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryContext.createSpan(OpenTelemetryContext.java:30)
at org.openqa.selenium.remote.tracing.HttpTracing.newSpanAsChildOf(HttpTracing.java:48)
at org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:50)
at org.openqa.selenium.grid.node.remote.RemoteNode.getStatus(RemoteNode.java:254)
at org.openqa.selenium.grid.distributor.local.LocalDistributor.add(LocalDistributor.java:350)
at org.openqa.selenium.grid.distributor.local.LocalDistributor.register(LocalDistributor.java:335)
at org.openqa.selenium.events.EventListener.accept(EventListener.java:42)
at org.openqa.selenium.events.EventListener.accept(EventListener.java:24)
at org.openqa.selenium.events.zeromq.UnboundZmqEventBus$PollingRunnable.lambda$notifyListeners$2(UnboundZmqEventBus.java:325)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Operating System
macOS 15.4
Selenium version
Java 4.30.0
What are the browser(s) and version(s) where you see this issue?
What are the browser driver(s) and version(s) where you see this issue?
Are you using Selenium Grid?
4.30.0
The text was updated successfully, but these errors were encountered:
This happens for 4.29.0 too, so this is not related to 892babe in my mind.
@AndriyShykin why are you using the agent based instrumentation, selenium does implement tracing. So there should be no need to add this, but i never used it, so i might be wrong.
@joerg1985 Selenium needs external dependencies for telemetry on the classpath. I have used OpenTelemetry instrumentation agent before and the assumption was it should work here as well.
What happened?
I am encountering an error when trying to run Selenium grid in a hub-node mode with added OpenTelemetry instrumentation (https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar, version 2.14.0).
"java.lang.IllegalStateException: Context has not been changed" exception is thrown by Selenium server running in a hub mode, and the node is not added.
java --version output:
java 21.0.3 2024-04-16 LTS
Java(TM) SE Runtime Environment (build 21.0.3+7-LTS-152)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.3+7-LTS-152, mixed mode, sharing)
java -jar opentelemetry-javaagent.jar --version output:
2.14.0
How can we reproduce the issue?
Relevant log output
Operating System
macOS 15.4
Selenium version
Java 4.30.0
What are the browser(s) and version(s) where you see this issue?
What are the browser driver(s) and version(s) where you see this issue?
Are you using Selenium Grid?
4.30.0
The text was updated successfully, but these errors were encountered: