Skip to content

Instantly share code, notes, and snippets.

@calid
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calid/18791dd558947d04a1e5 to your computer and use it in GitHub Desktop.
Save calid/18791dd558947d04a1e5 to your computer and use it in GitHub Desktop.
EV 3 Segfault w/ ZMQ::FFI & FFI::Platypus
use strict;
use warnings;
use Test::More;
use AnyEvent;
use EV;
use ZMQ::FFI;
use ZMQ::FFI::Constants qw(ZMQ_PUSH ZMQ_PULL);
my $endpoint = "ipc:///tmp/test-zmq-ffi-$$";
my @expected = qw(foo bar baz);
my $ctx = ZMQ::FFI->new();
my $pull = $ctx->socket(ZMQ_PULL);
$pull->bind($endpoint);
my $fd = $pull->get_fd();
my $recv = 0;
my $w = AE::io $fd, 0, sub {
while ($pull->has_pollin) {
my $msg = $pull->recv();
is $msg, $expected[$recv], "got message $recv";
$recv++;
if ($recv == 3) {
EV::unloop();
}
}
};
my $push = $ctx->socket(ZMQ_PUSH);
$push->connect($endpoint);
my $t;
my $sent = 0;
$t = AE::timer 0, .1, sub {
$push->send($expected[$sent]);
$sent++;
if ($sent == 3) {
undef $t;
}
};
EV::loop();
done_testing;
calid@arch ~
[✔]▶ pmvers EV
4.18
calid@arch ~
[✔]▶ pmvers ZMQ::FFI
1.03
calid@arch ~
[✔]▶ perl /tmp/bad_ev.t
ok 1 - got message 0
ok 2 - got message 1
ok 3 - got message 2
1..3
calid@arch ~
[✔]▶ perlbrew use @tmp
A sub-shell is launched with @tmp as the activated perl. Run 'exit' to finish it.
calid@arch ~
[✔]▶ pmvers EV
3.8
calid@arch ~
[✔]▶ pmvers ZMQ::FFI
1.03
calid@arch ~
[✔]▶ perl /tmp/bad_ev.t
1..0
# No tests run!
argument type not supported (0) at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/ZMQ/FFI/ZMQ3/Socket.pm line 404 during global destruction.
argument type not supported (1) at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/ZMQ/FFI/ZMQ3/Socket.pm line 404 during global destruction.
argument type not supported (2) at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/ZMQ/FFI/ZMQ3/Socket.pm line 404 during global destruction.
Segmentation fault (core dumped)
calid@arch ~
[SIGSEGV]▶
DLOPEN libzmq.so, HANDLE = 21993328 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 421.
FFI::Platypus::Function::DESTROY at lib/ZMQ/FFI/Util.pm line 43.
DCLOSE 21993328 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 512.
FFI::Platypus::Type::DESTROY at lib/ZMQ/FFI/Util.pm line 43.
FFI::Platypus::Type::DESTROY at lib/ZMQ/FFI/Util.pm line 43.
DLOPEN libzmq.so, HANDLE = 21996240 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 421.
About to do ffi_call from Function.xs at lib/ZMQ/FFI/Util.pm line 80.
FFI::Platypus::Function::DESTROY at lib/ZMQ/FFI.pm line 23.
DCLOSE 21996240 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 512.
FFI::Platypus::Type::DESTROY at lib/ZMQ/FFI.pm line 23.
FFI::Platypus::Type::DESTROY at lib/ZMQ/FFI.pm line 23.
DLOPEN (null), HANDLE = 1712251184 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 421.
DLOPEN libzmq.so, HANDLE = 29702432 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 421.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Context.pm line 33.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ErrorHelper.pm line 66.
DLOPEN libzmq.so, HANDLE = 29702432 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 421.
DLOPEN libzmq.so, HANDLE = 29702432 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 421.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Socket.pm line 42.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ErrorHelper.pm line 66.
FFI::Platypus::Type::DESTROY at (eval 34) line 18.
FFI::Platypus::Type::DESTROY at (eval 34) line 18.
FFI::Platypus::Type::DESTROY at (eval 34) line 18.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Socket.pm line 340.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ErrorHelper.pm line 46.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Socket.pm line 196.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ErrorHelper.pm line 46.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Socket.pm line 340.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ErrorHelper.pm line 46.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Socket.pm line 42.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ErrorHelper.pm line 66.
FFI::Platypus::Type::DESTROY at (eval 34) line 18.
FFI::Platypus::Type::DESTROY at (eval 34) line 18.
FFI::Platypus::Type::DESTROY at (eval 34) line 18.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Socket.pm line 340.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ErrorHelper.pm line 46.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Socket.pm line 183.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ErrorHelper.pm line 46.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Socket.pm line 404.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ErrorHelper.pm line 46.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Socket.pm line 453.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ErrorHelper.pm line 46.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
DCLOSE 29702432 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 512 during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
DCLOSE 29702432 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 512 during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
DCLOSE 29702432 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 512 during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
FFI::Platypus::Type::DESTROY during global destruction.
FFI::Platypus::Function::DESTROY during global destruction.
DCLOSE 1712251184 at /home/calid/.perlbrew/libs/perl-5.20.1@tmp/lib/perl5/x86_64-linux/FFI/Platypus.pm line 512 during global destruction.
About to do ffi_call from Platypus.xs at lib/ZMQ/FFI/ZMQ3/Socket.pm line 404 during global destruction.
argument type not supported (0) at lib/ZMQ/FFI/ZMQ3/Socket.pm line 404 during global destruction.
argument type not supported (1) at lib/ZMQ/FFI/ZMQ3/Socket.pm line 404 during global destruction.
argument type not supported (2) at lib/ZMQ/FFI/ZMQ3/Socket.pm line 404 during global destruction.
argument type not supported (3) at lib/ZMQ/FFI/ZMQ3/Socket.pm line 404 during global destruction.
Segmentation fault (core dumped)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment