AnyEvent application with Perl backend can enter a loop with 100% CPU usage if the select syscall returns with an error
Marc Lehmann
schmorp at schmorp.de
Thu Oct 29 03:28:15 CET 2020
On Wed, Oct 28, 2020 at 07:29:06PM +0100, Peter Juhasz <peter.juhasz at comnica.com> wrote:
> The problem is that when select returns an error like that, it does so
> without delay, and apparently the pure Perl event loop implementation
No, the problem is that the application coede has an active watcher for an
invalid FD, a bug that can only be fixed in that layer.
You cna try to run your application using PERL_ANYEVENT_STRICT=1 which can
detetc *some* fo these errors, but not all.
> Our application runs inside a Docker container, and the sysadmins have
> modified something on the host's DNS settings. Some time (about a hour)
> later the application failed in the way described above.
You will have to track down the bug somehow. EBADFD almost certainly means
that you closed an fd in some waya without unregistering the event watcher
for it.
> I'm not sure what AnyEvent could do in case of such an error, it's
> possible that the application is not salvageable at that point. But at
> least the error condition could be detected.
AnyEvent cannot, in general, detect such errors, as the code in question
is usually outside of AnyEvent. Even if AnyEvent::Loop spent extra effort
on detecting such a case, there is little it can report, and it would only
affect using that backend.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the anyevent
mailing list