diff options
author | Eric Wong <e@80x24.org> | 2021-05-25 22:20:01 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-05-25 23:05:02 +0000 |
commit | 708b182a57373172f5523f3dc297659d58e03b58 (patch) | |
tree | 90d2a254577ce297f33f7988ccc6eceed252435c /t | |
parent | 3060d78b4183f3e985fb7ff8864949de990f2610 (diff) | |
download | public-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.t | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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); |