Skip to content

[grid] Reduce redundant logs of find slots and retry queue requests by the Distributor #16155

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

Merged
merged 4 commits into from
Aug 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public void run() {
// up starving a session request.
Map<Capabilities, Long> stereotypes =
getAvailableNodes().stream()
.filter(node -> node.hasCapacity())
.filter(NodeStatus::hasCapacity)
.flatMap(node -> node.getSlots().stream().map(Slot::getStereotype))
.collect(
Collectors.groupingBy(ImmutableCapabilities::copyOf, Collectors.counting()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,8 @@ public Set<NodeStatus> getAvailableNodes() {
readLock.lock();
try {
return model.getSnapshot().stream()
.filter(
node ->
!DOWN.equals(node.getAvailability()) && !DRAINING.equals(node.getAvailability()))
// Filter nodes are UP and have capacity (available slots)
.filter(node -> UP.equals(node.getAvailability()) && node.hasCapacity())
.collect(ImmutableSet.toImmutableSet());
} finally {
readLock.unlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import org.openqa.selenium.grid.data.TraceSessionRequest;
import org.openqa.selenium.grid.distributor.config.DistributorOptions;
import org.openqa.selenium.grid.jmx.JMXHelper;
import org.openqa.selenium.grid.jmx.MBean;
import org.openqa.selenium.grid.jmx.ManagedAttribute;
import org.openqa.selenium.grid.jmx.ManagedService;
import org.openqa.selenium.grid.log.LoggingOptions;
Expand Down Expand Up @@ -110,6 +111,7 @@ public class LocalNewSessionQueue extends NewSessionQueue implements Closeable {
thread.setName(NAME);
return thread;
});
private final MBean jmxBean;

public LocalNewSessionQueue(
Tracer tracer,
Expand Down Expand Up @@ -139,7 +141,8 @@ public LocalNewSessionQueue(
requestTimeoutCheck.toMillis(),
MILLISECONDS);

new JMXHelper().register(this);
// Manage JMX and unregister on close()
this.jmxBean = new JMXHelper().register(this);
}

public static NewSessionQueue create(Config config) {
Expand Down Expand Up @@ -502,6 +505,10 @@ public boolean isReady() {
@Override
public void close() {
shutdownGracefully(NAME, service);

if (jmxBean != null) {
new JMXHelper().unregister(jmxBean.getObjectName());
}
}

private void failDueToTimeout(RequestId reqId) {
Expand Down
Loading
Loading