-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
bridge: re-introduce the max_read_size limit #21556
base: main
Are you sure you want to change the base?
Conversation
This is a regression from our port of the bridge from C to Python. The C bridge had a limit and as fsread1 is not blocking implemented this prevents issues of accidentally reading /dev/zero or /dev/sda which will fill up ram endlessly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, with test!
the revdeps failing is a legit issue (!)
Hurray for reverse dependency testing and suggesting to download big files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, yay for revdeps! Idea how to handle that.
|
||
logger.debug('Opening file "%s" for reading', path) | ||
|
||
try: | ||
with open(path, 'rb') as filep: | ||
buf = os.stat(filep.fileno()) | ||
if max_read_size is not None and buf.st_size > max_read_size: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, did the C bridge support any way of saying "indefinite"? Like "-1"? For download in files we have no way of limiting. But if we change files now to give -1, it will fail with the old bridge. So I think for the time being the only thing files can do is to set it to MAXINT64 for the time being. Then we add support for -1 here, and at some point we can change files accordingly. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The C bridge never did, we never had big download support until cockpit-files and as files started with only supporting the Python bridge this just "worked".
Cockpit only had:
pkg/sosreport/sosreport.jsx: max_read_size: 150 * 1024 * 1024,
Your proposal sounds good, it actually would unbreak our RHEL-8 testing was what I was thinking but it doesn't as we beiboot :-)
This is a regression from our port of the bridge from C to Python. The C bridge had a limit and as fsread1 is not blocking implemented this prevents issues of accidentally reading /dev/zero or /dev/sda which will fill up ram endlessly.
See 7c7ab45 and DEFAULT_MAX_READ_SIZE