Closed agarwal closed 7 years ago
That definitely looks like a bug, we'll look into it.
I'm seeing a very similar error if I write an empty string to stdout or stderr.
open Async.Std
let () =
print_string "";
Core.Std.never_returns (Scheduler.go ())
((exn
("writer error"
((src/monitor.ml.Error_
((exn (Unix.Unix_error "Invalid argument" writev ""))
(backtrace
("Raised by primitive operation at file \"src/writer0.ml\", line 410, characters 38-55"
"Called from file \"src/job_queue.ml\", line 164, characters 6-47"
""))
...
It looks like this happens because Bigstring.writev
blows up when called with empty input. Not sure if that case should be guarded here or in Bigstring itself.
I can't manage to reproduce any of these errors, what version of async_unix are you using?
I'm using 113.00.00 on OS X. (I tried to test out 113.24.00 but was hitting some compilation issues.)
OK, I can reproduce this as well on OSX. I initially read the error wrong, I didn't notice it was the system call that returned EINVAL
directly. Reading the OSX man page for writev it's indeed the case that you can't call writev with 0 iovectors. I'll try to get a fix for next release
Great! Happy to submit a PR if that would be helpful.
I understand this is fixed in more recent versions.
I tried creating an empty file using
Writer.save
, but it fails. I can work around it by using any of several other methods, but curious whysave
doesn't work with emptycontents
. Is it intentional or is this a bug?