You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Anatoly Kanivetsky (JIRA)" <ji...@apache.org> on 2011/04/19 12:03:05 UTC

[jira] [Created] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

Produce more informative runtime error in case of schema and data mismatch during serialization
-----------------------------------------------------------------------------------------------

                 Key: THRIFT-1151
                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
             Project: Thrift
          Issue Type: Improvement
          Components: Erlang - Library
            Reporter: Anatoly Kanivetsky


This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Anthony Molinaro reassigned THRIFT-1151:
----------------------------------------

    Assignee: Anthony Molinaro

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>         Attachments: diff.txt
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Anatoly Kanivetsky commented on THRIFT-1151:
--------------------------------------------

Sorry, just uncomment this function in patch :)

Example of problem:

in some.thrift file:

struct StructA { 1: i16     x; }
struct StructB { 1: i32     x; }
struct StructC { 1: StructA x; }

in some.erl file, 

S1 = #structC{x=#structB{x=1}},
S2 = #structC{x=#structA{x=1}},

Sending S1 should fail with error, since it is not valid StructC.
Can be validated with service, or just by:

{ok, Transport} = thrift_memory_buffer:new(),
{ok, Protocol} = thrift_binary_protocol:new(Transport),
thrift_protocol:write(Protocol, {{struct, {'some_types', structC}}, S1})

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>         Attachments: diff.txt
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Anthony Molinaro commented on THRIFT-1151:
------------------------------------------

Okay, commited.

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>             Fix For: 0.7
>
>         Attachments: diff.txt, thrift-1151.patch
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Anthony Molinaro resolved THRIFT-1151.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 0.7

Committed with a slight change, instead of exit/1, I use error/2.  I think this is closer to how other failures work, for instance providing the wrong type for x results in a bad argument error exception.

Thanks for the path Anatoly.

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>             Fix For: 0.7
>
>         Attachments: diff.txt
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Roger Meier commented on THRIFT-1151:
-------------------------------------

Yes, it works! Could you commit?

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>             Fix For: 0.7
>
>         Attachments: diff.txt, thrift-1151.patch
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Hudson commented on THRIFT-1151:
--------------------------------

Integrated in Thrift #171 (See [https://builds.apache.org/job/Thrift/171/])
    

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>             Fix For: 0.7
>
>         Attachments: diff.txt, thrift-1151.patch
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Roger Meier commented on THRIFT-1151:
-------------------------------------

The build machine uses 13b, I have 14a on Debian Squeeze with the same issue.

A stupid question: How can I prefix error with erlang, the verify or test this?


> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>             Fix For: 0.7
>
>         Attachments: diff.txt
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Roger Meier commented on THRIFT-1151:
-------------------------------------

This commit breaks the build running on Ubuntu... see https://builds.apache.org/view/S-Z/view/Thrift/job/Thrift/167/console
{noformat}
Making all in src
make[4]: Entering directory `/home/hudson/hudson-slave/workspace/Thrift/thrift/lib/erl/src'
mkdir ../ebin
   ERLC  thrift_protocol.erl
./thrift_protocol.erl:335: function error/2 undefined
make[4]: *** [../ebin/thrift_protocol.beam] Error 1
{noformat}

As a erlang newbie, I have no idea why... any suggestions?

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>             Fix For: 0.7
>
>         Attachments: diff.txt
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Anthony Molinaro commented on THRIFT-1151:
------------------------------------------

Can you give me an example to test this patch out with?  Also, I'm a little confused, it seems like this patch only contains commented out code.

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>         Attachments: diff.txt
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Anthony Molinaro commented on THRIFT-1151:
------------------------------------------

Ahh, I bet Ubuntu uses R13 or earlier.  I'm pretty sure the fix is to prefix error with erlang: can you try that and see if it compiles?

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>             Fix For: 0.7
>
>         Attachments: diff.txt
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Anatoly Kanivetsky updated THRIFT-1151:
---------------------------------------

    Attachment: diff.txt

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>         Attachments: diff.txt
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Anthony Molinaro updated THRIFT-1151:
-------------------------------------

    Attachment: thrift-1151.patch

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>             Fix For: 0.7
>
>         Attachments: diff.txt, thrift-1151.patch
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (THRIFT-1151) Produce more informative runtime error in case of schema and data mismatch during serialization

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

Anthony Molinaro commented on THRIFT-1151:
------------------------------------------

Try applying the patch I just uploaded then just run make.

Essentially the line which starts with 'error(struct_unmatched, ...' needs to be 'erlang:error(struct_unmatched, ...'.  In R14B onward they dropped the need for the leading erlang: (which specifies this function is in the erlang module).  R14A should be avoided as it's an alpha release.  The fact that Debian Squeeze uses it is unfortunate.  If at all possible you should be running R13B04 or R14B03.

Let me know if the patch works for you.

> Produce more informative runtime error in case of schema and data mismatch during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>             Fix For: 0.7
>
>         Attachments: diff.txt, thrift-1151.patch
>
>
> This patch adds generation of informative error during serialization of struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira