@mark1russell7/harness 0.16.20 → 0.16.22

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/build/layers.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Kt as Topology } from "./cell-CgjwfQQ-.js";
1
+ import { Jt as Topology } from "./cell-CsI4nPck.js";
2
2
  /**
3
3
  * A layer is a rung of the laboratory (`docs/S7.md`). E1 is containers on one kernel, and E2 is a
4
4
  * cluster of containers on one kernel. A lab with `Topology.fabric` writes E3: routers in containers.
package/build/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { I as ImageSource, Wt as Subject, i as Client, o as ClientImage } from "./cell-CgjwfQQ-.js";
1
+ import { Kt as Subject, L as ImageSource, i as Client, o as ClientImage } from "./cell-CsI4nPck.js";
2
2
  import { z } from "zod";
3
3
  /**
4
4
  * This schema accepts the source of an image (`ImageSource`). It is a pinned image with its digest,
package/build/schema.js CHANGED
@@ -1,4 +1,4 @@
1
- import { O as subjectProblems, V as CLIENT_CAPABILITIES, a as SHIPPED_NAMES, h as imageProblems, t as CLIENT_NAMES } from "./image-38hbUAcd.js";
1
+ import { O as subjectProblems, V as CLIENT_CAPABILITIES, a as SHIPPED_NAMES, h as imageProblems, t as CLIENT_NAMES } from "./image-B1jai9Lq.js";
2
2
  import { z } from "zod";
3
3
  // src/schema.ts
4
4
  /** This function adds each problem that a check finds as an issue of a schema. */
@@ -243,6 +243,13 @@ fn lock() -> bool {
243
243
  unsafe { libc::mlockall(libc::MCL_CURRENT) == 0 }
244
244
  }
245
245
 
246
+ /// Linux gives `EINVAL` for `MADV_NOHUGEPAGE` when the kernel has no transparent huge pages
247
+ /// (`CONFIG_TRANSPARENT_HUGEPAGE` is not set). Then the fault of each page takes one page, and the
248
+ /// advice has nothing to turn off. The range of a new mapping is aligned, thus `EINVAL` has no other cause here.
249
+ fn no_huge_pages(error: &std::io::Error) -> bool {
250
+ error.raw_os_error() == Some(libc::EINVAL)
251
+ }
252
+
246
253
  /// Anonymous memory with no huge pages: the fault of each page charges one page to the cgroup.
247
254
  struct Region {
248
255
  base: *mut u8,
@@ -269,7 +276,10 @@ impl Region {
269
276
  }
270
277
  // SAFETY: the range is the mapping above
271
278
  if unsafe { libc::madvise(base, bytes, libc::MADV_NOHUGEPAGE) } != 0 {
272
- return Err(std::io::Error::last_os_error().into());
279
+ let error = std::io::Error::last_os_error();
280
+ if !no_huge_pages(&error) {
281
+ return Err(error.into());
282
+ }
273
283
  }
274
284
  Ok(Region { base: base.cast(), pages, page })
275
285
  }
@@ -457,4 +467,12 @@ mod tests {
457
467
  // SAFETY: the page is inside the mapping
458
468
  assert_eq!(unsafe { std::ptr::read_volatile(region.base.add((7 * page) as usize)) }, 1);
459
469
  }
470
+
471
+ #[test]
472
+ fn einval_of_the_advice_is_a_kernel_with_no_huge_pages_and_each_other_error_stays() {
473
+ assert!(no_huge_pages(&std::io::Error::from_raw_os_error(libc::EINVAL)));
474
+ assert!(!no_huge_pages(&std::io::Error::from_raw_os_error(libc::ENOMEM)));
475
+ assert!(!no_huge_pages(&std::io::Error::from_raw_os_error(libc::EPERM)));
476
+ assert!(!no_huge_pages(&std::io::Error::other("no code")));
477
+ }
460
478
  }
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.16.20",
4
+ "version": "0.16.22",
5
5
  "description": "Network labs in Docker, declared as data. A cell builds a topology of networks, routers and proxies around a stock target. It injects a fault at layer 3 or 4 from a NET_ADMIN sidecar, measures the records of the kernel and judges a prediction. The faults are black holes, resets, ICMP unreachable, one-way and MTU drops, tc netem, the toxics of Toxiproxy and frozen processes. Its disk tier cuts the power of a program on LazyFS: the disk loses each write after the last fsync. Its memory tier sets the limits of the cgroup of a client, and judges its throttle above memory.high and the choice of the OOM killer. Its egress tier puts a netem or tbf qdisc on the interface of a client, and judges the departure of each datagram from the stamps of the kernel. Its replicated groups are Redis with Sentinels, MongoDB replica sets, PostgreSQL standbys, Kafka, RabbitMQ and BGP fabrics with BFD. A lab can also operate in a QEMU guest. Its first use is connection timers: keep-alive, TCP retransmission, heartbeats and reconnects.",
6
6
  "keywords": [
7
7
  "fault-injection",