marimo
marimo copied to clipboard
Large file uploads fail silently.
Describe the bug
Uploading a large file using mo.ui.file() fails silently. While rejecting large files is probably necessary, it would be useful to be able to configure the size of acceptable files, and in any case, the user should be shown a meaningful error message.
To recreate: create test files like so:
truncate -s 50m 50m.file
truncate -s 75m 75m.file
Run the notebook below:
marimo -d edit file_bug.py
Uploading the 50MB file succeeds - though as expected there is an error tying to display the contents of so large a file.
Uploading the 75MB file fails silently as far as the user can see. There is an error shown in the browser console:
POST http://localhost:2718/api/kernel/set_ui_element_value/ net::ERR_CONNECTION_RESET 400 (Bad Request)
index-MSmAPe8D.js:40 Error requesting /api/kernel/set_ui_element_value/ Error: Bad Request
at index-MSmAPe8D.js:71:11234
And on the server side we see:
[I 240119 10:42:51 http1connection:292] Malformed HTTP message from ::1: Content-Length too long
This looks like an error message from Tornado.
Environment
{
"marimo": "0.1.78",
"OS": "Darwin",
"OS Version": "23.2.0",
"Processor": "arm",
"Python Version": "3.12.1",
"Binaries": {
"Chrome": "120.0.6099.234",
"Node": "v14.17.6"
},
"Requirements": {
"black": "23.12.1",
"click": "8.1.7",
"jedi": "0.19.1",
"pymdown-extensions": "10.7",
"tomlkit": "0.12.3",
"tornado": "6.4"
}
}
Code to reproduce
import marimo
__generated_with = "0.1.78"
app = marimo.App()
@app.cell
def __(mo):
upfile = mo.ui.file()
upfile
return upfile,
@app.cell
def __(upfile, mo):
mo.md(f"{upfile.value=!r}")
return
@app.cell
def __():
import marimo as mo
return mo
if __name__ == "__main__":
app.run()