Skip to content

Commit d9f8c4c

Browse files
authored
Merge branch 'trunk' into response-type
2 parents 6285202 + ec6e817 commit d9f8c4c

File tree

10 files changed

+439
-315
lines changed

10 files changed

+439
-315
lines changed

java/src/org/openqa/selenium/grid/distributor/GridModel.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ public void add(NodeStatus node) {
114114
"Re-adding node with id %s and URI %s.",
115115
node.getNodeId(), node.getExternalUri()));
116116

117-
events.fire(new NodeRestartedEvent(node));
117+
// Send the previous state to allow cleaning up the old node related resources.
118+
// Nodes are initially added in the "down" state, so the new state must be ignored.
119+
events.fire(new NodeRestartedEvent(next));
118120
iterator.remove();
119121
break;
120122
}
@@ -226,7 +228,8 @@ public void purgeDeadNodes() {
226228
if (nodeHealthCount.getOrDefault(id, 0) > UNHEALTHY_THRESHOLD) {
227229
LOG.info(
228230
String.format(
229-
"Removing Node %s, unhealthy threshold has been reached", node.getExternalUri()));
231+
"Removing Node %s (uri: %s), unhealthy threshold has been reached",
232+
node.getNodeId(), node.getExternalUri()));
230233
toRemove.add(node);
231234
break;
232235
}
@@ -239,11 +242,17 @@ public void purgeDeadNodes() {
239242
lastTouched.plus(node.getHeartbeatPeriod().multipliedBy(PURGE_TIMEOUT_MULTIPLIER));
240243

241244
if (node.getAvailability() == UP && lostTime.isBefore(now)) {
242-
LOG.info(String.format("Switching Node %s from UP to DOWN", node.getExternalUri()));
245+
LOG.info(
246+
String.format(
247+
"Switching Node %s (uri: %s) from UP to DOWN",
248+
node.getNodeId(), node.getExternalUri()));
243249
replacements.put(node, rewrite(node, DOWN));
244250
nodePurgeTimes.put(id, Instant.now());
245251
} else if (node.getAvailability() == DOWN && deadTime.isBefore(now)) {
246-
LOG.info(String.format("Removing Node %s, DOWN for too long", node.getExternalUri()));
252+
LOG.info(
253+
String.format(
254+
"Removing Node %s (uri: %s), DOWN for too long",
255+
node.getNodeId(), node.getExternalUri()));
247256
toRemove.add(node);
248257
}
249258
}

