Subject: | Issue |
Date: | Wed, 16 Dec 2015 15:46:25 +0300 |
To: | bug-IO-AIO [...] rt.cpan.org |
From: | Pavel Limorenko <p.limorenko [...] corp.mail.ru> |
Hi, developers.
It seems like I found a bug in IO::AIO module, which was reproduced by me on CentOS 7 Linux distribution. The following environment:
uname -a
Linux mymachine 3.10.0-229.20.1.el7.x86_64 #1 SMP Tue Nov 3 19:10:07 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
So, a little perl script to reproduce:
-----------------
use strict;
use warnings;
use AnyEvent;
use AnyEvent::IO;
warn $AnyEvent::VERSION;
warn $IO::AIO::VERSION;
my $cv = AnyEvent->condvar();
AnyEvent::IO::aio_stat ('/etc/hosts', sub { warn "i'm free!::: @_"; $cv->send() });
$cv->recv();
my $pid = fork;
defined $pid or die $!;
exit if $pid;
$cv = AnyEvent->condvar();
AnyEvent::IO::aio_stat ('/etc/hosts', sub { warn "i'm free!2::: @_"; $cv->send() });
$cv->recv(); -----------------
The output is the following:
7.11 at test_tcp.pl line 9.
4.32 at test_tcp.pl line 10.
i'm free!::: 1 at test_tcp.pl line 12. Where is the second message? :)
Also I tried this one script on my Centos 6 machine, where my big application worked just fine,
(with environment:
uname -a
Linux win41.dev.mail.ru 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
),
and the output was expectable:
7.04 at test_tcp.pl line 9.
Use of uninitialized value $IO::AIO::VERSION in warn at test_tcp.pl line 10.
Warning: something's wrong at test_tcp.pl line 10.
i'm free!::: 2050 11273496 33188 1 0 0 0 190 1450185241 1450185236 1450185236 4096 8 at test_tcp.pl line 12.
i'm free!2::: 2050 11273496 33188 1 0 0 0 190 1450185241 1450185236 1450185236 4096 8 at test_tcp.pl line 19. (warnings are present (as I understand) because there is no standalone module IO::AIO in 7.04 version of AnyEvent, it is included somewhere).
Anyway, problem exists.
My little research showed that before forking there one extra thread in perl process (called perl/eio). After fork done there is only one thread in process. In Centos 6 there is no any extra thread. Also I tried to use on CentOS 7 old version of AnyEvent and IO::AIO (as on CentOS 6, 7.04) -- the result is the same.
I think something went wrong :)
Thanks for reading me. I hope this would help.
Best regards, Pavel.