You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by Larry Kang <lk...@sbcglobal.net> on 2010/02/24 08:13:15 UTC

thrift server bug - return value of zero not sent by server

Hi all, 

I found a bug in the thrift ruby libs such that a server won't send a handler return value of 0 or false. 

For service.thrift:

service SimonSays {
  bool registerClient(1:string email);
}

On the server side, here's the ruby handler class:

def class SimonSaysServiceHandler 
  def registerClient ( email )
    return false # works for 'return true'
  end
end

The problem is no value returned to the client if the return value is 0 or false.

The problem appears in both thrift-instant-r760184.tar.gz (from facebook.com) and thrift-0.2.0-incubating.tar.gz from Apache.

I checked jira but no similar problem seems to be listed.  I wasnt able to find the mailing list archive to check.  I've identified the offending line of code and would like to fix it if nobody else has already.  I'm not familiar with how to contribute the fix, any advice? Thanks,

Re: thrift server bug - return value of zero not sent by server

Posted by Larry Kang <lk...@sbcglobal.net>.
Hi Brian, 

I found the "instant releases" link, and downloaded r915499.  The problem looks like it's been fixed in struct.rb, Struct.write:

        value = instance_variable_get("@#{name}")
        unless value.nil?

which used to be 

        if (value = instance_variable_get("@#{name}")) 

I tested the same fix yesterday in my code after looking at the equivalent PHP lib function. 

I'll file the bug with test cases as suggested, thanks.

Larry





________________________________
From: Bryan Duxbury <br...@rapleaf.com>
To: thrift-dev@incubator.apache.org
Sent: Wed, February 24, 2010 9:32:16 AM
Subject: Re: thrift server bug - return value of zero not sent by server

Hey Larry,

This sounds like a fairly serious bug, and while I was not specifically
familiar with it's manifestation, I think I may have incidentally fixed it
in a recent commit. I would absolutely love you to create a ticket and
attach a test case that exercises the problem, based on the current trunk.
If there's still a problem, I'll fix it immediately, and in any case, we'll
gain a useful regression test.

Thanks!

-Bryan

On Tue, Feb 23, 2010 at 11:13 PM, Larry Kang <lk...@sbcglobal.net> wrote:

> Hi all,
>
> I found a bug in the thrift ruby libs such that a server won't send a
> handler return value of 0 or false.
>
> For service.thrift:
>
> service SimonSays {
>  bool registerClient(1:string email);
> }
>
> On the server side, here's the ruby handler class:
>
> def class SimonSaysServiceHandler
>  def registerClient ( email )
>    return false # works for 'return true'
>  end
> end
>
> The problem is no value returned to the client if the return value is 0 or
> false.
>
> The problem appears in both thrift-instant-r760184.tar.gz (from
> facebook.com) and thrift-0.2.0-incubating.tar.gz from Apache.
>
> I checked jira but no similar problem seems to be listed.  I wasnt able to
> find the mailing list archive to check.  I've identified the offending line
> of code and would like to fix it if nobody else has already.  I'm not
> familiar with how to contribute the fix, any advice? Thanks,

Re: thrift server bug - return value of zero not sent by server

Posted by Bryan Duxbury <br...@rapleaf.com>.
Hey Larry,

This sounds like a fairly serious bug, and while I was not specifically
familiar with it's manifestation, I think I may have incidentally fixed it
in a recent commit. I would absolutely love you to create a ticket and
attach a test case that exercises the problem, based on the current trunk.
If there's still a problem, I'll fix it immediately, and in any case, we'll
gain a useful regression test.

Thanks!

-Bryan

On Tue, Feb 23, 2010 at 11:13 PM, Larry Kang <lk...@sbcglobal.net> wrote:

> Hi all,
>
> I found a bug in the thrift ruby libs such that a server won't send a
> handler return value of 0 or false.
>
> For service.thrift:
>
> service SimonSays {
>  bool registerClient(1:string email);
> }
>
> On the server side, here's the ruby handler class:
>
> def class SimonSaysServiceHandler
>  def registerClient ( email )
>    return false # works for 'return true'
>  end
> end
>
> The problem is no value returned to the client if the return value is 0 or
> false.
>
> The problem appears in both thrift-instant-r760184.tar.gz (from
> facebook.com) and thrift-0.2.0-incubating.tar.gz from Apache.
>
> I checked jira but no similar problem seems to be listed.  I wasnt able to
> find the mailing list archive to check.  I've identified the offending line
> of code and would like to fix it if nobody else has already.  I'm not
> familiar with how to contribute the fix, any advice? Thanks,

Re: thrift server bug - return value of zero not sent by server

Posted by Brian McKinney <br...@reframeit.com>.
Larry,
  We've seen the same behavior with one of our Ruby services where we are returning a count.  The problem disappeared when I rewrote the service in Erlang.

Cheers,

Brian

On Feb 24, 2010, at 12:13 AM, Larry Kang wrote:

> Hi all, 
> 
> I found a bug in the thrift ruby libs such that a server won't send a handler return value of 0 or false. 
> 
> For service.thrift:
> 
> service SimonSays {
>  bool registerClient(1:string email);
> }
> 
> On the server side, here's the ruby handler class:
> 
> def class SimonSaysServiceHandler 
>  def registerClient ( email )
>    return false # works for 'return true'
>  end
> end
> 
> The problem is no value returned to the client if the return value is 0 or false.
> 
> The problem appears in both thrift-instant-r760184.tar.gz (from facebook.com) and thrift-0.2.0-incubating.tar.gz from Apache.
> 
> I checked jira but no similar problem seems to be listed.  I wasnt able to find the mailing list archive to check.  I've identified the offending line of code and would like to fix it if nobody else has already.  I'm not familiar with how to contribute the fix, any advice? Thanks,