Re: Getting -9 when setting blocking to 0 in Perl

2014-01-14 Thread Darryl L. Pierce
On Thu, Jan 09, 2014 at 04:06:38PM -0500, Darryl L. Pierce wrote:
> On Thu, Jan 09, 2014 at 03:19:52PM -0500, Rafael Schloming wrote:
> > In the case of the C API getting a PN_INPROGRESS error (-9) from recv is
> > expected behaviour if you're in non blocking mode. That just means that
> > there is blocking work that was deferred.
> 
> Okay, that explains why it didn't start working until bool was properly
> translated to/from Perl.
> 
> Now, another issue that's cropped up with the Perl work is that, if
> pn_messenger_work is called with -1 then Perl never gets a message
> unless I explicitly kill the sender (I'm using the Python send_async
> script to interact with the recv_async.pl Perl script). If I set work to
> timeout then it times out but only gets the late (the "die") message.

This morning Ted asked whether Perl uses pthreads or not. The Perl
binary links against libpthread.so.0 on Linux, so I assume it's using
them. I've tried spawning the actual asynchronous process on its own
separate thread and still no joy: the call to work(-1) never returns
even when messages are prending.

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/



pgpv9bWQfR1eG.pgp
Description: PGP signature


Re: Getting -9 when setting blocking to 0 in Perl

2014-01-09 Thread Darryl L. Pierce
On Thu, Jan 09, 2014 at 03:19:52PM -0500, Rafael Schloming wrote:
> In the case of the C API getting a PN_INPROGRESS error (-9) from recv is
> expected behaviour if you're in non blocking mode. That just means that
> there is blocking work that was deferred.

Okay, that explains why it didn't start working until bool was properly
translated to/from Perl.

Now, another issue that's cropped up with the Perl work is that, if
pn_messenger_work is called with -1 then Perl never gets a message
unless I explicitly kill the sender (I'm using the Python send_async
script to interact with the recv_async.pl Perl script). If I set work to
timeout then it times out but only gets the late (the "die") message.

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/



pgp9nE6FSg7lC.pgp
Description: PGP signature


Re: Getting -9 when setting blocking to 0 in Perl

2014-01-09 Thread Rafael Schloming
On Thu, Jan 9, 2014 at 10:29 AM, Darryl L. Pierce wrote:

> On Thu, Jan 09, 2014 at 10:19:36AM -0500, Rafael Schloming wrote:
> > Well, proton/error.h defines -9 to be PN_INPROGRESS, however given that
> > this is the source code of pn_messenger_set_blocking:
> >
> > int pn_messenger_set_blocking(pn_messenger_t *messenger, bool blocking)
> > {
> >   messenger->blocking = blocking;
> >   return 0;
> > }
> >
> > I don't see how it's possible for it to return anything other than 0.
>
> Sorry, I meant that I'm getting a -9 error condition on calling
> pn_messenger_receive when blocking is set to 0.
>
> I added to perl.i a conversion for the bool type so that it Perl->C
> would use true/false and for C->Perl would use 1/undef. With that done
> the Perl bindings stopped getting a -9 on calling receive.
>
> I'll post it on Review Board once I get it working (I'm writing a Perl
> version of {send,recv}_async to test this new feature).
>

In the case of the C API getting a PN_INPROGRESS error (-9) from recv is
expected behaviour if you're in non blocking mode. That just means that
there is blocking work that was deferred.

--Rafael


Re: Getting -9 when setting blocking to 0 in Perl

2014-01-09 Thread Rafael Schloming
Well, proton/error.h defines -9 to be PN_INPROGRESS, however given that
this is the source code of pn_messenger_set_blocking:

int pn_messenger_set_blocking(pn_messenger_t *messenger, bool blocking)
{
  messenger->blocking = blocking;
  return 0;
}

I don't see how it's possible for it to return anything other than 0.

--Rafael



On Wed, Jan 8, 2014 at 3:18 PM, Darryl L. Pierce  wrote:

> Since, in Perl, we don't have a true/false value, I try to turn off
> blocking in qpid::perl::Messenger with:
>
> my $msgr = qpid::perl::Messenger->new();
>
> $msgr->set_blocking(0); // I just added this as a passthrough to
> pn_messenger_set_blocking
>
> If I pass in 0, "0" or undef to signify it's non-blocking, I get a -9
> error.
> If I pass in 1 or some other value, things work correctly.
>
> Any ideas?
>
> --
> Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
> Delivering value year after year.
> Red Hat ranks #1 in value among software vendors.
> http://www.redhat.com/promo/vendor/
>
>


Re: Getting -9 when setting blocking to 0 in Perl

2014-01-09 Thread Darryl L. Pierce
On Thu, Jan 09, 2014 at 10:19:36AM -0500, Rafael Schloming wrote:
> Well, proton/error.h defines -9 to be PN_INPROGRESS, however given that
> this is the source code of pn_messenger_set_blocking:
> 
> int pn_messenger_set_blocking(pn_messenger_t *messenger, bool blocking)
> {
>   messenger->blocking = blocking;
>   return 0;
> }
> 
> I don't see how it's possible for it to return anything other than 0.

Sorry, I meant that I'm getting a -9 error condition on calling
pn_messenger_receive when blocking is set to 0.

I added to perl.i a conversion for the bool type so that it Perl->C
would use true/false and for C->Perl would use 1/undef. With that done
the Perl bindings stopped getting a -9 on calling receive.

I'll post it on Review Board once I get it working (I'm writing a Perl
version of {send,recv}_async to test this new feature).

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/



pgpq9KkU0RufP.pgp
Description: PGP signature


Getting -9 when setting blocking to 0 in Perl

2014-01-08 Thread Darryl L. Pierce
Since, in Perl, we don't have a true/false value, I try to turn off
blocking in qpid::perl::Messenger with:

my $msgr = qpid::perl::Messenger->new();

$msgr->set_blocking(0); // I just added this as a passthrough to 
pn_messenger_set_blocking

If I pass in 0, "0" or undef to signify it's non-blocking, I get a -9 error.
If I pass in 1 or some other value, things work correctly.

Any ideas?

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/



pgpv7G0STaMKY.pgp
Description: PGP signature