You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Tom Runyon (JIRA)" <ji...@apache.org> on 2017/06/30 02:55:00 UTC
[jira] [Created] (MESOS-7745) ReadFile protobuf doesn't match
implementation
Tom Runyon created MESOS-7745:
---------------------------------
Summary: ReadFile protobuf doesn't match implementation
Key: MESOS-7745
URL: https://issues.apache.org/jira/browse/MESOS-7745
Project: Mesos
Issue Type: Bug
Components: HTTP API
Affects Versions: 1.3.0, 1.2.1, 1.2.0, 1.1.2, 1.1.1, 1.1.0
Reporter: Tom Runyon
ReadFile message in `include/mesos/v1/agent/agent.proto` and `include/mesos/v1/master/master.proto` is defined as
{code}
// Reads data from a file.
message ReadFile {
// The path of file.
required string path = 1;
// Initial offset in file to start reading from.
required uint64 offset = 2;
// The maximum number of bytes to read. The read length is capped at 16
// memory pages.
optional uint64 length = 3;
}
{code}
According to the protobuf spec ( https://developers.google.com/protocol-buffers/docs/proto3#json) the values for Offset and Length will serialize with quotations around the values.
Generating structs (Go Code below) follows the spec defined by protobuf
{code}
// Reads data from a file.
type Call_ReadFile struct {
// The path of file.
Path *string `protobuf:"bytes,1,req,name=path" json:"path,omitempty"`
// Initial offset in file to start reading from.
Offset *uint64 `protobuf:"varint,2,req,name=offset" json:"offset,omitempty"`
// The maximum number of bytes to read. The read length is capped at 16
// memory pages.
Length *uint64 `protobuf:"varint,3,opt,name=length" json:"length,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Call_ReadFile) Reset() { *m = Call_ReadFile{} }
func (m *Call_ReadFile) String() string { return proto.CompactTextString(m) }
func (*Call_ReadFile) ProtoMessage() {}
func (*Call_ReadFile) Descriptor() ([]byte, []int) { return fileDescriptorAgent, []int{0, 3} }
func (m *Call_ReadFile) GetPath() string {
if m != nil && m.Path != nil {
return *m.Path
}
return ""
}
func (m *Call_ReadFile) GetOffset() uint64 {
if m != nil && m.Offset != nil {
return *m.Offset
}
return 0
}
func (m *Call_ReadFile) GetLength() uint64 {
if m != nil && m.Length != nil {
return *m.Length
}
return 0
}
{code}
and causes serializations that contain "s. For example, this JSON value was created by serializing the struct above:
{code}
{
"type":"READ_FILE",
"read_file":
{
"path":"/cloud/mesos/slaves/9136e188-546b-428c-8cba-6cc1651990ba-S16/frameworks/b2c38250-a9b2-436d-81f8-c5a6aa5d0b56-0004/executors/trunyon_database.c71c1faf-5d2d-11e7-8a4a-2e27076f4d30/runs/c8d6200d-74f3-4229-928c-6381092b8778/stdout",
"offset":"0",
"length":"10000"
}
}
{code}
Sending this object to the `/api/v1` endpoint returns a 400 error code, where eliminating the quotes returns a 200
It looks like the issue came about between 1.0.X and 1.1.X where the protobuf changed from `string` objects to `uint64`.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)