about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-05-25 22:20:01 +0000
committerEric Wong <e@80x24.org>2021-05-25 23:05:02 +0000
commit708b182a57373172f5523f3dc297659d58e03b58 (patch)
tree90d2a254577ce297f33f7988ccc6eceed252435c /t
parent3060d78b4183f3e985fb7ff8864949de990f2610 (diff)
downloadpublic-inbox-708b182a57373172f5523f3dc297659d58e03b58.tar.gz
ipc: wq: handle >MAX_ARG_STRLEN && <EMSGSIZE case
WQWorkers are limited roughly to MAX_ARG_STRLEN (the kernel
limit of argv + environ) to avoid excessive memory growth.
Occasionally, we need to send larger messages via workqueues
that are too small to hit EMSGSIZE on the sender.

This fixes "lei q" when using HTTP(S) externals, since that
code path sends large Eml objects from lei_xsearch workers
directly to lei2mail WQ workers.
Diffstat (limited to 't')
-rw-r--r--t/ipc.t11
1 files changed, 8 insertions, 3 deletions
diff --git a/t/ipc.t b/t/ipc.t
index ca88eb59..7983fdc0 100644
--- a/t/ipc.t
+++ b/t/ipc.t
@@ -122,11 +122,16 @@ for my $t ('local', 'worker', 'worker again') {
         $ipc->wq_io_do('test_sha', [ $wa, $wb ], 'hello world');
         is(readline($rb), sha1_hex('hello world')."\n", "SHA small ($t)");
         {
-                my $bigger = $big x 10;
+                my $bigger = $big x 10; # to hit EMSGSIZE
                 $ipc->wq_io_do('test_sha', [ $wa, $wb ], $bigger);
                 my $exp = sha1_hex($bigger)."\n";
-                undef $bigger;
-                is(readline($rb), $exp, "SHA big ($t)");
+                is(readline($rb), $exp, "SHA big for EMSGSIZE ($t)");
+
+                # to hit the WQWorker recv_and_run length
+                substr($bigger, my $MY_MAX_ARG_STRLEN = 4096 * 33, -1) = '';
+                $ipc->wq_io_do('test_sha', [ $wa, $wb ], $bigger);
+                $exp = sha1_hex($bigger)."\n";
+                is(readline($rb), $exp, "SHA WQWorker limit ($t)");
         }
         my $ppid = $ipc->wq_workers_start('wq', 1);
         push(@ppids, $ppid);