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 (JIRA)" <ji...@apache.org> on 2010/02/25 00:37:27 UTC
[jira] Created: (THRIFT-715) Thrift server built with ruby fails to
return values of 0
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
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.
[jira] Updated: (THRIFT-715) Thrift server built with ruby fails to
return values of 0
Posted by "Larry Kang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Larry Kang updated THRIFT-715:
------------------------------
Attachment: THRIFT-715.patch
Patch file for thrift/lib/rb/lib/thrift/struct.rb
> 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
> Attachments: THRIFT-715.patch
>
>
> 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.
[jira] Assigned: (THRIFT-715) Thrift server built with ruby fails
to return values of 0
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury reassigned THRIFT-715:
------------------------------------
Assignee: Bryan Duxbury
> 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.
[jira] Commented: (THRIFT-715) Thrift server built with ruby fails
to return values of 0
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Updated: (THRIFT-715) Thrift server built with ruby fails to
return values of 0
Posted by "Larry Kang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Larry Kang updated THRIFT-715:
------------------------------
Attachment: myservice.thrift
cl.rb
svr.rb
Rewrote test case to work with the latest thrift-instant-r916508
The test case passes with r916508
To run the server: ruby -rdebug -I<thrifloc>/thrift/lib/rb/lib -Igen-rb svr.rb
To run the client: ruby -rdebug -I<thriftloc>/thrift/lib/rb/lib -Igen-rb cl.rb
files:
svr.rb
cl.rb
myservice.thrift
> 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
> Attachments: cl.rb, myservice.thrift, svr.rb, THRIFT-715.patch
>
>
> 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.
[jira] Closed: (THRIFT-715) Thrift server built with ruby fails to
return values of 0
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury closed THRIFT-715.
--------------------------------
Resolution: Fixed
Fix Version/s: 0.3
I just committed a testcase. Thanks for bringing this to my attention, Larry!
> 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
> Fix For: 0.3
>
> Attachments: cl.rb, myservice.thrift, svr.rb, THRIFT-715.patch
>
>
> 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.