thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chet Murthy <murthy.c...@gmail.com>
Subject Re: Crazy TBinaryProtocol
Date Fri, 12 Jan 2018 17:00:55 GMT
Andre',

OK, let's go with C++.  Can you write a C++ program that demarshals the
flat string you showed us, intro an object and prints the object out (to
verify that it's correctly demarshalled)?  A standalone C++ program?  Then
a standalone Python program that does the same thing, and fails (of
course).  This would be a working testcase, that we could use to diagnose
your prroblem.

--chet--


On Fri, Jan 12, 2018 at 6:05 AM, André Lemos <alemos@plux.info> wrote:

> Hi,
>
>
> 1) Not quite sure which language generates the message, but I'm thinking
> possibly C++. Not Python, for sure. I do not have access to the source
> file, although I do have access to examples in C++ and C# for consumers,
> that do work.
>
> 2) You mean the .thrift file?
>
>
>
> Thank you!
>
>
> On Thu, Jan 11, 2018 at 8:42 PM, Chet Murthy <murthy.chet@gmail.com>
> wrote:
>
> > Andre',
> >
> > (1) The message is generated in which language?  Python?
> >
> > (2) Can you supply the IDL for the message payload and message itself?
> >
> > On Thu, Jan 11, 2018 at 10:35 AM, André Lemos <alemos@plux.info> wrote:
> >
> > > On Thu, Jan 11, 2018 at 5:32 PM, Kevin Clark <kevin.clark@gmail.com>
> > > wrote:
> > >
> > > > On Thu, Jan 11, 2018 at 8:41 AM André Lemos <alemos@plux.info>
> wrote:
> > > >
> > > > > On Thu, Jan 11, 2018 at 4:34 PM, Kevin Clark <
> kevin.clark@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > On Thu, Jan 11, 2018 at 8:19 AM André Lemos <alemos@plux.info>
> > > wrote:
> > > > > >
> > > > > > > On Thu, Jan 11, 2018 at 4:13 PM, Kevin Clark <
> > > kevin.clark@gmail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > On Thu, Jan 11, 2018 at 7:40 AM André Lemos <
> alemos@plux.info>
> > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > When parsing through a TBinaryProtocol, trying
to get the
> > > > > > > > readMessageBegin,
> > > > > > > > > readI32, returns 16777216, which will raise an
EOFError,
> > > because
> > > > > it's
> > > > > > > > just
> > > > > > > > > a too big of a value. If I use something like
25, I do get
> > > > > something
> > > > > > > > pretty
> > > > > > > > > closer to what I am trying to get, although I
still get the
> > > > initial
> > > > > > bit
> > > > > > > > of
> > > > > > > > > the protocol, and not just the name I am trying
to get.
> > > > > > > > >
> > > > > > > > > Any hints as to where I should be looking?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Providing the language of the lib you’re using,
the code, and
> > the
> > > > > > message
> > > > > > > > you expect to be on the wire would make it easier
for someone
> > to
> > > > help
> > > > > > > you.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > I am using Python 2, I've sent the code. The message I
am
> trying
> > to
> > > > > > parse,
> > > > > > > looks like this:
> > > > > > >
> > > > > > >
> > > > > > > \x01\x00\x00\x00\xed\x00\x00\x00\x80\x01\x00\x04\x00\x00\
> > > > > > x00\x15RequestProcessListing\x00\x00\x00\x00\x0c\x00\x01\
> > > > > > x0b\x00\x01\x00\x00\x00\x10\xfe\x8e\xc3F\xed\\\x8aG\x97+\
> > > > > > x0cp\x0eY\x05U\x0b\x00\x02\x00\x00\x00\x0fThe
> > > > > > > Observer XT\x08\x00\x03\x00\x00\x00\
> x02\x0b\x00\x04\x00\x00\x00\
> > > > x12The
> > > > > > > Observer XT
> > > > > > >
> > > > > > > 14\x0b\x00\x05\x00\x00\x00\x08LEMOS-PC\x0b\x00\x06\x00\
> > > > > > x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
> > > > > > x00\x00\x00\x00\x00\x0c\x00\x07\x08\x00\x01\x00\x00\x00\
> > > > > > x01\x0c\x00\x02\x0c\x00\x01\x0b\x00\x01\x00\x00\x00\x00\
> > > > > > x08\x00\x02\x00\x00\x00\x00\x0f\x00\x03\x0c\x00\x00\x00\
> > > > > > x00\x0f\x00\x04\x0c\x00\x00\x00\x00\x00\x00\x0c\x00\x03\
> > > > > > x02\x00\x01\x01\x02\x00\x02\x01\x0b\x00\x03\x00\x00\x00\
> > > > > > x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
> > > > > > x00\x00\x00\x00\x00\x00\x00
> > > > > >
> > > > > >
> > > > > > Well the number you’ve pasted looks like it’s 1 <<
24, so it
> should
> > > fit
> > > > > in
> > > > > > a 32 bit int just fine. I’m not seeing actual code anywhere,
just
> > > > > > descriptions of method calls. I suspect this is a simple
> oversight
> > > but
> > > > > it’s
> > > > > > hard to tell you more without the actual code and the precise
> error
> > > > > > message.
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > here's the code (Python 2):
> > > > >
> > > > >     trans1 = TTransport.TMemoryBuffer()
> > > > >     trans1.open()
> > > > >     trans = TTransport.TMemoryBuffer(body)
> > > > >     trans.open()
> > > > >     iprot = TBinaryProtocol.TBinaryProtocol(trans)
> > > > >     oprot = TBinaryProtocol.TBinaryProtocol(trans1,
> > strictWrite=False)
> > > > >     tr = Processor(CommonService.CommonService.Iface())
> > > > >     tr.process(iprot, oprot)
> > > > >
> > > > >
> > > > > issue is that readI32() gets me a EOFError as it tries to read way
> > past
> > > > the
> > > > > full message.
> > > >
> > > >
> > > > Ah! Issue looks like it’s youre using strictWrite=False in one of the
> > > > protocols. That’s going to skip writing the version which the read
> side
> > > is
> > > > looking for. Been too long since I touched the code to remember the
> > > > intended purpose of those args, but that should at least tell you why
> > > it’s
> > > > blowing up - it expects more data because a 32 bit version should be
> > > there
> > > > in the header.
> > > >
> > > > Hope that helps.
> > >
> > >
> > >
> > > Still the same problem...
> > >
> > >
> > >   File "thrift/protocol/TBinaryProtocol.py", line 153, in
> > readMessageBegin
> > >     name = self.trans.readAll(sz)
> > >   File "thrift/transport/TTransport.py", line 65, in readAll
> > >     raise EOFError()
> > > EOFError
> > >
> > >
> > >
> > > :\
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message