-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Option unwrap() on None when using AsyncWriteExt #6933
Comments
Towards the end of my process_chunk() logic (this is the second of the two tokio::spawn()'s that I mentioned), I write to the shared filehandle that is guarded by a mutex, via another tokio::spawn thread. Adding this and I see ~25% performance boost, and it seems to work just fine because all of the data is processed, but this is when I begin to see these unwrap() on None errors at process shutdown. If I remove this third tokio::spawn(), I take a slight performance hit but it doesn't seem to be causing any unwrap() on None issues anymore. |
This is happening during runtime shutdown? |
I don't know if there is an official time for "runtime shutdown" but yes, it happens at the very end of my code after all of the data has been processed. I get like, 8 or 16 or whatever the number of threads is saying Option unwrap() on None panic |
I am updating the comment. I believe the second Code is more or less:
Inside |
Runtime shutdown starts once you return from the Are you able to share a small complete example that triggers the error so I can try it myself? |
Version
1.41.0 and 1.40.0
Platform
Linux rddlr 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 GNU/Linux
Description
I am writing async code in which I am passing around a lazy_static!'ed
Arc<Option<File>>
. I am a new Rust developer so maybe some of what I am doing is incorrect, but this issue always happens at the end of the runtime of my code. My code does a lot of async HTTP requests (each of which is tokio::spawn()'ed and then each return value is worked on via a second set of tokio::spawn() threads. This is all done via astream::iter(chunks).map(|| { ... }).buffer_unordered(N).for_each(|res| async { ... }).await
, where chunks is a collection of Strings.I have attached the full backtrace here:
The text was updated successfully, but these errors were encountered: