-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack overflow #12
Comments
Ignore the previous comment if you saw it. Initially thought this could be a stdlib/rustc issue since the overflow was occurring between async function calls, only on Windows (couldn't reproduce on MacOS), and only in debug mode. Whilst it may still be, at least part of the cause seems to be the buffer size chosen for part of the reading. It was 64kb, which doesn't seem insane to me but apparently is too much in debug mode.. I guess? At least a short term solution is to reduce it down to 16kb I guess, but that does also impact perf. |
I'll look into the specifics of this in the future but I've gone and reduced it. Should be fixed in version |
That sounds like a silly issue. Why would a read buffer of 64kb be too big in debug mode? I'll test moving my code into main for you and get back. Obviously more performance is better. |
FYI @Majored, works fine with just |
Understand that, but that buffer is only ~6% of that stack size on Windows. There really shouldn't be too much else on the stack so the fact that the size is ballooning in debug mode is still just weird to me - along with the fact that removing that single indirection of the print_p4k_contents() fn is the difference between overflowing and not. I feel like there's something else going on there but honestly, could be completely wrong. I'll leave it as is now with the reduced size. Want to keep everything stack-allocated where it can be. |
Ok, just wanted to give you the info I found. I forgot to mention in the previous comment: They also said the compiler may be helpfully optimizing out the stack requirement when it's in main, and just skipping it entirely. |
Ah, that makes a lot more sense then. Thanks :) |
Hello, I'm trying to use your lib for the first time and just using the basic examples in your docs for reading. I'm getting:
The zip file was created by 7zip for windows and is attached.
test.zip
How can I get this working?
main.rs
lib.rs
It crashes at line
let mut zip = ZipFileReader::new(&mut file).await?;
.The text was updated successfully, but these errors were encountered: