AE::HTTP http_get segfaults with multiple downloads

Peter Juhasz pjuhasz at uhusystems.com
Mon Feb 13 16:51:04 CET 2017


Hello,

the following program segfaults:

###############
#!/usr/bin/perl

use strict;
use warnings;
use AnyEvent;
use AnyEvent::HTTP;

###my $cv = AnyEvent->condvar;

my @files = ('https://google.com/') x 20;

for (@files) {
	###$cv->begin;
	http_get $_, sub { 
		###$cv->end;
		1;
	};
}
###$cv->recv;
###############

Now I know that it is not correct: the lines commented with ### are
needed to make it work. Still, it should not crash even when it is
incorrect.

The probability of the crash depends on the number of download
requests: it happens very rarely if the number is < 10, while it
crashes almost always if the number is > 15.

GDB says that the crash happens in EV_XS_io(), while according to
strace it's a SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR,
si_addr=NULL}. I haven't debugged farther than that.

Version information:
Perl 5.24.1
AnyEvent 2.22
AnyEvent::HTTP 7.13
EV 4.22
libev 4.24

best regards,
Peter Juhasz






More information about the anyevent mailing list