From bbf5df7532abf9d418e0f804ec5cca0be6dcaefb Mon Sep 17 00:00:00 2001 From: Josh Allmann Date: Sat, 21 Mar 2015 19:22:46 -0700 Subject: [PATCH] Lwt_unix_io: Split large reads. With the Lwt backend, reads hang if trying to fetch more than Sys.max_string_length due to a byte allocation failure in Lwt_io.read. Problematic for large uploads, etc. Upper layer callers (eg, Transfer_io) seem to handle recombining these split reads without any issues. --- lwt/cohttp_lwt_unix_io.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/lwt/cohttp_lwt_unix_io.ml b/lwt/cohttp_lwt_unix_io.ml index 4a57b07b86..711ec40624 100644 --- a/lwt/cohttp_lwt_unix_io.ml +++ b/lwt/cohttp_lwt_unix_io.ml @@ -37,6 +37,7 @@ let read_line ic = Lwt_io.read_line_opt ic let read ic count = + let count = min count Sys.max_string_length in if !CD.debug_active then (lwt buf = try_lwt Lwt_io.read ~count ic