You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Noam Wolf <no...@gmail.com> on 2010/02/22 15:25:33 UTC

Bad type in structure

I'm seeing this error for the first time.  Looking at where the error is
thrown it looks like maybe the object that is returned from the rpc is not
the expected one.... is that true? what does this mean if both the server
and client are using the same .thrift file?

-- 
Best Regards,
Noam Wolf

Re: Bad type in structure

Posted by Ted Dunning <te...@gmail.com>.
Sorry about being too emphatic.

Thanks for being so gracious.

On Mon, Feb 22, 2010 at 11:02 AM, Noam Wolf <no...@gmail.com> wrote:

> Point taken... no need to shout ;)
>
> But in all seriousness you are completely correct, thanks for the input!
>



-- 
Ted Dunning, CTO
DeepDyve

Re: Bad type in structure

Posted by Noam Wolf <no...@gmail.com>.
Point taken... no need to shout ;)

But in all seriousness you are completely correct, thanks for the input!

On Mon, Feb 22, 2010 at 6:59 PM, Ted Dunning <te...@gmail.com> wrote:

> Actually it is a VERY good solution.  That you can (and should) do this is
> a
> major feature of Thrift which allows some level of future proofing of the
> interface.
>
> Read the original thrift paper.  You should never re-use an index for a
> different purpose if there is any chance at all that old/new clients will
> interact with new/old servers (i.e. anywhere in the known universe).
>
> On Mon, Feb 22, 2010 at 10:54 AM, Noam Wolf <no...@gmail.com> wrote:
>
> > it was my understanding that the id's were a unique, sequential, index...
> i
> > guess it makes sense that they don't need to be sequential but if I don't
> > have control over the server this might not be a good solution.
> >
> > On Mon, Feb 22, 2010 at 6:41 PM, Ted Dunning <te...@gmail.com>
> > wrote:
> >
> > > It might help if you changed the id number on the argument when you
> > change
> > > the semantics.  That will let your applications fail in cases like
> this.
> > >
> > > On Mon, Feb 22, 2010 at 10:17 AM, Noam Wolf <no...@gmail.com>
> wrote:
> > >
> > > > Basically my service call changed from
> > > >
> > > > doSomething(1: String request)
> > > >
> > > > to
> > > >
> > > > doSomething(1: Request request)
> > > >
> > > > So when I was calling doSomething("foo") i was seeing that error
> > because
> > > > the
> > > > type i was passing to the service was not the correct type...
> > > >
> > > > hopefully this will help someone some day...
> > > >
> > >
> > >
> > >
> > > --
> > > Ted Dunning, CTO
> > > DeepDyve
> > >
> >
> >
> >
> > --
> > Best Regards,
> > Noam Wolf
> >
>
>
>
> --
> Ted Dunning, CTO
> DeepDyve
>



-- 
Best Regards,
Noam Wolf

Re: Bad type in structure

Posted by Ted Dunning <te...@gmail.com>.
Actually it is a VERY good solution.  That you can (and should) do this is a
major feature of Thrift which allows some level of future proofing of the
interface.

Read the original thrift paper.  You should never re-use an index for a
different purpose if there is any chance at all that old/new clients will
interact with new/old servers (i.e. anywhere in the known universe).

On Mon, Feb 22, 2010 at 10:54 AM, Noam Wolf <no...@gmail.com> wrote:

> it was my understanding that the id's were a unique, sequential, index... i
> guess it makes sense that they don't need to be sequential but if I don't
> have control over the server this might not be a good solution.
>
> On Mon, Feb 22, 2010 at 6:41 PM, Ted Dunning <te...@gmail.com>
> wrote:
>
> > It might help if you changed the id number on the argument when you
> change
> > the semantics.  That will let your applications fail in cases like this.
> >
> > On Mon, Feb 22, 2010 at 10:17 AM, Noam Wolf <no...@gmail.com> wrote:
> >
> > > Basically my service call changed from
> > >
> > > doSomething(1: String request)
> > >
> > > to
> > >
> > > doSomething(1: Request request)
> > >
> > > So when I was calling doSomething("foo") i was seeing that error
> because
> > > the
> > > type i was passing to the service was not the correct type...
> > >
> > > hopefully this will help someone some day...
> > >
> >
> >
> >
> > --
> > Ted Dunning, CTO
> > DeepDyve
> >
>
>
>
> --
> Best Regards,
> Noam Wolf
>



