diff options
author | Eric Wong <e@80x24.org> | 2021-02-04 00:59:22 -0900 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-05 00:16:27 +0000 |
commit | a93947277940b9b4a22a21f70166703fe69198df (patch) | |
tree | 50d2e1f3f05bbe876366f371c2d16ad043940f32 /lib | |
parent | 39c8c7a8db43cb0e338cfcedaa81afd8627e9ff4 (diff) | |
download | public-inbox-a93947277940b9b4a22a21f70166703fe69198df.tar.gz |
We don't want circular references giving surprising behavior during worker exit.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/IPC.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm index 3873649b..078aaa2c 100644 --- a/lib/PublicInbox/IPC.pm +++ b/lib/PublicInbox/IPC.pm @@ -338,7 +338,6 @@ sub _wq_worker_start ($$$) { srand($seed); eval { PublicInbox::DS->Reset }; delete @$self{qw(-wq_s1 -wq_workers -wq_ppid)}; - @$self{keys %$fields} = values(%$fields) if $fields; $SIG{$_} = 'IGNORE' for (qw(PIPE)); $SIG{$_} = 'DEFAULT' for (qw(TTOU TTIN TERM QUIT INT CHLD)); local $0 = $self->{-wq_ident}; @@ -346,6 +345,8 @@ sub _wq_worker_start ($$$) { # ensure we properly exit even if warn() dies: my $end = PublicInbox::OnDestroy->new($$, sub { exit(!!$@) }); eval { + $fields //= {}; + local @$self{keys %$fields} = values(%$fields); my $on_destroy = $self->ipc_atfork_child; local %SIG = %SIG; wq_worker_loop($self); |