You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Luke Lu (JIRA)" <ji...@apache.org> on 2009/01/31 10:36:59 UTC

[jira] Created: (THRIFT-298) Exception propagation seems broken for Ruby clients

Exception propagation seems broken for Ruby clients
---------------------------------------------------

                 Key: THRIFT-298
                 URL: https://issues.apache.org/jira/browse/THRIFT-298
             Project: Thrift
          Issue Type: Bug
          Components: Library (Ruby)
            Reporter: Luke Lu
            Priority: Blocker


Instead of raising the user defined exception, it's ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)

Any thrift service that throws user defined exceptions would get the same exception. Here is an example for the included tutorial:

$ ./RubyClient.rb 
ping()
ping()
add(1,1)
1+1=2
add(1,4)
1+4=5
calculate(1, Work(comment=None, num1=15, num2=10, op=2))
15-10=5
getStruct(1)
Log: 5
calculate(1, Work(comment=None, num1=1, num2=0, op=4))
../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
        from ../../lib/rb/lib/thrift/struct.rb:176:in `call'
        from ../../lib/rb/lib/thrift/struct.rb:176:in `exception_initialize'
        from ../../lib/rb/lib/thrift/struct.rb:194:in `initialize'
        from ../../lib/rb/lib/thrift/struct.rb:194:in `new'
        from ../../lib/rb/lib/thrift/struct.rb:194:in `read_field'
        from ../../lib/rb/lib/thrift/struct.rb:184:in `handle_message'
        from ../../lib/rb/lib/thrift/struct.rb:95:in `read'
        from ../../lib/rb/lib/thrift/struct.rb:92:in `loop'
        from ../../lib/rb/lib/thrift/struct.rb:92:in `read'
        from ../../lib/rb/lib/thrift/client.rb:29:in `receive_message'
        from ../gen-rb/Calculator.rb:55:in `recv_calculate'
        from ../gen-rb/Calculator.rb:47:in `calculate'
        from ./RubyClient.rb:44

I've verified that this is broken in the current trunk (and quite a few commits back as well)

This is a blocker for us to release another open source package using thrift.


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


[jira] Commented: (THRIFT-298) Exception propagation seems broken for Ruby clients

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12669494#action_12669494 ] 

Bryan Duxbury commented on THRIFT-298:
--------------------------------------

Well, if you can believe it, I don't get what's going on here, either :). I think this code is a little too complicated. For now, I think I'll just apply your patch, and hopefully one day it won't be a problem, as I refactor my way through the Ruby libraries.

> Exception propagation seems broken for Ruby clients
> ---------------------------------------------------
>
>                 Key: THRIFT-298
>                 URL: https://issues.apache.org/jira/browse/THRIFT-298
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>            Reporter: Luke Lu
>            Priority: Blocker
>         Attachments: 0001-THRIFT-298-Fixed-generated-exception-propagation-in.patch
>
>
> Instead of raising the user defined exception, it's ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
> Any thrift service that throws user defined exceptions would get the same exception. Here is an example for the included tutorial:
> $ ./RubyClient.rb 
> ping()
> ping()
> add(1,1)
> 1+1=2
> add(1,4)
> 1+4=5
> calculate(1, Work(comment=None, num1=15, num2=10, op=2))
> 15-10=5
> getStruct(1)
> Log: 5
> calculate(1, Work(comment=None, num1=1, num2=0, op=4))
> ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `call'
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `exception_initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `new'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `read_field'
>         from ../../lib/rb/lib/thrift/struct.rb:184:in `handle_message'
>         from ../../lib/rb/lib/thrift/struct.rb:95:in `read'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `loop'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `read'
>         from ../../lib/rb/lib/thrift/client.rb:29:in `receive_message'
>         from ../gen-rb/Calculator.rb:55:in `recv_calculate'
>         from ../gen-rb/Calculator.rb:47:in `calculate'
>         from ./RubyClient.rb:44
> I've verified that this is broken in the current trunk (and quite a few commits back as well)
> This is a blocker for us to release another open source package using thrift.

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


