revert(perf): drop the dockerode and docker-modem pnpm patches
Both patches came out of this work and both are removed at the maintainer's request. The finding was real - ssh2's WASM heap costs +14.0 MiB RSS on require, and @grpc/grpc-js another 14.6 MiB across 61 files, neither of which a socket-based Docker install ever uses - but patching a dependency means every future dockerode or docker-modem bump fails until someone regenerates the patch, and that recurring cost is not worth roughly 25 MiB. The finding stays on record in SERVER-MEMORY.md because the fix belongs upstream: both packages require a module at file scope while using it in exactly one already-guarded branch, so a PR to each would fix it for every consumer with no patch to maintain here. The two remaining patches, @types/node-unifi and trpc-to-openapi, predate this work and are untouched. allowUnusedPatches was already set on dev and is left alone. Lockfile regenerated: patchedDependencies now lists only those two. Also sharpens the Cache Components entry. The SqliteError was simply an unmigrated build database, which is fixable - but feeding the build a database would be the wrong fix, because serverSetting is per-installation data on the user's volume and a shell prerendered against the build machine's database would bake one install's settings into every other install's first paint. The error was Next.js correctly reporting a request-time read sitting in the shell path.
This commit is contained in:
8 files changed
+42
-72
No files matched your search
@@ -1,27 +0,0 @@
|
||||
diff --git a/lib/modem.js b/lib/modem.js
|
||||
index b45a798d63647d55e0193fd7e82c2e36785d9b5f..d2dbf42969fc0ebf39b30c1a27373c33c2d20333 100644
|
||||
--- a/lib/modem.js
|
||||
+++ b/lib/modem.js
|
||||
@@ -3,7 +3,6 @@ var querystring = require('querystring'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
url = require('url'),
|
||||
- ssh = require('./ssh'),
|
||||
HttpDuplex = require('./http_duplex'),
|
||||
debug = require('debug')('modem'),
|
||||
utils = require('./utils'),
|
||||
@@ -263,8 +262,13 @@ Modem.prototype.buildRequest = function (options, context, data, callback) {
|
||||
var connectionTimeoutTimer;
|
||||
var finished = false;
|
||||
|
||||
+ // Loaded here rather than at module scope: './ssh' pulls in ssh2, whose crypto module
|
||||
+ // instantiates a ~16 MiB WebAssembly memory for ChaCha20-Poly1305 as soon as it is
|
||||
+ // required. Measured at +14 MiB RSS for a require alone, paid by every Homarr install
|
||||
+ // even though Docker is reached over a socket and this branch never runs. require() is
|
||||
+ // cached, so SSH connections pay it once and behave exactly as before.
|
||||
var opts = self.protocol === 'ssh' ? Object.assign(options, {
|
||||
- agent: ssh(Object.assign({}, self.sshOptions, {
|
||||
+ agent: require('./ssh')(Object.assign({}, self.sshOptions, {
|
||||
'host': self.host,
|
||||
'port': self.port,
|
||||
'username': self.username,
|
||||
@@ -1,25 +0,0 @@
|
||||
diff --git a/lib/docker.js b/lib/docker.js
|
||||
index 4951f8db867b1b12b75af79be2ebae6165534960..b333e65e99a9ef420826c0b1a908d4923dffc2f6 100644
|
||||
--- a/lib/docker.js
|
||||
+++ b/lib/docker.js
|
||||
@@ -12,7 +12,6 @@ var EventEmitter = require('events').EventEmitter,
|
||||
Node = require('./node'),
|
||||
Exec = require('./exec'),
|
||||
util = require('./util'),
|
||||
- withSession = require('./session'),
|
||||
extend = util.extend;
|
||||
|
||||
var Docker = function(opts) {
|
||||
@@ -301,6 +300,12 @@ Docker.prototype.buildImage = function(file, opts, callback) {
|
||||
|
||||
function dialWithSession(callback) {
|
||||
if (opts?.version === "2") {
|
||||
+ // Loaded here rather than at module scope: './session' pulls in @grpc/grpc-js and
|
||||
+ // @grpc/proto-loader (112 files), which cost +6.0 MiB RSS on top of dockerode itself.
|
||||
+ // Only the BuildKit image-build path reaches this branch, so listing or starting
|
||||
+ // containers paid for a gRPC stack it never used. require() is cached, so builds behave
|
||||
+ // exactly as before.
|
||||
+ var withSession = require('./session');
|
||||
withSession(self, optsf.authconfig,(err, sessionId, done) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
Reference in new issue
Block a user