java/src/org/openqa/selenium/grid/distributor/local/LocalDistributor.java

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ public LocalDistributor(
206206

207207
bus.addListener(NodeStatusEvent.listener(this::register));
208208
bus.addListener(NodeStatusEvent.listener(model::refresh));
209-
bus.addListener(NodeRestartedEvent.listener(this::handleNodeRestarted));
209+
bus.addListener(
210+
NodeRestartedEvent.listener(previousNodeStatus -> remove(previousNodeStatus.getNodeId())));
210211
bus.addListener(NodeRemovedEvent.listener(nodeStatus -> remove(nodeStatus.getNodeId())));
211212
bus.addListener(
212213
NodeHeartBeatEvent.listener(
@@ -329,25 +330,6 @@ private void register(NodeStatus status) {
329330
}
330331
}
331332

332-
private void handleNodeRestarted(NodeStatus status) {
333-
Require.nonNull("Node", status);
334-
Lock writeLock = lock.writeLock();
335-
writeLock.lock();
336-
try {
337-
if (!nodes.containsKey(status.getNodeId())) {
338-
return;
339-
}
340-
if (!getNodeFromURI(status.getExternalUri()).isDraining()) {
341-
LOG.info(
342-
String.format(
343-
"Node %s has restarted. Setting availability to DOWN.", status.getNodeId()));
344-
model.setAvailability(status.getNodeId(), DOWN);
345-
}
346-
} finally {
347-
writeLock.unlock();
348-
}
349-
}
350-
351333
@Override
352334
public LocalDistributor add(Node node) {
353335
Require.nonNull("Node", node);
@@ -499,15 +481,13 @@ public void remove(NodeId nodeId) {
499481
Lock writeLock = lock.writeLock();
500482
writeLock.lock();
501483
try {
502-
Node node = nodes.get(nodeId);
484+
Node node = nodes.remove(nodeId);
485+
model.remove(nodeId);
486+
allChecks.remove(nodeId);
503487

504488
if (node instanceof RemoteNode) {
505489
((RemoteNode) node).close();
506490
}
507-
508-
nodes.remove(nodeId);
509-
model.remove(nodeId);
510-
allChecks.remove(nodeId);
511491
} finally {
512492
writeLock.unlock();
513493
}

java/src/org/openqa/selenium/grid/sessionmap/jdbc/JdbcBackedSessionMap.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public JdbcBackedSessionMap(Tracer tracer, Connection jdbcConnection, EventBus b
9292
.forEach(this::remove)));
9393

9494
bus.addListener(
95-
NodeRestartedEvent.listener(nodeStatus -> this.removeByUri(nodeStatus.getExternalUri())));
95+
NodeRestartedEvent.listener(
96+
previousNodeStatus -> this.removeByUri(previousNodeStatus.getExternalUri())));
9697
}
9798

9899
public static SessionMap create(Config config) {

java/src/org/openqa/selenium/grid/sessionmap/local/LocalSessionMap.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ public LocalSessionMap(Tracer tracer, EventBus bus) {
6767

6868
bus.addListener(
6969
NodeRestartedEvent.listener(
70-
nodeStatus -> {
70+
previousNodeStatus -> {
7171
List<SessionId> toRemove =
7272
knownSessions.entrySet().stream()
73-
.filter((e) -> e.getValue().getUri().equals(nodeStatus.getExternalUri()))
73+
.filter(
74+
(e) -> e.getValue().getUri().equals(previousNodeStatus.getExternalUri()))
7475
.map(Map.Entry::getKey)
7576
.collect(Collectors.toList());
7677

java/src/org/openqa/selenium/grid/sessionmap/redis/RedisBackedSessionMap.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ public RedisBackedSessionMap(Tracer tracer, URI serverUri, EventBus bus) {
8787
.forEach(this::remove)));
8888

8989
bus.addListener(
90-
NodeRestartedEvent.listener(nodeStatus -> this.removeByUri(nodeStatus.getExternalUri())));
90+
NodeRestartedEvent.listener(
91+
previousNodeStatus -> this.removeByUri(previousNodeStatus.getExternalUri())));
9192
}
9293

9394
public static SessionMap create(Config config) {

javascript/grid-ui/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ esbuild(
7979
"os",
8080
"path",
8181
"util",
82-
"@novnc/novnc/core/rfb",
8382
],
8483
format = "iife",
8584
minify = True,

javascript/grid-ui/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"type": "module",
66
"dependencies": {
77
"@apollo/client": "3.12.4",
8-
"@emotion/react": "11.13.3",
9-
"@emotion/styled": "11.13.0",
8+
"@emotion/react": "11.14.0",
9+
"@emotion/styled": "11.14.0",
1010
"@mui/icons-material": "5.15.18",
1111
"@mui/material": "5.15.18",
1212
"@novnc/novnc": "1.5.0",
@@ -16,10 +16,10 @@
1616
"@types/react-dom": "18.2.22",
1717
"@types/react-modal": "3.16.3",
1818
"@types/react-router-dom": "5.3.3",
19-
"graphql": "16.9.0",
19+
"graphql": "16.10.0",
2020
"graphql.macro": "1.4.2",
2121
"path-browserify": "1.0.1",
22-
"pretty-ms": "9.1.0",
22+
"pretty-ms": "9.2.0",
2323
"react": "18.3.1",
2424
"react-dom": "18.3.1",
2525
"react-modal": "3.16.3",
@@ -47,13 +47,13 @@
4747
]
4848
},
4949
"devDependencies": {
50-
"@babel/preset-react": "7.25.9",
50+
"@babel/preset-react": "7.26.3",
5151
"@testing-library/jest-dom": "6.6.3",
5252
"@testing-library/react": "14.3.1",
5353
"@testing-library/user-event": "14.5.2",
5454
"esbuild": "0.24.2",
5555
"ts-standard": "12.0.2",
56-
"typescript": "5.6.3"
56+
"typescript": "5.7.2"
5757
},
5858
"jest": {
5959
"testMatch": [

javascript/grid-ui/src/components/LiveView/LiveView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// under the License.
1717

1818
import React, { useEffect, useState, useImperativeHandle, forwardRef } from 'react'
19-
import RFB from '@novnc/novnc/core/rfb'
19+
import RFB from '@novnc/novnc/lib/rfb'
2020
import PasswordDialog from './PasswordDialog'
2121
import MuiAlert, { AlertProps } from '@mui/material/Alert'
2222
import Snackbar from '@mui/material/Snackbar'

javascript/node/selenium-webdriver/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,25 @@
2929
"ws": "^8.18.0"
3030
},
3131
"devDependencies": {
32-
"@eslint/js": "^9.14.0",
32+
"@eslint/js": "^9.17.0",
3333
"clean-jsdoc-theme": "^4.3.0",
34-
"eslint": "^9.14.0",
34+
"eslint": "^9.17.0",
3535
"eslint-config-prettier": "^9.1.0",
3636
"eslint-plugin-mocha": "^10.5.0",
37-
"eslint-plugin-n": "^17.13.1",
37+
"eslint-plugin-n": "^17.15.1",
3838
"eslint-plugin-no-only-tests": "^3.3.0",
3939
"eslint-plugin-prettier": "^5.2.1",
40-
"express": "^4.21.1",
41-
"globals": "^15.12.0",
40+
"express": "^4.21.2",
41+
"globals": "^15.14.0",
4242
"has-flag": "^5.0.1",
4343
"jsdoc": "^4.0.4",
44-
"mocha": "^10.8.2",
44+
"mocha": "^11.0.1",
4545
"mocha-junit-reporter": "^2.2.1",
4646
"multer": "1.4.5-lts.1",
47-
"prettier": "^3.3.3",
47+
"prettier": "^3.4.2",
4848
"serve-index": "^1.9.1",
4949
"sinon": "^19.0.2",
50-
"supports-color": "^9.4.0"
50+
"supports-color": "^10.0.0"
5151
},
5252
"scripts": {
5353
"lint": "eslint .",

0 commit comments

Comments
 (0)