You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2010/02/25 19:50:27 UTC
[jira] Commented: (THRIFT-715) Thrift server built with ruby fails
to return values of 0
[ https://issues.apache.org/jira/browse/THRIFT-715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838476#action_12838476 ]
Bryan Duxbury commented on THRIFT-715:
--------------------------------------
Hey Larry, could I convince you to attach this as a patch and check the ASF license box?
> Thrift server built with ruby fails to return values of 0
> ---------------------------------------------------------
>
> Key: THRIFT-715
> URL: https://issues.apache.org/jira/browse/THRIFT-715
> Project: Thrift
> Issue Type: Bug
> Components: Library (Ruby)
> Affects Versions: 0.2
> Environment: Linux on x86_64
> Reporter: Larry Kang
> Assignee: Bryan Duxbury
>
> A thrift server built with ruby does will only return nonzero values from the handler functions.
> In the following test case, when registerClient returns 0, the client throws an exception. If register client returns a nonzero value, no exception is generated.
> Test case:
> file myservice.thrift:
> service MyService{
> bool registerClient(1:string email);
> }
> Create a server handler in ruby:
>
> file svr.rb:
> $:.push('./gen-rb')
> require 'thrift/transport/socket'
> require 'thrift/protocol/binaryprotocol'
> require 'thrift/server'
> require 'MyService'
> def class MyServiceHandler
> def registerClient ( email )
> return false # works for 'return true'
> end
> end
> handler = MyServiceHandler.new()
> processor = MyService::Processor.new(handler)
> transport = Thrift::ServerSocket.new( 9030 ) # client code
> server = Thrift::SimpleServer.new(processor, transport )
> puts "Starting the MyService server..."
> server.serve()
> puts "Done"
> Here's the client:
> file cl.rb:
> require 'gen-rb/MyService.rb'
> # include Thrift
> def run( )
> transport = Thrift::Socket.new( "localhost", 9030, 10 )
> transport.open
> protocol = Thrift::BinaryProtocol.new( transport )
> client = MyService::Client.new( protocol )
> puts "MyService client created"
> begin
> retval = client.registerClient( "email@host.com" )
> rescue Exception => e
> puts "Exception caught during registerClient:
> puts e.message
> else
> puts "registerClient returned = #{retval}"
> end
> end
> run()
> The following error is put out by the client:
> Exception caught during registerClient
> registerClient failed: unknown result
> The problem appears in both thrift-instant-r760184.tar.gz (from facebook.com) and thrift-0.2.0-incubating.tar.gz from Apache.
> =========
> The offending code is in struct.rb, Struct.write:
> if (value = instance_variable_get("@#{name}"))
> It appears to have been fixed in r915499 with the following code:
> value = instance_variable_get("@#{name}")
> unless value.nil?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.