From f1a5de98c9ddd25695efab825a6eba30d96b5a20 Mon Sep 17 00:00:00 2001 From: Patrik Wenger Date: Mon, 23 Nov 2026 00:37:14 +0100 Subject: [PATCH 1/2] Use OMQ for the Jupyter kernel transport Move the five Jupyter channels to omq-tokio 0.39.2 so heartbeat requests use its REP socket. Let ROUTER discard replies for clients that disconnected, and drain the control and IOPub sockets on shutdown with a one-second linger, so the final idle status after the shutdown reply reaches the client. Declare the OMQ toolchain requirement on the standalone kernel package. Keep the library on its CRAN toolchain. --- AGENTS.md | 3 +- Cargo.lock | 535 ++++++++++++++++++++++++------------ ggsql-jupyter/Cargo.toml | 11 +- ggsql-jupyter/src/kernel.rs | 125 ++++----- 4 files changed, 419 insertions(+), 255 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 4765be596..f9897d61e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -86,9 +86,10 @@ cargo +1.86 check --ignore-rust-version -p ggsql There is deliberately **no root `rust-toolchain.toml`**: pinning to 1.86 would force local `cargo test` and rust-analyzer onto the oldest supported toolchain. CI's default toolchain is stable — which still guards the MSRV, because clippy reads `rust-version`, not the toolchain — with the 1.86 check as its own step. -One thing is exempt from the 1.86 MSRV: +Two packages set their own toolchain requirements: - **The wasm bindings (`ggsql-wasm`).** R doesn't use wasm, and some wasm-only dependencies require a newer rustc, so the crate has no `rust-version` and a nested `ggsql-wasm/rust-toolchain.toml` selects **stable** for builds run from that directory (`./build-wasm.sh`, Cargo, or `pkg/`). +- **The Jupyter kernel (`ggsql-jupyter`).** The standalone kernel requires Rust 1.93 for `omq-tokio`. CRAN builds the library without the kernel. ### Rendering plots on Linux diff --git a/Cargo.lock b/Cargo.lock index 245294a65..9e0f3f9ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,7 +43,7 @@ dependencies = [ "regex", "toml", "windows-registry", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -126,7 +126,7 @@ dependencies = [ "ndk-context", "ndk-sys", "num_enum", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -191,7 +191,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -202,7 +202,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -229,6 +229,15 @@ dependencies = [ "derive_arbitrary", ] +[[package]] +name = "arc-swap" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b5d51209f6de83d37a0b33d320acb8da88823e42a94c075140708f032a5" +dependencies = [ + "rustversion", +] + [[package]] name = "arrayref" version = "0.3.9" @@ -442,30 +451,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "async-trait" -version = "0.1.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - -[[package]] -name = "asynchronous-codec" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a860072022177f903e59730004fb5dc13db9275b79bb2aef7ba8ce831956c233" -dependencies = [ - "bytes", - "futures-sink", - "futures-util", - "memchr", - "pin-project-lite", -] - [[package]] name = "atoi" version = "2.0.0" @@ -681,9 +666,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" [[package]] name = "calloop" @@ -737,9 +722,20 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cfg_aliases" -version = "0.2.1" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] [[package]] name = "chrono" @@ -751,7 +747,7 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -811,7 +807,7 @@ checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" dependencies = [ "serde", "termcolor", - "unicode-width 0.1.14", + "unicode-width 0.2.2", ] [[package]] @@ -857,6 +853,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" dependencies = [ "crossbeam-utils", + "loom", ] [[package]] @@ -986,6 +983,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -1073,9 +1079,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.21" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" [[package]] name = "crossterm" @@ -1102,7 +1108,7 @@ dependencies = [ "document-features", "mio", "parking_lot", - "rustix 1.1.4", + "rustix 1.1.6", "signal-hook", "signal-hook-mio", "winapi", @@ -1151,19 +1157,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "data-encoding" version = "2.11.0" @@ -1328,7 +1321,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -1363,6 +1356,19 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "fanring" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6e4e1667d04b51f74904b2bff5245040f3effdb70ef0fc8b0bb9c7d5e7598be" +dependencies = [ + "arc-swap", + "atomic-waker", + "concurrent-queue", + "loom", + "yring", +] + [[package]] name = "fastrand" version = "2.4.1" @@ -1492,7 +1498,7 @@ dependencies = [ "roxmltree", "smallvec", "windows", - "windows-core", + "windows-core 0.62.2", "yeslogic-fontconfig-sys", ] @@ -1548,11 +1554,25 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" dependencies = [ "futures-core", "futures-sink", @@ -1560,9 +1580,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" [[package]] name = "futures-intrusive" @@ -1577,39 +1597,40 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" [[package]] name = "futures-macro" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 3.0.4", ] [[package]] name = "futures-sink" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" [[package]] name = "futures-task" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" [[package]] name = "futures-util" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ + "futures-channel", "futures-core", "futures-io", "futures-macro", @@ -1620,6 +1641,20 @@ dependencies = [ "slab", ] +[[package]] +name = "generator" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6c6a73cd1aa4f4f00c02b109fa55d3a9d6ecc2fc4f53177b74ed6ee23b0c53" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows-core 0.100.0", + "windows-sys 0.61.2", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1650,7 +1685,7 @@ dependencies = [ "log", "serde", "serde_json", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -1673,8 +1708,8 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" dependencies = [ - "rustix 1.1.4", - "windows-link", + "rustix 1.1.6", + "windows-link 0.2.1", ] [[package]] @@ -1713,6 +1748,7 @@ dependencies = [ "cfg-if", "libc", "r-efi 6.0.0", + "rand_core 0.10.1", "wasip2", "wasip3", ] @@ -1778,6 +1814,7 @@ dependencies = [ "ggsql", "hex", "hmac", + "omq-tokio", "serde", "serde_json", "sha2", @@ -1787,7 +1824,6 @@ dependencies = [ "tracing", "tracing-subscriber", "uuid", - "zeromq", ] [[package]] @@ -1865,7 +1901,7 @@ dependencies = [ "hashbrown 0.16.1", "log", "presser", - "thiserror 2.0.18", + "thiserror 2.0.21", "windows", ] @@ -1932,12 +1968,6 @@ dependencies = [ "ahash 0.7.8", ] -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - [[package]] name = "hashbrown" version = "0.15.5" @@ -2012,7 +2042,7 @@ dependencies = [ "pollster", "pulldown-cmark", "skrifa 0.44.0", - "thiserror 2.0.18", + "thiserror 2.0.21", "tiff", "vello_common", "vello_hybrid", @@ -2158,7 +2188,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core", + "windows-core 0.62.2", ] [[package]] @@ -2391,9 +2421,9 @@ dependencies = [ "jni-sys 0.4.1", "log", "simd_cesu8", - "thiserror 2.0.18", + "thiserror 2.0.21", "walkdir", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -2504,7 +2534,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" dependencies = [ - "cpufeatures", + "cpufeatures 0.2.17", ] [[package]] @@ -2685,9 +2715,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.186" +version = "0.2.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" [[package]] name = "libduckdb-sys" @@ -2713,7 +2743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -2822,6 +2852,19 @@ dependencies = [ "logos-codegen", ] +[[package]] +name = "loom" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1611ddbf89dc6ae42cfbd51fc207836140130257646eab8d6d2fb16577db2d2" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + [[package]] name = "lru-slab" version = "0.1.2" @@ -2905,7 +2948,7 @@ dependencies = [ "once_cell", "rustc-hash 1.1.0", "spirv", - "thiserror 2.0.18", + "thiserror 2.0.21", "unicode-ident", ] @@ -2945,13 +2988,25 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "nix" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77730ed34f01f4990cb2ea67fec715ecebc6fab9a6396cf83c5529b13f581bdc" +dependencies = [ + "bitflags 2.11.1", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "nu-ansi-term" version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -3325,6 +3380,64 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "omq-proto" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de42c72d1af77214e0b5eeab072fed7cda19ffaa12a3dd0071fc54db4046de4" +dependencies = [ + "bytes", + "concurrent-queue", + "loom", + "patricia_tree", + "rand 0.10.4", + "smallvec", + "socket2", + "thiserror 2.0.21", +] + +[[package]] +name = "omq-shm" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5348117bf44bbc63ca264cebd02fc5a1438c0f09b354784da7692ecf2c1d941" +dependencies = [ + "arc-swap", + "bytes", + "concurrent-queue", + "omq-proto", + "rand 0.10.4", + "rustix 1.1.6", +] + +[[package]] +name = "omq-tokio" +version = "0.39.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "682d03a33f442e03bec9166b35adbb8ab28b98a633a13ac37727a4b42dbc13f1" +dependencies = [ + "arc-swap", + "bytes", + "concurrent-queue", + "crossbeam-utils", + "fanring", + "futures", + "libc", + "nix", + "omq-proto", + "omq-shm", + "parking_lot", + "pin-project-lite", + "rand 0.10.4", + "rustc-hash 2.1.3", + "smallvec", + "socket2", + "thiserror 2.0.21", + "tokio", + "tokio-util", + "yring", +] + [[package]] name = "once_cell" version = "1.21.4" @@ -3400,7 +3513,7 @@ dependencies = [ "libc", "redox_syscall 0.5.18", "smallvec", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -3476,6 +3589,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" +[[package]] +name = "patricia_tree" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd106b8571932f2b8d961a296390c56f05d454ce95e2405f1d8703ca0119e8e" + [[package]] name = "peniko" version = "0.6.1" @@ -3620,7 +3739,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix 1.1.4", + "rustix 1.1.6", "windows-sys 0.61.2", ] @@ -3777,10 +3896,10 @@ dependencies = [ "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 2.1.2", + "rustc-hash 2.1.3", "rustls", "socket2", - "thiserror 2.0.18", + "thiserror 2.0.21", "tokio", "tracing", "web-time", @@ -3797,11 +3916,11 @@ dependencies = [ "lru-slab", "rand 0.9.4", "ring", - "rustc-hash 2.1.2", + "rustc-hash 2.1.3", "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.18", + "thiserror 2.0.21", "tinyvec", "tracing", "web-time", @@ -3869,6 +3988,17 @@ dependencies = [ "rand_core 0.9.5", ] +[[package]] +name = "rand" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" +dependencies = [ + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.1", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -3907,6 +4037,12 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + [[package]] name = "range-alloc" version = "0.1.5" @@ -4157,7 +4293,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8a1f2315036ef6b1fbacd1972e8ee7688030b0a2121edfc2a6550febd41574d" dependencies = [ "hashbrown 0.16.1", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -4201,9 +4337,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" [[package]] name = "rustc_version" @@ -4229,15 +4365,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags 2.11.1", "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -4418,7 +4554,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -4543,9 +4679,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.15.1" +version = "1.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" [[package]] name = "smithay-client-toolkit" @@ -4594,7 +4730,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -4771,8 +4907,8 @@ dependencies = [ "fastrand", "getrandom 0.4.2", "once_cell", - "rustix 1.1.4", - "windows-sys 0.60.2", + "rustix 1.1.6", + "windows-sys 0.61.2", ] [[package]] @@ -4781,7 +4917,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -4805,7 +4941,7 @@ dependencies = [ "lazy-regex", "minimad", "serde", - "thiserror 2.0.18", + "thiserror 2.0.21", "unicode-width 0.1.14", ] @@ -4820,11 +4956,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.18" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" dependencies = [ - "thiserror-impl 2.0.18", + "thiserror-impl 2.0.21", ] [[package]] @@ -4840,13 +4976,13 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.18" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn 3.0.4", ] [[package]] @@ -4943,9 +5079,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.52.3" +version = "1.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" dependencies = [ "bytes", "libc", @@ -4981,14 +5117,14 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.18" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", + "futures-util", "pin-project-lite", "tokio", ] @@ -5385,7 +5521,7 @@ dependencies = [ "log", "peniko", "smallvec", - "thiserror 2.0.18", + "thiserror 2.0.21", ] [[package]] @@ -5398,7 +5534,7 @@ dependencies = [ "glifo", "hashbrown 0.17.1", "log", - "thiserror 2.0.18", + "thiserror 2.0.21", "vello_common", "vello_sparse_shaders", "wgpu", @@ -5569,7 +5705,7 @@ checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" dependencies = [ "cc", "downcast-rs", - "rustix 1.1.4", + "rustix 1.1.6", "scoped-tls", "smallvec", "wayland-sys", @@ -5582,7 +5718,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" dependencies = [ "bitflags 2.11.1", - "rustix 1.1.4", + "rustix 1.1.6", "wayland-backend", "wayland-scanner", ] @@ -5604,7 +5740,7 @@ version = "0.31.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" dependencies = [ - "rustix 1.1.4", + "rustix 1.1.6", "wayland-client", "xcursor", ] @@ -5716,7 +5852,7 @@ dependencies = [ "half", "itertools", "num-traits", - "thiserror 2.0.18", + "thiserror 2.0.21", "wesl-macros", "wgsl-parse", "wgsl-types", @@ -5787,7 +5923,7 @@ dependencies = [ "raw-window-handle", "rustc-hash 1.1.0", "smallvec", - "thiserror 2.0.18", + "thiserror 2.0.21", "wgpu-core-deps-apple", "wgpu-core-deps-emscripten", "wgpu-core-deps-windows-linux-android", @@ -5866,15 +6002,15 @@ dependencies = [ "raw-window-metal", "renderdoc-sys", "smallvec", - "thiserror 2.0.18", + "thiserror 2.0.21", "wasm-bindgen", "wayland-sys", "web-sys", "wgpu-naga-bridge", "wgpu-types", "windows", - "windows-core", - "windows-result", + "windows-core 0.62.2", + "windows-result 0.4.1", ] [[package]] @@ -5914,7 +6050,7 @@ dependencies = [ "lalrpop-util", "lexical", "logos", - "thiserror 2.0.18", + "thiserror 2.0.21", "wgsl-types", ] @@ -5951,7 +6087,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -5967,7 +6103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" dependencies = [ "windows-collections", - "windows-core", + "windows-core 0.62.2", "windows-future", "windows-numerics", ] @@ -5978,7 +6114,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" dependencies = [ - "windows-core", + "windows-core 0.62.2", ] [[package]] @@ -5987,11 +6123,24 @@ version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-core" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "803590c6856f51d15fa2e9fabe4f4703122c8737f72ef2741b4ac09d4c2192f5" +dependencies = [ + "windows-implement 0.100.0", + "windows-interface 0.100.0", + "windows-link 0.100.0", + "windows-result 0.100.0", + "windows-strings 0.100.0", ] [[package]] @@ -6000,8 +6149,8 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ - "windows-core", - "windows-link", + "windows-core 0.62.2", + "windows-link 0.2.1", "windows-threading", ] @@ -6016,6 +6165,17 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "windows-implement" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc1bc82e5a1b1a4d7255861b07881a0407b552f50a4d8543c0c7276fa96f6e8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "windows-interface" version = "0.59.3" @@ -6027,20 +6187,37 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "windows-interface" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3f7005c3b757b9b82c2f40c0e71094ff1080adddaf3e8b6ce99b545d3c48796" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-link" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b39de7c7fe78858b0144c50c3fc000bab3be17d5e9b85b1053871693c7f7415" + [[package]] name = "windows-numerics" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ - "windows-core", - "windows-link", + "windows-core 0.62.2", + "windows-link 0.2.1", ] [[package]] @@ -6049,9 +6226,9 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" dependencies = [ - "windows-link", - "windows-result", - "windows-strings", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", ] [[package]] @@ -6060,7 +6237,16 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-link", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-result" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44873a1ef61c85d5e2991db91fe656cfcf0731097e00dff1ac860f1cb3b752a0" +dependencies = [ + "windows-link 0.100.0", ] [[package]] @@ -6069,7 +6255,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-link", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a70b590c684f1d2854f74999896f7c0558f1bdde62f599088599e20ea1d2f60" +dependencies = [ + "windows-link 0.100.0", ] [[package]] @@ -6105,7 +6300,7 @@ version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -6130,7 +6325,7 @@ version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ - "windows-link", + "windows-link 0.2.1", "windows_aarch64_gnullvm 0.53.1", "windows_aarch64_msvc 0.53.1", "windows_i686_gnu 0.53.1", @@ -6147,7 +6342,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" dependencies = [ - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -6470,7 +6665,7 @@ dependencies = [ "libc", "libloading", "once_cell", - "rustix 1.1.4", + "rustix 1.1.6", "x11rb-protocol", ] @@ -6487,7 +6682,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" dependencies = [ "libc", - "rustix 1.1.4", + "rustix 1.1.6", ] [[package]] @@ -6555,6 +6750,15 @@ dependencies = [ "synstructure", ] +[[package]] +name = "yring" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9711debb4e69f22b935b1de5a5c8d0329ec79bb9de7a585b513e39aee19eed3" +dependencies = [ + "loom", +] + [[package]] name = "zerocopy" version = "0.8.48" @@ -6602,33 +6806,6 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" -[[package]] -name = "zeromq" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a4528179201f6eecf211961a7d3276faa61554c82651ecc66387f68fc3004bd" -dependencies = [ - "async-trait", - "asynchronous-codec", - "bytes", - "crossbeam-queue", - "dashmap", - "futures-channel", - "futures-io", - "futures-task", - "futures-util", - "log", - "num-traits", - "once_cell", - "parking_lot", - "rand 0.8.6", - "regex", - "thiserror 1.0.69", - "tokio", - "tokio-util", - "uuid", -] - [[package]] name = "zerotrie" version = "0.2.4" diff --git a/ggsql-jupyter/Cargo.toml b/ggsql-jupyter/Cargo.toml index 47590aef3..9d9a999ee 100644 --- a/ggsql-jupyter/Cargo.toml +++ b/ggsql-jupyter/Cargo.toml @@ -2,7 +2,7 @@ name = "ggsql-jupyter" version.workspace = true edition.workspace = true -rust-version.workspace = true +rust-version = "1.93" authors.workspace = true license.workspace = true repository.workspace = true @@ -28,9 +28,8 @@ ggsql = { workspace = true, features = ["duckdb", "svg", "pdf"] } # Arrow for DataFrame array types arrow = { workspace = true } -# Async runtime. `sync` is named explicitly for the render thread's outcome -# channel rather than relying on another dependency to enable it. -tokio = { workspace = true, features = ["sync"] } +# Async runtime +tokio = { workspace = true, features = ["macros", "rt-multi-thread", "signal", "sync"] } # CLI clap = { workspace = true } @@ -50,8 +49,8 @@ chrono = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true } -# Jupyter kernel - we'll try zeromq approach first since it's proven -zeromq = { version = "0.4", features = ["tokio-runtime", "tcp-transport"] } +# Jupyter transport +omq-tokio = "0.39.2" bytes = "1.0" # Message authentication diff --git a/ggsql-jupyter/src/kernel.rs b/ggsql-jupyter/src/kernel.rs index 9eb03f4ae..f50482870 100644 --- a/ggsql-jupyter/src/kernel.rs +++ b/ggsql-jupyter/src/kernel.rs @@ -11,23 +11,25 @@ use crate::message::{ConnectionInfo, JupyterMessage, MessageHeader}; use crate::plot::comm::{PlotMetadata, RenderParams, RpcError}; use crate::plot::{PlotBackend, RenderOutcome, RenderTicket}; use anyhow::Result; +use bytes::Bytes; use ggsql::reader::ResolvedPlot; use hmac::{Hmac, Mac}; +use omq_tokio::{Message, Options, Socket, SocketType}; use serde_json::{json, Value}; use sha2::Sha256; use std::collections::{HashMap, VecDeque}; -use zeromq::{PubSocket, RepSocket, RouterSocket, Socket, SocketRecv, SocketSend}; +use std::time::Duration; type HmacSha256 = Hmac; /// The ggsql Jupyter kernel server pub struct KernelServer { - shell: RouterSocket, - iopub: PubSocket, - control: RouterSocket, + shell: Socket, + iopub: Socket, + control: Socket, #[allow(dead_code)] - stdin: RouterSocket, - heartbeat: RepSocket, + stdin: Socket, + heartbeat: Socket, #[allow(dead_code)] connection: ConnectionInfo, executor: QueryExecutor, @@ -78,11 +80,12 @@ impl KernelServer { tracing::info!("Initializing kernel server"); // Initialize sockets - let mut shell = RouterSocket::new(); - let mut iopub = PubSocket::new(); - let mut control = RouterSocket::new(); - let mut stdin = RouterSocket::new(); - let mut heartbeat = RepSocket::new(); + // Jupyter clients can close a channel while a reply is pending. + let shell = Socket::new(SocketType::Router, Options::default()); + let iopub = Socket::new(SocketType::Pub, Options::default()); + let control = Socket::new(SocketType::Router, Options::default()); + let stdin = Socket::new(SocketType::Router, Options::default()); + let heartbeat = Socket::new(SocketType::Rep, Options::default()); // Bind sockets to ports let shell_addr = connection.socket_addr(connection.shell_port); @@ -92,19 +95,19 @@ impl KernelServer { let hb_addr = connection.socket_addr(connection.hb_port); tracing::info!("Binding shell socket to {}", shell_addr); - shell.bind(&shell_addr).await?; + shell.bind(shell_addr.as_str()).await?; tracing::info!("Binding iopub socket to {}", iopub_addr); - iopub.bind(&iopub_addr).await?; + iopub.bind(iopub_addr.as_str()).await?; tracing::info!("Binding control socket to {}", control_addr); - control.bind(&control_addr).await?; + control.bind(control_addr.as_str()).await?; tracing::info!("Binding stdin socket to {}", stdin_addr); - stdin.bind(&stdin_addr).await?; + stdin.bind(stdin_addr.as_str()).await?; tracing::info!("Binding heartbeat socket to {}", hb_addr); - heartbeat.bind(&hb_addr).await?; + heartbeat.bind(hb_addr.as_str()).await?; // Create executor with the specified reader let executor = QueryExecutor::new_with_uri(reader_uri)?; @@ -197,6 +200,15 @@ impl KernelServer { if let Ok(msg) = msg { if self.handle_control_message(msg).await? { tracing::info!("Shutdown requested, exiting"); + // Give the queued shutdown reply and the final idle + // status time to reach the client. + let linger = Some(Duration::from_secs(1)); + let (control, iopub) = tokio::join!( + self.control.clone().close_with_linger(linger), + self.iopub.clone().close_with_linger(linger), + ); + control?; + iopub?; break; } } @@ -223,7 +235,7 @@ impl KernelServer { } /// Handle messages on the shell channel - async fn handle_shell_message(&mut self, msg: zeromq::ZmqMessage) -> Result<()> { + async fn handle_shell_message(&mut self, msg: Message) -> Result<()> { let (identities, jupyter_msg) = self.parse_message(msg)?; let msg_type = &jupyter_msg.header.msg_type; @@ -250,7 +262,7 @@ impl KernelServer { } /// Handle messages on the control channel - async fn handle_control_message(&mut self, msg: zeromq::ZmqMessage) -> Result { + async fn handle_control_message(&mut self, msg: Message) -> Result { let (identities, jupyter_msg) = self.parse_message(msg)?; let msg_type = &jupyter_msg.header.msg_type; @@ -1437,14 +1449,9 @@ impl KernelServer { identities: &[Vec], ) -> Result<()> { let msg = self.create_message(msg_type, content, Some(parent)); - let mut zmq_msg = self.serialize_message(&msg)?; - - // For router sockets, we need to prepend the identity frames - // Prepend identities in REVERSE order (ROUTER sockets expect this) - for identity in identities.iter().rev() { - zmq_msg.push_front(bytes::Bytes::from(identity.clone())); - } - + // ROUTER routes the reply by the identity frames received with the + // request, so send them back first, in the same order. + let zmq_msg = self.serialize_message(&msg, identities.iter().cloned().map(Bytes::from))?; self.shell.send(zmq_msg).await?; Ok(()) } @@ -1458,14 +1465,9 @@ impl KernelServer { identities: &[Vec], ) -> Result<()> { let msg = self.create_message(msg_type, content, Some(parent)); - let mut zmq_msg = self.serialize_message(&msg)?; - - // For router sockets, we need to prepend the identity frames - // Prepend identities in REVERSE order (ROUTER sockets expect this) - for identity in identities.iter().rev() { - zmq_msg.push_front(bytes::Bytes::from(identity.clone())); - } - + // ROUTER routes the reply by the identity frames received with the + // request, so send them back first, in the same order. + let zmq_msg = self.serialize_message(&msg, identities.iter().cloned().map(Bytes::from))?; self.control.send(zmq_msg).await?; Ok(()) } @@ -1511,9 +1513,9 @@ impl KernelServer { /// Parse a ZeroMQ message into a Jupyter message /// Returns (identities, jupyter_message) - fn parse_message(&self, msg: zeromq::ZmqMessage) -> Result<(Vec>, JupyterMessage)> { + fn parse_message(&self, msg: Message) -> Result<(Vec>, JupyterMessage)> { // Jupyter wire protocol: [identity, ..., delimiter, hmac, header, parent, metadata, content] - let frames: Vec<_> = msg.into_vec(); + let frames: Vec<_> = msg.iter().collect(); if frames.len() < 6 { anyhow::bail!("Invalid message: too few frames (got {})", frames.len()); @@ -1524,6 +1526,9 @@ impl KernelServer { .iter() .position(|f| f.as_ref() == b"") .ok_or_else(|| anyhow::anyhow!("Delimiter not found"))?; + if frames.len() - delim_pos < 6 { + anyhow::bail!("Invalid message: too few frames after delimiter"); + } // Extract identity frames (everything before delimiter) let identities: Vec> = frames[..delim_pos].iter().map(|b| b.to_vec()).collect(); @@ -1557,7 +1562,11 @@ impl KernelServer { } /// Serialize a Jupyter message to ZeroMQ format - fn serialize_message(&self, msg: &JupyterMessage) -> Result { + fn serialize_message( + &self, + msg: &JupyterMessage, + prefix: impl IntoIterator, + ) -> Result { let header = serde_json::to_string(&msg.header)?; let parent = serde_json::to_string(&msg.parent_header)?; let metadata = serde_json::to_string(&msg.metadata)?; @@ -1566,42 +1575,20 @@ impl KernelServer { // Calculate HMAC signature let signature = self.sign_message(&header, &parent, &metadata, &content); - // Build ZeroMQ message: [delimiter, hmac, header, parent, metadata, content] - let mut zmq_msg = zeromq::ZmqMessage::from(b"".to_vec()); - zmq_msg.push_back(signature.into()); - zmq_msg.push_back(header.into()); - zmq_msg.push_back(parent.into()); - zmq_msg.push_back(metadata.into()); - zmq_msg.push_back(content.into()); - - Ok(zmq_msg) + Ok(Message::multipart(prefix.into_iter().chain([ + Bytes::from_static(b""), + Bytes::from(signature), + Bytes::from(header), + Bytes::from(parent), + Bytes::from(metadata), + Bytes::from(content), + ]))) } /// Serialize a Jupyter message to ZeroMQ format with topic (for IOPub) /// According to Jupyter protocol: "there should be just one prefix component, which is the topic" - fn serialize_message_with_topic( - &self, - msg: &JupyterMessage, - topic: &str, - ) -> Result { - let header = serde_json::to_string(&msg.header)?; - let parent = serde_json::to_string(&msg.parent_header)?; - let metadata = serde_json::to_string(&msg.metadata)?; - let content = serde_json::to_string(&msg.content)?; - - // Calculate HMAC signature - let signature = self.sign_message(&header, &parent, &metadata, &content); - - // Build ZeroMQ message with topic: [topic, delimiter, hmac, header, parent, metadata, content] - let mut zmq_msg = zeromq::ZmqMessage::from(topic.as_bytes().to_vec()); - zmq_msg.push_back(b"".to_vec().into()); - zmq_msg.push_back(signature.into()); - zmq_msg.push_back(header.into()); - zmq_msg.push_back(parent.into()); - zmq_msg.push_back(metadata.into()); - zmq_msg.push_back(content.into()); - - Ok(zmq_msg) + fn serialize_message_with_topic(&self, msg: &JupyterMessage, topic: &str) -> Result { + self.serialize_message(msg, [Bytes::copy_from_slice(topic.as_bytes())]) } /// Sign a message using HMAC-SHA256 From 07b53d34c95cc1aff1f8be491f7168a8e7b4d3b8 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Mon, 30 Nov 2026 15:49:45 +0100 Subject: [PATCH 2/2] add news bullet --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7f9a6d15..c4c762709 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -108,6 +108,12 @@ determines whether text boxes get drawn and additional settings `padding`, variant is named `Srgb` rather than `LinearRgb`. - The CLI now always prints query warnings (e.g. extra `VISUALISE`/`TABULATE` statements being ignored) to stderr, not only with `-v`. +- The Jupyter kernel's transport moved from the `zeromq` crate to `omq-tokio` + (#618). Replies to clients that disconnect while a request is in flight are + now discarded by the ROUTER sockets instead of erroring, and on shutdown the + control and IOPub sockets drain with a one-second linger so the shutdown + reply and the final idle status reach the client. The standalone kernel now + requires Rust 1.93; the library keeps its existing toolchain. - Replaced `CLAUDE.md` files with `AGENTS.md` files. ### Fixed