mesos-cli icon indicating copy to clipboard operation
mesos-cli copied to clipboard

Read doesn't follow properly

Open travisgroth opened this issue 8 years ago • 0 comments

When following a file that does not update very frequently, the offset is continually increased even when it exceeds the total file size and no data is returned. Seems like there's just a missing check to see if the offset should actually be incremented.

Here is the request stream while following a file:

POST /api/v1 HTTP/1.1
Host: mesos004.mydomain.com:5051
User-Agent: Go-http-client/1.1
Content-Length: 305
Accept: application/json
Content-Type: application/json
Accept-Encoding: gzip

{"type":"READ_FILE","read_file":{"path":"/tmp/mesos/slaves/5c20127b-be6b-4682-90a1-409c52467e38-S4/frameworks/f0c21eef-5260-477f-b07e-9beb4f91d30d-0000/executors/myapp-server_v3.3.6.57c5af05-2456-11e7-b7fd-005056a22c7d/runs/ddb83975-7302-4ddc-be65-f85d2c36a093/stdout","offset":82001127706,"length":50000}}
HTTP/1.1 200 OK
Date: Tue, 02 May 2017 19:45:08 GMT
Content-Type: application/json
Content-Length: 60

{"read_file":{"data":"","size":54350073},"type":"READ_FILE"}POST /api/v1 HTTP/1.1
Host: mesos004.mydomain.com:5051
User-Agent: Go-http-client/1.1
Content-Length: 305
Accept: application/json
Content-Type: application/json
Accept-Encoding: gzip

{"type":"READ_FILE","read_file":{"path":"/tmp/mesos/slaves/5c20127b-be6b-4682-90a1-409c52467e38-S4/frameworks/f0c21eef-5260-477f-b07e-9beb4f91d30d-0000/executors/myapp-server_v3.3.6.57c5af05-2456-11e7-b7fd-005056a22c7d/runs/ddb83975-7302-4ddc-be65-f85d2c36a093/stdout","offset":82055477779,"length":50000}}
HTTP/1.1 200 OK
Date: Tue, 02 May 2017 19:45:08 GMT
Content-Type: application/json
Content-Length: 60

{"read_file":{"data":"","size":54350266},"type":"READ_FILE"}POST /api/v1 HTTP/1.1
Host: mesos004.mydomain.com:5051
User-Agent: Go-http-client/1.1
Content-Length: 305
Accept: application/json
Content-Type: application/json
Accept-Encoding: gzip

{"type":"READ_FILE","read_file":{"path":"/tmp/mesos/slaves/5c20127b-be6b-4682-90a1-409c52467e38-S4/frameworks/f0c21eef-5260-477f-b07e-9beb4f91d30d-0000/executors/myapp-server_v3.3.6.57c5af05-2456-11e7-b7fd-005056a22c7d/runs/ddb83975-7302-4ddc-be65-f85d2c36a093/stdout","offset":82109828045,"length":50000}}
HTTP/1.1 200 OK
Date: Tue, 02 May 2017 19:45:08 GMT
Content-Type: application/json
Content-Length: 60

{"read_file":{"data":"","size":54350266},"type":"READ_FILE"}POST /api/v1 HTTP/1.1
Host: mesos004.mydomain.com:5051
User-Agent: Go-http-client/1.1
Content-Length: 305
Accept: application/json
Content-Type: application/json
Accept-Encoding: gzip

{"type":"READ_FILE","read_file":{"path":"/tmp/mesos/slaves/5c20127b-be6b-4682-90a1-409c52467e38-S4/frameworks/f0c21eef-5260-477f-b07e-9beb4f91d30d-0000/executors/myapp-server_v3.3.6.57c5af05-2456-11e7-b7fd-005056a22c7d/runs/ddb83975-7302-4ddc-be65-f85d2c36a093/stdout","offset":82164178311,"length":50000}}
HTTP/1.1 200 OK
Date: Tue, 02 May 2017 19:45:09 GMT
Content-Type: application/json
Content-Length: 60

{"read_file":{"data":"","size":54350266},"type":"READ_FILE"}

travisgroth avatar May 02 '17 19:05 travisgroth