SeleniumHQ/seleniumhq.github.io

[๐Ÿ› Bug]: With custom node example, node never see it's registered

bhecquet opened this issue ยท 7 comments

What happened?

Hello,

using your sample code on https://www.selenium.dev/documentation/grid/advanced_features/customize_node/, I noticed that node never see it's registered
It's due to

protected DecoratedLoggingNode(Tracer tracer, URI uri, Secret registrationSecret) {
    super(tracer, new NodeId(UUID.randomUUID()), uri, registrationSecret);
  }

where we generate a new NodeId

in https://github.com/SeleniumHQ/selenium/blob/81865828a275ba384bc96fe10493cb1f7ee03f91/java/src/org/openqa/selenium/grid/node/httpd/NodeServer.java#L220

we get node status from node created with

Node node = LocalNodeFactory.create(config);

which has a different id than our custom node,
So when getting hub "node-added" registration event

https://github.com/SeleniumHQ/selenium/blob/81865828a275ba384bc96fe10493cb1f7ee03f91/java/src/org/openqa/selenium/grid/node/httpd/NodeServer.java#L143

ids do not match

Instead, constructor should reuse the id of the LocalNode

Node node = LocalNodeFactory.create(config);

DecoratedLoggingNode wrapper = new DecoratedLoggingNode(loggingOptions.getTracer(),
				node.getId(),
				uri,
				secretOptions.getRegistrationSecret());

What browsers and operating systems are you seeing the problem on?

chrome / windows

@bhecquet, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

diemol commented

@krmahadevan do you have a moment to have a look at this, please?

@diemol Sure. Will take a look.

@diemol - Observations made by @bhecquet are valid.

@bhecquet - Would you like to raise a PR for the documentation which makes this change and contribute ?

@krmahadevan , sure, will do that in a few days

I've created the PR: #1576

diemol commented

Thanks for contributing, @bhecquet!