I'm testing an API that takes a multipart/form-dat...
# ktor
r
I'm testing an API that takes a multipart/form-data file upload which works fine with Ktor for happy paths. In an environment where the maximum JVM heap size is 128MB though, if I try to upload a 40MB file it crashes with an Out of Heap exception without ever reaching even the first line of my code. In other words, it breaks in Ktor code. Is Ktor attempting to read the entire file into memory for each request? My intent was to just read up to X MB and then throw an exception if that upper limit is passed.
For further context, this is a development environment, I'm aware that 128MB of heap is too low for JVM apps. But this issue would happen anyway given a big enough file for whatever is defined as the heap.
a
Well it depends right? Maybe the X MB is more than 40MB but less then in a “normal” JVM heap configuration
a
Can you share the code snippet used to receive the file and the full stack trace of the exception?