ollyg / RPC-Serialized

Development of RPC::Serialized Perl distribution
http://search.cpan.org/dist/RPC-Serialized
Other
2 stars 0 forks source link

No support for Unix sockets with Type = SOCK_DGRAM? #1

Open glasswalk3r opened 9 years ago

glasswalk3r commented 9 years ago

Hi there,

I was trying to use your distribution to create a simple client/server by using Unix sockets.

During my tests, using SOCK_STREAM worked fine.

But if I change the server and client to use SOCK_DGRAM, things stops working due the following error:

Something wrong - module not defined! Interrupted system call Timeout on Receive

 at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/Data/Serializer.pm line 198.
        Data::Serializer::_module_loader(Data::Serializer=HASH(0xadf84d0), undef, "Data::Serializer") called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/Data/Serializer.pm line 62
        Data::Serializer::_serializer_obj(Data::Serializer=HASH(0xadf84d0), undef, 1) called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/Data/Serializer.pm line 97
        Data::Serializer::serializer(Data::Serializer=HASH(0xadf84d0), undef) called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/RPC/Serialized/Server.pm line 279
        RPC::Serialized::Server::restore_token(RPC::Serialized::Server=HASH(0xadf8fd0)) called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/RPC/Serialized/Server.pm line 298
        RPC::Serialized::Server::set_token(RPC::Serialized::Server=HASH(0xadf8fd0)) called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/RPC/Serialized/Server.pm line 253
        RPC::Serialized::Server::process(RPC::Serialized::Server=HASH(0xadf8fd0)) called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/RPC/Serialized/Server/NetServer.pm line 53
        RPC::Serialized::Server::NetServer::process_request(RPC::Serialized::Server::NetServer=HASH(0xad94260), Net::Server::Proto::UNIXDGRAM=GLOB(0xada23e0)) called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/Net/Server.pm line 74
        Net::Server::run_client_connection(RPC::Serialized::Server::NetServer=HASH(0xad94260)) called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/Net/Server/PreFork.pm line 229
        eval {...} called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/Net/Server/PreFork.pm line 229
        Net::Server::PreFork::run_child(RPC::Serialized::Server::NetServer=HASH(0xad94260)) called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/Net/Server/PreFork.pm line 187
        Net::Server::PreFork::run_n_children(RPC::Serialized::Server::NetServer=HASH(0xad94260), 5) called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/Net/Server/PreFork.pm line 111
        Net::Server::PreFork::loop(RPC::Serialized::Server::NetServer=HASH(0xad94260)) called at /ood_repository/environment_review/perl5/perls/perl-5.20.1/lib/site_perl/5.20.3/Net/Server.pm line 60
        Net::Server::run(RPC::Serialized::Server::NetServer=HASH(0xad94260)) called at bin/server.pl line 53

This is the server code:

my $server = RPC::Serialized::Server::NetServer->new(
    {
        net_server => { port => join( '/', '/tmp/testing', 'UNIXDGRAM' ) },
        rpc_serialized =>
          { handlers => { list => 'Siebel::Monitor::Server::Handler' } },
    }
);

$server->run();

And the client:

my $c = RPC::Serialized::Client::UNIX->new(
    {
        io_socket_unix =>
          { Peer => '/tmp/testing', Type => SOCK_DGRAM },
    }
);

my $result = $c->list();

The issue seems to be related to the method send() of RPC::Serialized, since it writes directly to the socket instead of calling send() method of IO::Socket.

ollyg commented 8 years ago

Hi, this looks sensible but would you be able to help me by offering a patch that changes to fix the issue?

glasswalk3r commented 8 years ago

I'll try to cook something, but cannot promise nothing besides that. :-)