qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: Address: Name cannot be null
Date Fri, 03 Aug 2012 09:05:04 GMT
On 08/02/2012 10:21 PM, Darryl L. Pierce wrote:
> I've written the initial Perl language bindings on top of what Swig
> gives us in Qpid. I'm now porting the examples in
> cpp/bindings/qpid/examples/perl over to use the newer code but am
> hitting this weird problem. (code can be found here [1])
>
> In the client/server examples, things start up nicely:
>
> 1. start a test instance of qpidd --auth=no
> 2. start server.pl
> 3. start client.pl
>
> It's on step #3 above that I see, in the server.pl window, the following
> error message:
>
> Name cannot be null at /home/mcpierce/Programming/Qpid/qpid/cpp/bindings/qpid/perl/qpid.pm
line 666.
> 2012-08-02 17:11:52 [Client] warning Connection [127.0.0.1:33410-127.0.0.1:5672] closed
>
> In qpid.pm the code in question (line 666, how ominous) is in
> qpid::Session:
>
> 656: sub create_sender {
> 657:     my ($self) = @_;
> 658:     my $impl = $self->{_impl};
> 659:
> 660:     my $address = $_[1];
> 661:
> 662:     if (ref($address) eq "qpid::Address") {
> 663:         my $temp = $address->get_implementation();
> 664:         $address = $temp;
> 665:     }
> 666:     my $send_impl = $impl->createSender($address);
> 667:
> 668:     return new qpid::Sender($send_impl, $self);
> 669: }
>
> And debugging this I see that indeed $address (which is an instance of
> cqpid_perl::Address) in fact does *not* have a name. The sender is being
> created by the following code in server.pl:
>
>      while (1) {
>          my $request = $receiver->fetch();
>          my $address = $request->get_reply_to();
>          if ($address) {
>
>              # RIGHT HERE
>              my $sender = $session->create_sender($address);
>
>              my $s = $request->get_content();
>              $s = uc($s);
>              my $response = new qpid::Message($s);
>              $sender->send($response);
>              print "Processed request: " . $request->get_content() . " -> " . $response->get_content()
. "\n";
>              $session->acknowledge();
>          }
>          else {
>              print "Error: no reply address specified for request: " . $request->get_content()
. "\n";
>              $session->reject($request);
>          }
>      }
>
> I'm at a loss how, if a name is required for an address, this instance
> of address is arriving without a name.

My guess it is somewhere in the mapping of the reply-to, either at the 
client or at the server, that something is going wrong in the perl 
binding. Turn on logging of the protocol trace as an easy way to see 
which end is at fault here.

The test is also probably not doing what is expected. It is testing that 
the address is a real object, not that it has a name. In c++ there is an 
automatic conversion to bool for an address that returns false if the 
name is null. That is likely not available through the mapping and needs 
some alternative or equivalent.

> Or is the Perl example outdated
> and I'm missing something?
>
> [1] https://github.com/mcpierce/Qpid/tree/Perl-language-bindings
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message