diff options
author | Eric Wong <e@80x24.org> | 2023-10-10 10:09:04 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-10 19:11:46 +0000 |
commit | d414b0bbe1f68b9d0bb049ab7efd619c55c3ea0c (patch) | |
tree | 9fed026b6cdcfa3bb9f668187f9610976d4396fc /lib/PublicInbox/DS.pm | |
parent | 7d75e148e550a93548d09f05cc98be6c5fd63fc0 (diff) | |
download | public-inbox-d414b0bbe1f68b9d0bb049ab7efd619c55c3ea0c.tar.gz |
commit 1897c3be1ed644a05f96ed06cde4a9cc2ad0e5a4 (ds: Reset: replace Poller object early, 2023-10-04) was not effective at eliminating the following message at daemon shutdown: Can't call method "FILENO" on an undefined value at .../PublicInbox/Select.pm line 34 during global destruction. This seems down to some tied objects having unpredictable destruction order. So use a dummy class to ensure its ep_* methods never call the tied `FILENO' method at all since dropping the Poller object will release any resources it holds.
Diffstat (limited to 'lib/PublicInbox/DS.pm')
-rw-r--r-- | lib/PublicInbox/DS.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 26cc83f0..eefbdcc3 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -67,12 +67,12 @@ Reset all state =cut sub Reset { + $Poller = bless [], 'PublicInbox::DummyPoller'; do { $in_loop = undef; # first in case DESTROY callbacks use this # clobbering $Poller may call DSKQXS::DESTROY, # we must always have this set to something to avoid # needing branches before ep_del/ep_mod calls (via ->close). - $Poller = PublicInbox::Select->new; %DescriptorMap = (); # likely to call ep_del @Timers = (); %UniqTimer = (); @@ -82,7 +82,6 @@ sub Reset { @$cur_runq = () if $cur_runq; $nextq = $ToClose = undef; # may call ep_del %AWAIT_PIDS = (); - $Poller = PublicInbox::Select->new; } while (@Timers || $nextq || keys(%AWAIT_PIDS) || $ToClose || keys(%DescriptorMap) || @post_loop_do || keys(%UniqTimer) || @@ -738,6 +737,14 @@ sub awaitpid { } } +package PublicInbox::DummyPoller; # only used during Reset +use v5.12; + +sub ep_del {} +no warnings 'once'; +*ep_add = \&ep_del; +*ep_mod = \&ep_del; + 1; =head1 AUTHORS (Danga::Socket) |