Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers,server: Cap data read for a seg #1827

Merged
merged 5 commits into from
Apr 9, 2021
Merged

drivers,server: Cap data read for a seg #1827

merged 5 commits into from
Apr 9, 2021

Conversation

jailuthra
Copy link
Contributor

@jailuthra jailuthra commented Apr 4, 2021

What does this pull request do? Explain your changes. (required)

Cap the data read for a segment to prevent bad segments eating up a lot of memory.

Specific updates (required)

see the commit history

Currently the max segment size is set to ~300MB (at 8000kbps using the current max duration of 5minutes)

How did you test each of these updates (required)

  • Manually tested on a local B/OT setup with a smaller limit set (2MB) and a bigger segment (2.4MB). The segment data read was being capped at the defined size.

With Limit Set:
B: I0404 22:11:10.044429 2542338 broadcast.go:372] Processing segment nonce=17696729379380681746 manifestID=test seqNo=1 dur=2 bytes=2097152
OT: [h264 @ 0x7f810403d640] error while decoding MB 60 59, bytestream -12
Transcoded Rendition Duration: 1.23 s

Without Limit Set:
B: I0404 22:12:42.698367 2543964 broadcast.go:372] Processing segment nonce=13032173926343571666 manifestID=test seqNo=1 dur=2 bytes=2405084
OT: No error
Transcoded Rendition Duration: 2.7 s

  1. Added unit tests for Push API and B<->O serve segment in 9d23156

Does this pull request close any open issues?

Fixes #1523

Checklist:

common/util.go Outdated Show resolved Hide resolved
server/mediaserver.go Outdated Show resolved Hide resolved
common/util.go Outdated Show resolved Hide resolved
Copy link
Member

@yondonfu yondonfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the update to start returning an error if the byte limit is exceeded while reading a request body, let's make sure to test for that error. I recommend small unit test cases as those should make it easy to construct request bodies that exceed the byte limit.

common/util.go Outdated Show resolved Hide resolved
@iameli
Copy link
Member

iameli commented Apr 5, 2021

@yondonfu @jailuthra @darkdarkdragon I feel medium-strongly this should be a configurable parameter with a default value, perhaps -httpIngestMaxSize=20MiB or some such. Could use https://github.com/c2h5oh/datasize to make it easy to parse various sizes?

Just feels like the kind of thing I'd like the ability to do in a production setting to unbreak an integration that's ever-so-slightly over the limit.

@darkdarkdragon
Copy link
Contributor

@iameli we also using this size on the O side. If we make this configurable then we should put this value in discovery protocol so O will clearly advertise its limits - or else B can get unexpected errors.

@jailuthra
Copy link
Contributor Author

@iameli If we go with the bigger hardcoded limit of 5minutes as proposed by @yondonfu above, would we still need to increase it anytime soon-ish in a prod environment?

This can avoid changes on discovery side (for now), and I am definitely in for iterating over this in future!

@iameli
Copy link
Member

iameli commented Apr 5, 2021

Sure, that's reasonable.

Copy link
Member

@yondonfu yondonfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some small tests for the new limiting behavior?

common/util.go Outdated Show resolved Hide resolved
common/util.go Outdated Show resolved Hide resolved
common/util.go Show resolved Hide resolved
@yondonfu
Copy link
Member

yondonfu commented Apr 8, 2021

Latest changes look good to go for me pending the tests for the byte reading limiting behavior.

@jailuthra
Copy link
Contributor Author

jailuthra commented Apr 9, 2021

Latest changes look good to go for me pending the tests for the byte reading limiting behavior.

Added a couple of tests in 9d23156, rebased the PR and added a changelog entry.

Also created a fork debt issue for making the max segment size configurable.

Copy link
Member

@yondonfu yondonfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jailuthra jailuthra dismissed darkdarkdragon’s stale review April 9, 2021 18:25

Fixed the comments, and got another approval too.

@jailuthra jailuthra merged commit 3610c2e into master Apr 9, 2021
@jailuthra jailuthra deleted the jai/seg-read-cap branch April 9, 2021 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cap data read in HandlePush handler
4 participants