-- 
Ted Dunning, CTO
DeepDyve

Re: Bad type in structure

Posted by Noam Wolf <no...@gmail.com>.
it was my understanding that the id's were a unique, sequential, index... i
guess it makes sense that they don't need to be sequential but if I don't
have control over the server this might not be a good solution.

On Mon, Feb 22, 2010 at 6:41 PM, Ted Dunning <te...@gmail.com> wrote:

> It might help if you changed the id number on the argument when you change
> the semantics.  That will let your applications fail in cases like this.
>
> On Mon, Feb 22, 2010 at 10:17 AM, Noam Wolf <no...@gmail.com> wrote:
>
> > Basically my service call changed from
> >
> > doSomething(1: String request)
> >
> > to
> >
> > doSomething(1: Request request)
> >
> > So when I was calling doSomething("foo") i was seeing that error because
> > the
> > type i was passing to the service was not the correct type...
> >
> > hopefully this will help someone some day...
> >
>
>
>
> --
> Ted Dunning, CTO
> DeepDyve
>



-- 
Best Regards,
Noam Wolf

Re: Bad type in structure

Posted by Ted Dunning <te...@gmail.com>.
It might help if you changed the id number on the argument when you change
the semantics.  That will let your applications fail in cases like this.

On Mon, Feb 22, 2010 at 10:17 AM, Noam Wolf <no...@gmail.com> wrote:

> Basically my service call changed from
>
> doSomething(1: String request)
>
> to
>
> doSomething(1: Request request)
>
> So when I was calling doSomething("foo") i was seeing that error because
> the
> type i was passing to the service was not the correct type...
>
> hopefully this will help someone some day...
>



-- 
Ted Dunning, CTO
DeepDyve

Re: Bad type in structure

Posted by Noam Wolf <no...@gmail.com>.
Thanks for the ping Bryan, I actually figure it out... the stack trace
wasn't very forth coming in that the error could have been better IMO.

The error was a pretty stupid one that could have been, IMO, caught and
handled better... of course my client is a php one so there is no
compilation on that end which would have picked up on my error in any other
compiled language.

Basically my service call changed from

doSomething(1: String request)

to

doSomething(1: Request request)

So when I was calling doSomething("foo") i was seeing that error because the
type i was passing to the service was not the correct type...

hopefully this will help someone some day...

On Mon, Feb 22, 2010 at 6:10 PM, Bryan Duxbury <br...@rapleaf.com> wrote:

> Can you tell us what languages you are using on the client and server? Is
> there a relevant stack trace?
> -Bryan
>
> On Mon, Feb 22, 2010 at 6:25 AM, Noam Wolf <no...@gmail.com> wrote:
>
> > I'm seeing this error for the first time.  Looking at where the error is
> > thrown it looks like maybe the object that is returned from the rpc is
> not
> > the expected one.... is that true? what does this mean if both the server
> > and client are using the same .thrift file?
> >
> > --
> > Best Regards,
> > Noam Wolf
> >
>



-- 
Best Regards,
Noam Wolf

Re: Bad type in structure

Posted by Bryan Duxbury <br...@rapleaf.com>.
Can you tell us what languages you are using on the client and server? Is
there a relevant stack trace?
-Bryan

On Mon, Feb 22, 2010 at 6:25 AM, Noam Wolf <no...@gmail.com> wrote:

> I'm seeing this error for the first time.  Looking at where the error is
> thrown it looks like maybe the object that is returned from the rpc is not
> the expected one.... is that true? what does this mean if both the server
> and client are using the same .thrift file?
>
> --
> Best Regards,
> Noam Wolf
>