[jira] Closed: (THRIFT-298) Exception propagation seems broken for Ruby clients

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

Luke Lu closed THRIFT-298.
--------------------------


Thanks!

> Exception propagation seems broken for Ruby clients
> ---------------------------------------------------
>
>                 Key: THRIFT-298
>                 URL: https://issues.apache.org/jira/browse/THRIFT-298
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>            Reporter: Luke Lu
>            Assignee: Luke Lu
>            Priority: Blocker
>         Attachments: 0001-THRIFT-298-Fixed-generated-exception-propagation-in.patch
>
>
> Instead of raising the user defined exception, it's ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
> Any thrift service that throws user defined exceptions would get the same exception. Here is an example for the included tutorial:
> $ ./RubyClient.rb 
> ping()
> ping()
> add(1,1)
> 1+1=2
> add(1,4)
> 1+4=5
> calculate(1, Work(comment=None, num1=15, num2=10, op=2))
> 15-10=5
> getStruct(1)
> Log: 5
> calculate(1, Work(comment=None, num1=1, num2=0, op=4))
> ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `call'
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `exception_initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `new'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `read_field'
>         from ../../lib/rb/lib/thrift/struct.rb:184:in `handle_message'
>         from ../../lib/rb/lib/thrift/struct.rb:95:in `read'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `loop'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `read'
>         from ../../lib/rb/lib/thrift/client.rb:29:in `receive_message'
>         from ../gen-rb/Calculator.rb:55:in `recv_calculate'
>         from ../gen-rb/Calculator.rb:47:in `calculate'
>         from ./RubyClient.rb:44
> I've verified that this is broken in the current trunk (and quite a few commits back as well)
> This is a blocker for us to release another open source package using thrift.

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


[jira] Commented: (THRIFT-298) Exception propagation seems broken for Ruby clients

Posted by "Luke Lu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12669490#action_12669490 ] 

Luke Lu commented on THRIFT-298:
--------------------------------

I guessed just enough to fix the problem but I don't understand the code enough to write a correct spec for this. I think the original author of the feature (Kevin Ballard (committed by Kevin Clark), I believe, according to the log) and whoever is refactoring ruby protocols (in this case, you, Bryan) should write specs for all the features of thrift.

> Exception propagation seems broken for Ruby clients
> ---------------------------------------------------
>
>                 Key: THRIFT-298
>                 URL: https://issues.apache.org/jira/browse/THRIFT-298
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>            Reporter: Luke Lu
>            Priority: Blocker
>         Attachments: 0001-THRIFT-298-Fixed-generated-exception-propagation-in.patch
>
>
> Instead of raising the user defined exception, it's ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
> Any thrift service that throws user defined exceptions would get the same exception. Here is an example for the included tutorial:
> $ ./RubyClient.rb 
> ping()
> ping()
> add(1,1)
> 1+1=2
> add(1,4)
> 1+4=5
> calculate(1, Work(comment=None, num1=15, num2=10, op=2))
> 15-10=5
> getStruct(1)
> Log: 5
> calculate(1, Work(comment=None, num1=1, num2=0, op=4))
> ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `call'
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `exception_initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `new'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `read_field'
>         from ../../lib/rb/lib/thrift/struct.rb:184:in `handle_message'
>         from ../../lib/rb/lib/thrift/struct.rb:95:in `read'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `loop'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `read'
>         from ../../lib/rb/lib/thrift/client.rb:29:in `receive_message'
>         from ../gen-rb/Calculator.rb:55:in `recv_calculate'
>         from ../gen-rb/Calculator.rb:47:in `calculate'
>         from ./RubyClient.rb:44
> I've verified that this is broken in the current trunk (and quite a few commits back as well)
> This is a blocker for us to release another open source package using thrift.

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


[jira] Commented: (THRIFT-298) Exception propagation seems broken for Ruby clients

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12669484#action_12669484 ] 

Bryan Duxbury commented on THRIFT-298:
--------------------------------------

Any chance of adding an explicit spec to ruby lib for this?

> Exception propagation seems broken for Ruby clients
> ---------------------------------------------------
>
>                 Key: THRIFT-298
>                 URL: https://issues.apache.org/jira/browse/THRIFT-298
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>            Reporter: Luke Lu
>            Priority: Blocker
>         Attachments: 0001-THRIFT-298-Fixed-generated-exception-propagation-in.patch
>
>
> Instead of raising the user defined exception, it's ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
> Any thrift service that throws user defined exceptions would get the same exception. Here is an example for the included tutorial:
> $ ./RubyClient.rb 
> ping()
> ping()
> add(1,1)
> 1+1=2
> add(1,4)
> 1+4=5
> calculate(1, Work(comment=None, num1=15, num2=10, op=2))
> 15-10=5
> getStruct(1)
> Log: 5
> calculate(1, Work(comment=None, num1=1, num2=0, op=4))
> ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `call'
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `exception_initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `new'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `read_field'
>         from ../../lib/rb/lib/thrift/struct.rb:184:in `handle_message'
>         from ../../lib/rb/lib/thrift/struct.rb:95:in `read'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `loop'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `read'
>         from ../../lib/rb/lib/thrift/client.rb:29:in `receive_message'
>         from ../gen-rb/Calculator.rb:55:in `recv_calculate'
>         from ../gen-rb/Calculator.rb:47:in `calculate'
>         from ./RubyClient.rb:44
> I've verified that this is broken in the current trunk (and quite a few commits back as well)
> This is a blocker for us to release another open source package using thrift.

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


[jira] Assigned: (THRIFT-298) Exception propagation seems broken for Ruby clients

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

Bryan Duxbury reassigned THRIFT-298:
------------------------------------

    Assignee: Luke Lu

> Exception propagation seems broken for Ruby clients
> ---------------------------------------------------
>
>                 Key: THRIFT-298
>                 URL: https://issues.apache.org/jira/browse/THRIFT-298
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>            Reporter: Luke Lu
>            Assignee: Luke Lu
>            Priority: Blocker
>         Attachments: 0001-THRIFT-298-Fixed-generated-exception-propagation-in.patch
>
>
> Instead of raising the user defined exception, it's ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
> Any thrift service that throws user defined exceptions would get the same exception. Here is an example for the included tutorial:
> $ ./RubyClient.rb 
> ping()
> ping()
> add(1,1)
> 1+1=2
> add(1,4)
> 1+4=5
> calculate(1, Work(comment=None, num1=15, num2=10, op=2))
> 15-10=5
> getStruct(1)
> Log: 5
> calculate(1, Work(comment=None, num1=1, num2=0, op=4))
> ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `call'
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `exception_initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `new'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `read_field'
>         from ../../lib/rb/lib/thrift/struct.rb:184:in `handle_message'
>         from ../../lib/rb/lib/thrift/struct.rb:95:in `read'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `loop'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `read'
>         from ../../lib/rb/lib/thrift/client.rb:29:in `receive_message'
>         from ../gen-rb/Calculator.rb:55:in `recv_calculate'
>         from ../gen-rb/Calculator.rb:47:in `calculate'
>         from ./RubyClient.rb:44
> I've verified that this is broken in the current trunk (and quite a few commits back as well)
> This is a blocker for us to release another open source package using thrift.

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


[jira] Resolved: (THRIFT-298) Exception propagation seems broken for Ruby clients

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

Bryan Duxbury resolved THRIFT-298.
----------------------------------

    Resolution: Fixed

I just committed this.

