[
https://issues.apache.org/jira/browse/MESOS-5060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15245232#comment-15245232
]
zhou xing edited comment on MESOS-5060 at 4/18/16 7:16 AM:
-----------------------------------------------------------
Hi [~greggomann], I took a look at the code today and based on your
suggestions, I'm thinking whether we can change the logic as the followings:
* for {{length}}:
(1). if user provides a non-negative number, then keep current code logic,
set {{length=min(length, pageSize*16)}}
(2). if user provides a negative number, set {{length=pageSize * 1}}. Log a
warning message on this.
(3). if user does not provide this argument, I tend to think that this means
user wants to view the content after {{offset}}, which means {{length=min(size
- offset, pageSize * 16)}}. Log a message on this.
* for {{offset}}:
(1). if user provides a non-negative number, then keep current code logic,
set the offset as what user provides.
(2). if user provides a negative number, then set {{offset=size}} (note that,
now, if user gives a negative offset in the argument, it will lead to a reading
file failure error). Log a warning message for this.
(3). if user does not provide this argument, I tend to think this means user
wants to view the whole file, set {{offset=0}}. Log a message for this.
If you think the above logic is ok, then I'll submit a patch on this. Thanks
for your time on reviewing this!
was (Author: dongdong):
Hi Greg, I took a look at the code today and based on your suggestions, I'm
thinking whether we can change the logic as the followings:
* for {{length}}:
(1). if user provides a non-negative number, then keep current code logic,
set {{length=min(length, pageSize*16)}}
(2). if user provides a negative number, set {{length=pageSize * 1}}. Log a
warning message on this.
(3). if user does not provide this argument, I tend to think that this means
user wants to view the content after {{offset}}, which means {{length=min(size
- offset, pageSize * 16)}}. Log a message on this.
* for {{offset}}:
(1). if user provides a non-negative number, then keep current code logic,
set the offset as what user provides.
(2). if user provides a negative number, then set {{offset=size}} (note that,
now, if user gives a negative offset in the argument, it will lead to a reading
file failure error). Log a warning message for this.
(3). if user does not provide this argument, I tend to think this means user
wants to view the whole file, set {{offset=0}}. Log a message for this.
If you think the above logic is ok, then I'll submit a patch on this. Thanks
for your time on reviewing this!
> Requesting /files/read.json with a negative length value causes subsequent
> /files requests to 404.
> --------------------------------------------------------------------------------------------------
>
> Key: MESOS-5060
> URL: https://issues.apache.org/jira/browse/MESOS-5060
> Project: Mesos
> Issue Type: Bug
> Affects Versions: 0.23.0
> Environment: Mesos 0.23.0 on CentOS 6, also Mesos 0.28.0 on OSX
> Reporter: Tom Petr
> Assignee: zhou xing
> Priority: Minor
> Fix For: 0.29.0
>
>
> I accidentally hit a slave's /files/read.json endpoint with a negative length
> (ex. http://hostname:5051/files/read.json?path=XXX&offset=0&length=-100). The
> HTTP request timed out after 30 seconds with nothing relevant in the slave
> logs, and subsequent calls to any of the /files endpoints on that slave
> immediately returned a HTTP 404 response. We ultimately got things working
> again by restarting the mesos-slave process (checkpointing FTW!), but it'd be
> wise to guard against negative lengths on the slave's end too.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)