@mark1russell7/harness 0.11.5 → 0.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/image/hikari/ClientHikari.java +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -162,6 +162,7 @@ The harness ships eight images, each as a shipped source (`ImageSource`). The ta
|
|
|
162
162
|
- **The HikariCP client image** (`image/hikari`) is HikariCP 7.1.0 over pgjdbc 42.7.13 on Temurin 21.0.12.1. The digests of the two stages and the SHA-256 of each jar pin them. The probe is `{ driver: { name: "hikari", query } }`.
|
|
163
163
|
- `ClientHikari.java` makes one `HikariDataSource` with the properties of the cell (`Cell.driverOptions`). A name with the prefix `dataSource.` is a property of pgjdbc.
|
|
164
164
|
- It prints the lines of the pg client on the same clock. Each socket comes from the `PGStream` of its connection, and a `pool` line gives each change of the counts of the pool. The errno of a failure is the SQLState of pgjdbc.
|
|
165
|
+
- Before its first line, it loads the classes of a connect and of a pool on the loopback of its namespace. It also starts the SecureRandom that HikariCP reads for the UUID of each new connection. A new JVM loads each class at its first use. Thus a cell that starts into a fault does not time that load.
|
|
165
166
|
- **The MongoDB client image** (`image/mongo`) is the driver mongodb 7.7.0 on Node 24.21.0. The digest of the image and an npm lockfile pin them. `client-mongo.mjs` prints the lines of the TCP client on the same clock:
|
|
166
167
|
- Each socket of the driver is a `socket` line with its role: `monitor`, `rtt` or `pool`. The stack of the call that makes the socket gives the role.
|
|
167
168
|
- The events of the driver are `sdam` lines (the heartbeats and the changes of each server), `cmap` lines (the pools) and `command` lines (each try of an operation).
|
|
@@ -361,6 +361,35 @@ public final class ClientHikari {
|
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
+
/**
|
|
365
|
+
* This function loads the code of a connect and of the start of a pool before the first line, on
|
|
366
|
+
* the loopback of the namespace. A new JVM loads each class at its first use, and that load would
|
|
367
|
+
* be in the band of a cell that starts into a fault. A pool with no check and no idle connection
|
|
368
|
+
* makes no connection: it loads the classes of the pool. It also sets the login timeout of
|
|
369
|
+
* DriverManager, thus pgjdbc then connects in a task of an executor (Driver.java:303-311,
|
|
370
|
+
* :730-739). A connect to port 1 of the loopback after it is refused at once: it loads that
|
|
371
|
+
* connect of pgjdbc and its errors. HikariCP gives each new connection a random UUID (PoolBase.java:363), and the
|
|
372
|
+
* first one starts the SecureRandom of the JVM.
|
|
373
|
+
*/
|
|
374
|
+
private static void warmUp() {
|
|
375
|
+
HikariConfig empty = new HikariConfig();
|
|
376
|
+
empty.setJdbcUrl("jdbc:postgresql://127.0.0.1:1/warmup");
|
|
377
|
+
empty.setUsername("warmup");
|
|
378
|
+
empty.setPoolName("warmup");
|
|
379
|
+
empty.setInitializationFailTimeout(-1);
|
|
380
|
+
empty.setMinimumIdle(0);
|
|
381
|
+
// the pool starts and closes with no connection
|
|
382
|
+
new HikariDataSource(empty).close();
|
|
383
|
+
Properties refused = new Properties();
|
|
384
|
+
refused.setProperty("user", "warmup");
|
|
385
|
+
try {
|
|
386
|
+
new org.postgresql.Driver().connect("jdbc:postgresql://127.0.0.1:1/warmup", refused);
|
|
387
|
+
} catch (SQLException expected) {
|
|
388
|
+
// the refusal is the purpose of the connect
|
|
389
|
+
}
|
|
390
|
+
java.util.UUID.randomUUID();
|
|
391
|
+
}
|
|
392
|
+
|
|
364
393
|
public static void main(String[] args) throws Exception {
|
|
365
394
|
List<String> argv = List.of(args);
|
|
366
395
|
String mode = flag(argv, "--mode", null);
|
|
@@ -376,6 +405,7 @@ public final class ClientHikari {
|
|
|
376
405
|
query = flag(argv, "--query", "SELECT 1");
|
|
377
406
|
boolean before = argv.contains("--before");
|
|
378
407
|
Map<String, String> options = parseObject(flag(argv, "--options", "{}"));
|
|
408
|
+
warmUp();
|
|
379
409
|
|
|
380
410
|
String bootId;
|
|
381
411
|
try {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@mark1russell7/harness",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.6",
|
|
5
5
|
"description": "A fault-injection harness for connection timers: a cell runs a client against a stock target in Docker, through a topology of routers and proxies, a replicated group under Sentinels or a replica set, injects a fault, measures the kernel's own records and judges a prediction. HTTP clients of Go, Node and undici race the keep-alive of a Node server, and the MongoDB driver meets the faults of a replica set. The WebSocket client of @procedures/client drops a silent connection on its own heartbeat, and the harness times that detection and the reconnect from the program's lines and the kernel's stamps.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"fault-injection",
|