> Exception propagation seems broken for Ruby clients
> ---------------------------------------------------
>
>                 Key: THRIFT-298
>                 URL: https://issues.apache.org/jira/browse/THRIFT-298
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>            Reporter: Luke Lu
>            Priority: Blocker
>         Attachments: 0001-THRIFT-298-Fixed-generated-exception-propagation-in.patch
>
>
> Instead of raising the user defined exception, it's ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
> Any thrift service that throws user defined exceptions would get the same exception. Here is an example for the included tutorial:
> $ ./RubyClient.rb 
> ping()
> ping()
> add(1,1)
> 1+1=2
> add(1,4)
> 1+4=5
> calculate(1, Work(comment=None, num1=15, num2=10, op=2))
> 15-10=5
> getStruct(1)
> Log: 5
> calculate(1, Work(comment=None, num1=1, num2=0, op=4))
> ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `call'
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `exception_initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `new'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `read_field'
>         from ../../lib/rb/lib/thrift/struct.rb:184:in `handle_message'
>         from ../../lib/rb/lib/thrift/struct.rb:95:in `read'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `loop'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `read'
>         from ../../lib/rb/lib/thrift/client.rb:29:in `receive_message'
>         from ../gen-rb/Calculator.rb:55:in `recv_calculate'
>         from ../gen-rb/Calculator.rb:47:in `calculate'
>         from ./RubyClient.rb:44
> I've verified that this is broken in the current trunk (and quite a few commits back as well)
> This is a blocker for us to release another open source package using thrift.

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


[jira] Updated: (THRIFT-298) Exception propagation seems broken for Ruby clients

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

Luke Lu updated THRIFT-298:
---------------------------

    Attachment: 0001-THRIFT-298-Fixed-generated-exception-propagation-in.patch

Looks like there is a simple one line fix for this problem (see attached patch)

Our exceptions now works fine and the tutorial output looks more reasonable:

$ ./RubyClient.rb 
ping()
ping()
add(1,1)
1+1=2
add(1,4)
1+4=5
calculate(1, Work(comment=None, num1=15, num2=10, op=2))
15-10=5
getStruct(1)
Log: 5
calculate(1, Work(comment=None, num1=1, num2=0, op=4))
InvalidOperation: Cannot divide by 0
zip
zip()


> Exception propagation seems broken for Ruby clients
> ---------------------------------------------------
>
>                 Key: THRIFT-298
>                 URL: https://issues.apache.org/jira/browse/THRIFT-298
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>            Reporter: Luke Lu
>            Priority: Blocker
>         Attachments: 0001-THRIFT-298-Fixed-generated-exception-propagation-in.patch
>
>
> Instead of raising the user defined exception, it's ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
> Any thrift service that throws user defined exceptions would get the same exception. Here is an example for the included tutorial:
> $ ./RubyClient.rb 
> ping()
> ping()
> add(1,1)
> 1+1=2
> add(1,4)
> 1+4=5
> calculate(1, Work(comment=None, num1=15, num2=10, op=2))
> 15-10=5
> getStruct(1)
> Log: 5
> calculate(1, Work(comment=None, num1=1, num2=0, op=4))
> ../../lib/rb/lib/thrift/struct.rb:176:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `call'
>         from ../../lib/rb/lib/thrift/struct.rb:176:in `exception_initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `initialize'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `new'
>         from ../../lib/rb/lib/thrift/struct.rb:194:in `read_field'
>         from ../../lib/rb/lib/thrift/struct.rb:184:in `handle_message'
>         from ../../lib/rb/lib/thrift/struct.rb:95:in `read'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `loop'
>         from ../../lib/rb/lib/thrift/struct.rb:92:in `read'
>         from ../../lib/rb/lib/thrift/client.rb:29:in `receive_message'
>         from ../gen-rb/Calculator.rb:55:in `recv_calculate'
>         from ../gen-rb/Calculator.rb:47:in `calculate'
>         from ./RubyClient.rb:44
> I've verified that this is broken in the current trunk (and quite a few commits back as well)
> This is a blocker for us to release another open source package using thrift.

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