Issue with AnyEvent::AIO
Dominik Csapak
d.csapak at proxmox.com
Mon Jul 3 15:23:03 CEST 2023
On 7/3/23 15:03, Marc Lehmann wrote:
> On Mon, Jul 03, 2023 at 08:47:09AM +0200, Dominik Csapak <d.csapak at proxmox.com> wrote:
>> We had a 'use AnyEvent:IO' statement even though we did not use any of it.
>
> I tried to reproduce this, but was not able to, regardless of whether I load
> AnyEvent::AIO or not, in any order.
>
> The only way I can make it initialise AnyEvent is by calling an aio_
> function.
>
> The only thing where I can see this makling a difference is when you (or
> some other code) _does_ call an AnyEvent::IO function: If AnyEvent::AIO
> and IO::AIO are available, this will initialise AnyEvent. Otherwise,
> AnyEvent is not used, as the pure perl implementation of AnyEvent::IO will
> not (currently) use AnyEvent itself.
>
> Thats about the only thing that could explain the difference in behaviour.
>
mhmm interesting, i cannot see any use of any 'aio_' function anywhere in our codebase
and all anyevent functions we call we do (long) after we forked.
Maybe it's just a weird interaction with 'exit()' and the END handlers of IO:AIO?
We consider changing the 'exit()' calls after the fork to POSIX::_exit() but
this worked for over 10 years now, and we have to carefully consider the
side-effects ;)
Since the code base is not that small, i can't rule out some other
weird interactions (of maybe some modules we use?) but i cannot really tell
right now.
If you want to check out our code, it is available on git.proxmox.com
(mostly in pve-common -> PVE::Daemon and pve-http-server -> PVE::APIServer::AnyEvent),
but i don't expect of you to debug this further, especially if we're the only ones
with that problem.
We only ran into this because our developers (me included) wanted to install the perl
language server which requires AnyEvent::AIO and noticed our CPUs worked much harder
than they should have ;)
Thanks again for looking into this and for giving some interesting pointers
Kind Regards
Dominik
More information about the anyevent
mailing list