Skip to content

libgreen/rustuv cant write huge files #13130

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
tfogal opened this issue Mar 25, 2014 · 1 comment · Fixed by #13133
Closed

libgreen/rustuv cant write huge files #13130

tfogal opened this issue Mar 25, 2014 · 1 comment · Fixed by #13133

Comments

@tfogal
Copy link

tfogal commented Mar 25, 2014

It seems libgreen cannot write large files. See the gist at:

https://gist.github.com/tfogal/9762303#file-simple-rs

See specifically the 'dumpf32' implementation.

When running with rust from 2014-03-21 (2014032104056eae7dfsaucy) on Ubuntu, the output file in this example is only 2147479552 bytes, whereas it should be exactly 4000000000 bytes.

This was fixed on 2014-03-25 in 2014032104056eae7dfsaucy. However, one can induce failure by forcing libgreen, via:

extern crate green;
extern crate rustuv;
...
#[start]
fn start(argc: int, argv: **u8) -> int { green::start(argc, argv, main) }

The 'rustuv' is critical to prevent an early crash calling "Result::unwrap() on an Err value, but it limits the output file size as above.

From talking with @huonw and @eddyb on IRC, this appears to be an issue with libuv. eddyb pinpointed it to:

https://github.com/mozilla/rust/blob/master/src/librustuv/uvll.rs#L371-L384

the issue appears to be a mismatch in the type given and taken to/by libuv.

@eddyb pinged the libuv folks, who said this aspect has recently changed and Rust should upgrade before working around the current code. uv_fs_write apparently takes an array of buffers now, in particular.

@tfogal
Copy link
Author

tfogal commented Mar 25, 2014

This is likely joyent/libuv#1215.

bors added a commit that referenced this issue Mar 26, 2014
The libuv fs wrappers are very thin wrappers around the syscalls they correspond
to, and a notable worrisome case is the write syscall. This syscall is not
guaranteed to write the entire buffer provided, so we may have to continue
calling uv_fs_write if a short write occurs.

Closes #13130
dingxiangfei2009 pushed a commit to dingxiangfei2009/rust that referenced this issue Jul 28, 2024
Avoid ref when using format!

Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing).

Inlining format args prevents accidental `&` misuse.

See also rust-lang#112156

changelog: none
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant