From: Matteo Nastasi Date: Sun, 13 Sep 2026 15:08:54 +0000 (+0000) Subject: run the bench from the repository instead of a copy X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=dc0e6371c627f6725b8f7af614cc7b185d70b2b7;p=brisk.git run the bench from the repository instead of a copy The bench used to be a copy kept in /root/load, run as root, driven from outside the container. The paths were written into the scripts and the copy went stale more than once. They now run straight out of the working tree, unprivileged, and read common.sh for the three settings they share. BRISK_WORK holds the working files, /var/tmp/brisk-load by default. Not /tmp, which is a tmpfs here and gets wiped by a restart of the container in the middle of a session - that is why the scripts had been moved to /root/load to begin with - and not the script directory either, or auth.txt and the captured streams would be left lying in the git tree. BRISK_LEGAL is where the daemon keeps its log and its pid file, and SUDO covers the few things that still need root: restarting the service, and reading the open descriptors of a daemon that runs as another user. brisk_step.sh no longer starts the daemon by hand. It went through a raw screen invocation of its own, which is precisely how orphaned instances used to pile up: the newcomer unlinks the socket files and binds its own while the first one stays alive on its own shared memory. It restarts the service now. Its two log counts also become deltas: both logs are cumulative, so the totals said nothing about the step that just ran. The trap that reaps the background loops changes shape. It was "trap 'kill 0'", which signals the whole process group - almost always wider than the script. It killed the script itself on the way out, so the exit status was always a death by signal, and it reached whatever else shared the group: the caller, or the other half of a pipeline, so that "brisk_step.sh | tail" printed nothing at all. Running everything through "incus exec" gave each script a session of its own and hid all of it. bench_reap walks our own descendants instead, which reaches the loops inside "( ... ) &" and the curls under them and nothing else. Checked from the working tree: brisk_step.sh completes through a pipe with its output intact and exit status 0, the sampler reads the daemon descriptors through sudo, game.sh forms the table, stop.sh reports a clean machine, and INSTALL.sh installs and restarts from here. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Fseposbqj9mBbQXoT8KnBj --- diff --git a/test/load/README b/test/load/README index 9b282a7..0ec0eb2 100644 --- a/test/load/README +++ b/test/load/README @@ -30,7 +30,34 @@ game.sh and hand.sh instead use the five users uno/due/tre/qua/cin with the passwords one/two/thr/for/fiv. The paths and ports are those of the test container (/home/brisk, 8444 for -https): they have to be adapted elsewhere. +https, 8082 for plain http): they have to be adapted elsewhere. + + +How to run them +--------------- + +From this directory, straight out of the repository: + + ./brisk_step.sh 150 90 3 --tls + ./stop.sh + +They used to be a copy kept in /root/load, run as root, with those paths +written into them; the copy went stale more than once. Now every script finds +its own directory and reads common.sh, which holds the three settings they all +share: + + BRISK_WORK where the working files go. Default /var/tmp/brisk-load. + NOT /tmp: that is a tmpfs here, and a restart of the container + wipes it in the middle of a session. Not this directory either, + or auth.txt and the captured streams would be left in the git + tree. + BRISK_LEGAL where the daemon keeps its log and its pid file: the path + given to INSTALL.sh with -l. Default /home/brisk/legal. + SUDO the daemon runs as another user, so restarting the service and + reading its open descriptors need root while the bench itself + does not. Set SUDO= to empty when already running as root. + +Nothing here needs to run as root. The load @@ -112,14 +139,27 @@ At the end of a session It shuts everything down and prints the state: running scripts, running curls, descriptors of the daemon, disk space, load. To be run ALWAYS. -The scripts that start background loops carry a trap that kills their own -process group. Without it the loops outlive their parent and are left spinning -for nothing: that happened for two days, with eighty processes alive and the -machine load at 19. - -stop.sh does not use "pkill -f": the pattern would end up in the command line -of the script itself, which would kill itself and leave the targets alive. - -The working files (auth.txt, tok.txt, mani.txt, *.stream) are created in the -working directory of the scripts and can grow large: the read streams grow all -the time. stop.sh deletes them. +The scripts that start background loops carry a trap, bench_reap, that kills +their own descendants on the way out. Without it the loops outlive their +parent and are left spinning for nothing: that happened for two days, with +eighty processes alive and the machine load at 19. + +It used to be "trap 'kill 0'", which signals the whole process group. That is +almost always wider than the script: it killed the script itself, so the exit +status was always a death by signal, and it reached whatever else shared the +group - whoever launched it, or the other half of a pipeline, so that +"brisk_step.sh | tail" printed nothing at all. Running everything through +"incus exec" gave each script a session of its own and hid all of it. + +Two traps of the same family, both of which have already cost time here: + + - stop.sh does not use "pkill -f": the pattern would end up in the command + line of the script itself, which would kill itself and leave the targets + alive. + - when counting leftovers by hand, the grep matches its own command line. + Split the pattern ("ga""me.sh") or use "[g]ame.sh", otherwise a clean + machine looks busy and a busy one looks clean. + +The working files (auth.txt, tok.txt, mani.txt, *.stream) are created in +BRISK_WORK and can grow large: the read streams grow all the time. stop.sh +deletes them. diff --git a/test/load/brisk_sample.sh b/test/load/brisk_sample.sh index 79ce2a9..42840ff 100755 --- a/test/load/brisk_sample.sh +++ b/test/load/brisk_sample.sh @@ -2,6 +2,7 @@ # Samples the resources of daemon and frontend during a load test. # usage: brisk_sample.sh