You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Ben Taitelbaum (JIRA)" <ji...@apache.org> on 2008/05/28 00:36:59 UTC

[jira] Created: (THRIFT-24) calls hang on incompatible types

calls hang on incompatible types
--------------------------------

                 Key: THRIFT-24
                 URL: https://issues.apache.org/jira/browse/THRIFT-24
             Project: Thrift
          Issue Type: Bug
          Components: Compiler (Ruby)
         Environment: osx 10.5.2, thrift svn trunk
            Reporter: Ben Taitelbaum


When passing a string when an array is expected, the call hangs. I think the best solution would be to add type checking to thrift calls so that an appropriate exception (or a TTransportException with an appropriate message).

To reproduce:

1. I added the following call to tutorial.thrift (in service Calculator):
list<string> identity(1:list<string> obj)

2. I added an implementation to RubyService.rb
3. I changed the calls in RubyClient.rb to:
  client.ping()
  print "ping()\n"

  puts client.identity(['hello', 'world']).inspect
  puts client.identity('hello world').inspect

Server output (it hung, so I pressed Ctrl+c on the server):
Starting the server...
ping()
^C./thrift/transport/tsocket.rb:47:in `recv': Interrupt
	from ./thrift/transport/tsocket.rb:47:in `read'
	from ./thrift/transport/ttransport.rb:91:in `read'
	from ./thrift/transport/ttransport.rb:44:in `readAll'
	from ./thrift/protocol/tbinaryprotocol.rb:151:in `readI32'
	from ./thrift/protocol/tbinaryprotocol.rb:178:in `readString'
	from ./thrift/protocol/tprotocol.rb:161:in `read_type'
	from ./thrift/thrift.rb:263:in `read_field'
	from ./thrift/thrift.rb:251:in `read_field'
	 ... 9 levels...
	from ./thrift/thrift.rb:42:in `send'
	from ./thrift/thrift.rb:42:in `process'
	from ./thrift/server/tserver.rb:43:in `serve'
	from ./RubyServer.rb:80

Client output (this time, I pressed ctrl+c on the client):
ping()
["hello", "world"]
^C./thrift/transport/tsocket.rb:47:in `recv': Interrupt
	from ./thrift/transport/tsocket.rb:47:in `read'
	from ./thrift/transport/ttransport.rb:91:in `read'
	from ./thrift/transport/ttransport.rb:44:in `readAll'
	from ./thrift/protocol/tbinaryprotocol.rb:151:in `readI32'
	from ./thrift/protocol/tbinaryprotocol.rb:89:in `readMessageBegin'
	from ./thrift/thrift.rb:160:in `receive_message'
	from ../gen-rb/Calculator.rb:78:in `recv_identity'
	from ../gen-rb/Calculator.rb:70:in `identity'
	from ./RubyClient.rb:23




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (THRIFT-24) calls hang on incompatible types

Posted by "Kevin Ballard (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-24?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Ballard resolved THRIFT-24.
---------------------------------

    Resolution: Duplicate

What happens is an exception is raised, and the transport is never flushed. THRIFT-75 currently has a patch to close the transport when this happens, and that should be the appropriate solution. Marking this as a dupe of THRIFT-75 for that reason.

Additionally, there is optional type-checking already implemented. Just set Thrift.type_checking = true and an exception will be raised if a struct is every initialized or a field setter is ever called using the wrong type.

> calls hang on incompatible types
> --------------------------------
>
>                 Key: THRIFT-24
>                 URL: https://issues.apache.org/jira/browse/THRIFT-24
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Ruby)
>         Environment: osx 10.5.2, thrift svn trunk
>            Reporter: Ben Taitelbaum
>
> When passing a string when an array is expected, the call hangs. I think the best solution would be to add type checking to thrift calls so that an appropriate exception (or a TTransportException with an appropriate message).
> To reproduce:
> 1. I added the following call to tutorial.thrift (in service Calculator):
> list<string> identity(1:list<string> obj)
> 2. I added an implementation to RubyService.rb
> 3. I changed the calls in RubyClient.rb to:
>   client.ping()
>   print "ping()\n"
>   puts client.identity(['hello', 'world']).inspect
>   puts client.identity('hello world').inspect
> Server output (it hung, so I pressed Ctrl+c on the server):
> Starting the server...
> ping()
> ^C./thrift/transport/tsocket.rb:47:in `recv': Interrupt
> 	from ./thrift/transport/tsocket.rb:47:in `read'
> 	from ./thrift/transport/ttransport.rb:91:in `read'
> 	from ./thrift/transport/ttransport.rb:44:in `readAll'
> 	from ./thrift/protocol/tbinaryprotocol.rb:151:in `readI32'
> 	from ./thrift/protocol/tbinaryprotocol.rb:178:in `readString'
> 	from ./thrift/protocol/tprotocol.rb:161:in `read_type'
> 	from ./thrift/thrift.rb:263:in `read_field'
> 	from ./thrift/thrift.rb:251:in `read_field'
> 	 ... 9 levels...
> 	from ./thrift/thrift.rb:42:in `send'
> 	from ./thrift/thrift.rb:42:in `process'
> 	from ./thrift/server/tserver.rb:43:in `serve'
> 	from ./RubyServer.rb:80
> Client output (this time, I pressed ctrl+c on the client):
> ping()
> ["hello", "world"]
> ^C./thrift/transport/tsocket.rb:47:in `recv': Interrupt
> 	from ./thrift/transport/tsocket.rb:47:in `read'
> 	from ./thrift/transport/ttransport.rb:91:in `read'
> 	from ./thrift/transport/ttransport.rb:44:in `readAll'
> 	from ./thrift/protocol/tbinaryprotocol.rb:151:in `readI32'
> 	from ./thrift/protocol/tbinaryprotocol.rb:89:in `readMessageBegin'
> 	from ./thrift/thrift.rb:160:in `receive_message'
> 	from ../gen-rb/Calculator.rb:78:in `recv_identity'
> 	from ../gen-rb/Calculator.rb:70:in `identity'
> 	from ./RubyClient.rb:23

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.