Re: Using CopyingOutputStreamAdaptor and CodedOutputStream

2009-06-29 Thread Kenton Varda
No, that doesn't make sense.
I need to see the exact code, from the point where the CodedOutputStream is
constructed until it is destroyed.

On Mon, Jun 29, 2009 at 5:35 PM, Kenton Varda  wrote:

> Odd.  By any chance, does this only happen when writing a zero-length
> message?
>
>
> On Mon, Jun 29, 2009 at 5:22 PM, Alex Black  wrote:
>
>>  Error:
>>
>> libprotobuf FATAL ..\src\google\protobuf\io\zero_copy_stream_impl.cc:377]
>> CHECK
>> failed: buffer_used_ == buffer_size_:  BackUp() can only be called after
>> Next().
>>
>> Stack trace:
>>
>>   msvcr90d.dll!_NMSG_WRITE(int rterrnum=10)  Line 198 C
>>   msvcr90d.dll!abort()  Line 68 C
>>   GraphPerf.exe!google::protobuf::internal::LogMessage::Finish()  Line
>> 173 C++
>>   
>> GraphPerf.exe!google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage
>> & other={...})  Line 177 C++
>>   GraphPerf.exe!google::protobuf::io::CopyingOutputStreamAdaptor::BackUp(int
>> count=2202)  Line 378 + 0xa0 bytes C++
>>   GraphPerf.exe!google::protobuf::io::CodedOutputStream::~CodedOutputStream()
>> Line 526 C++
>>   GraphPerf.exe!ProtoBufStreamAdaptor::~ProtoBufStreamAdaptor()  Line 10 +
>> 0x59 bytes C++
>>
>>  --
>> *From:* Kenton Varda [mailto:ken...@google.com]
>> *Sent:* Monday, June 29, 2009 7:08 PM
>> *To:* Alex Black
>> *Cc:* Protocol Buffers
>> *Subject:* Re: Using CopyingOutputStreamAdaptor and CodedOutputStream
>>
>>
>>
>> On Sun, Jun 28, 2009 at 7:30 AM, Alex Black  wrote:
>>
>>>
>>> Hi, I'm trying to use these to serialize messages to my own stream.
>>>
>>> I have a couple of questions:
>>>
>>> 1. If I use message.SerializeToCodedStream() do I still need to write
>>> the size of the message to the stream on my own first?
>>
>>
>> Yes.
>>
>>
>>> 2. My new code looks like this:
>>>
>>> MyStream myStream; // this implements CopyingOutputStream
>>> CopyingOutputStreamAdaptor protoBufStream(&myStream);
>>> CodedOutputStream codedOutputStream(&protoBufStream);
>>>
>>> Then I write messages like this:
>>>
>>> message.SerializeToCodedStream(&codedOutputStream);
>>>
>>> When the CodedOutputStream's destructor gets called, my program aborts
>>> hard.. Looks like there is still 5192 bytes in its buffer, and I think
>>> I need to call Flush() on it, but there is no flush?
>>
>>
>> What is the error message?  Stack trace?
>>
>>
>>>
>>>
>>> thx
>>>
>>> - Alex
>>>
>>>
>>> >>>
>>>
>>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



Re: Using CopyingOutputStreamAdaptor and CodedOutputStream

2009-06-29 Thread Kenton Varda
Odd.  By any chance, does this only happen when writing a zero-length
message?

On Mon, Jun 29, 2009 at 5:22 PM, Alex Black  wrote:

>  Error:
>
> libprotobuf FATAL ..\src\google\protobuf\io\zero_copy_stream_impl.cc:377]
> CHECK
> failed: buffer_used_ == buffer_size_:  BackUp() can only be called after
> Next().
>
> Stack trace:
>
>   msvcr90d.dll!_NMSG_WRITE(int rterrnum=10)  Line 198 C
>   msvcr90d.dll!abort()  Line 68 C
>   GraphPerf.exe!google::protobuf::internal::LogMessage::Finish()  Line
> 173 C++
>   
> GraphPerf.exe!google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage
> & other={...})  Line 177 C++
>   GraphPerf.exe!google::protobuf::io::CopyingOutputStreamAdaptor::BackUp(int
> count=2202)  Line 378 + 0xa0 bytes C++
>   GraphPerf.exe!google::protobuf::io::CodedOutputStream::~CodedOutputStream()
> Line 526 C++
>   GraphPerf.exe!ProtoBufStreamAdaptor::~ProtoBufStreamAdaptor()  Line 10 +
> 0x59 bytes C++
>
>  --
> *From:* Kenton Varda [mailto:ken...@google.com]
> *Sent:* Monday, June 29, 2009 7:08 PM
> *To:* Alex Black
> *Cc:* Protocol Buffers
> *Subject:* Re: Using CopyingOutputStreamAdaptor and CodedOutputStream
>
>
>
> On Sun, Jun 28, 2009 at 7:30 AM, Alex Black  wrote:
>
>>
>> Hi, I'm trying to use these to serialize messages to my own stream.
>>
>> I have a couple of questions:
>>
>> 1. If I use message.SerializeToCodedStream() do I still need to write
>> the size of the message to the stream on my own first?
>
>
> Yes.
>
>
>> 2. My new code looks like this:
>>
>> MyStream myStream; // this implements CopyingOutputStream
>> CopyingOutputStreamAdaptor protoBufStream(&myStream);
>> CodedOutputStream codedOutputStream(&protoBufStream);
>>
>> Then I write messages like this:
>>
>> message.SerializeToCodedStream(&codedOutputStream);
>>
>> When the CodedOutputStream's destructor gets called, my program aborts
>> hard.. Looks like there is still 5192 bytes in its buffer, and I think
>> I need to call Flush() on it, but there is no flush?
>
>
> What is the error message?  Stack trace?
>
>
>>
>>
>> thx
>>
>> - Alex
>>
>>
>> >>
>>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



RE: Using CopyingOutputStreamAdaptor and CodedOutputStream

2009-06-29 Thread Alex Black
Error:
 
libprotobuf FATAL
..\src\google\protobuf\io\zero_copy_stream_impl.cc:377] CHECK
failed: buffer_used_ == buffer_size_:  BackUp() can only be called after
Next().
 
Stack trace:
 
  msvcr90d.dll!_NMSG_WRITE(int rterrnum=10)  Line 198 C
  msvcr90d.dll!abort()  Line 68 C
  GraphPerf.exe!google::protobuf::internal::LogMessage::Finish()  Line
173 C++
 
GraphPerf.exe!google::protobuf::internal::LogFinisher::operator=(google:
:protobuf::internal::LogMessage & other={...})  Line 177 C++
 
GraphPerf.exe!google::protobuf::io::CopyingOutputStreamAdaptor::BackUp(i
nt count=2202)  Line 378 + 0xa0 bytes C++
 
GraphPerf.exe!google::protobuf::io::CodedOutputStream::~CodedOutputStrea
m()  Line 526 C++
  GraphPerf.exe!ProtoBufStreamAdaptor::~ProtoBufStreamAdaptor()  Line 10
+ 0x59 bytes C++




From: Kenton Varda [mailto:ken...@google.com] 
Sent: Monday, June 29, 2009 7:08 PM
To: Alex Black
Cc: Protocol Buffers
Subject: Re: Using CopyingOutputStreamAdaptor and CodedOutputStream





On Sun, Jun 28, 2009 at 7:30 AM, Alex Black  wrote:



Hi, I'm trying to use these to serialize messages to my own
stream.

I have a couple of questions:

1. If I use message.SerializeToCodedStream() do I still need to
write
the size of the message to the stream on my own first?


Yes.
 

2. My new code looks like this:

MyStream myStream; // this implements CopyingOutputStream
CopyingOutputStreamAdaptor protoBufStream(&myStream);
CodedOutputStream codedOutputStream(&protoBufStream);

Then I write messages like this:

message.SerializeToCodedStream(&codedOutputStream);

When the CodedOutputStream's destructor gets called, my program
aborts
hard.. Looks like there is still 5192 bytes in its buffer, and I
think
I need to call Flush() on it, but there is no flush?


What is the error message?  Stack trace?
 



thx

- Alex







--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



Re: Using CopyingOutputStreamAdaptor and CodedOutputStream

2009-06-29 Thread Kenton Varda
On Sun, Jun 28, 2009 at 7:30 AM, Alex Black  wrote:

>
> Hi, I'm trying to use these to serialize messages to my own stream.
>
> I have a couple of questions:
>
> 1. If I use message.SerializeToCodedStream() do I still need to write
> the size of the message to the stream on my own first?


Yes.


> 2. My new code looks like this:
>
> MyStream myStream; // this implements CopyingOutputStream
> CopyingOutputStreamAdaptor protoBufStream(&myStream);
> CodedOutputStream codedOutputStream(&protoBufStream);
>
> Then I write messages like this:
>
> message.SerializeToCodedStream(&codedOutputStream);
>
> When the CodedOutputStream's destructor gets called, my program aborts
> hard.. Looks like there is still 5192 bytes in its buffer, and I think
> I need to call Flush() on it, but there is no flush?


What is the error message?  Stack trace?


>
>
> thx
>
> - Alex
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



Using CopyingOutputStreamAdaptor and CodedOutputStream

2009-06-28 Thread Alex Black

Hi, I'm trying to use these to serialize messages to my own stream.

I have a couple of questions:

1. If I use message.SerializeToCodedStream() do I still need to write
the size of the message to the stream on my own first?

Note, you can see the code I was previously using here:

http://groups.google.com/group/protobuf/browse_thread/thread/9c9b410549e7eefd/b1268daa2e989c88?lnk=gst&q=streaming#b1268daa2e989c88

2. My new code looks like this:

MyStream myStream; // this implements CopyingOutputStream
CopyingOutputStreamAdaptor protoBufStream(&myStream);
CodedOutputStream codedOutputStream(&protoBufStream);

Then I write messages like this:

message.SerializeToCodedStream(&codedOutputStream);

When the CodedOutputStream's destructor gets called, my program aborts
hard.. Looks like there is still 5192 bytes in its buffer, and I think
I need to call Flush() on it, but there is no flush?

thx

- Alex


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---