-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
[BUG]: Risk for deadlock when ParquetWriter is disposed? #479
Comments
Here are the changes I've done and will try out: |
Good point. It was created when |
@aloneguid Unfortunately this hasn't resolved our function timeouts completely, so at the very least this is not the only reason for them. Still, it would be nice to support
|
- Refactored ParquetWriter to implement IAsyncDisposable, added DisposeAsync and WriteMagicAsync methods, and refactored Dispose method. - Updated ParquetWriterTest.cs and ParquetSerializer.cs to use await using for async disposal. - Added WriteInt32Async method to StreamExtensions.cs. Added synchronous Write method to ThriftFooter.cs. Removed BinaryWriter field and property from ParquetActor.cs.
Released. |
Library Version
4.23.4
OS
Windows
OS Architecture
64 bit
How to reproduce?
This is not easy to reproduce because it depends on where the library is used, behaviour is different depending on if it's running e.g in a GUI app or ASP.NET. In my case it is used in an Azure Function app, and out of several thousand serializations per day the process hangs a few times.
ParquetWriter.Dispose() contains a synchronous wait on a task without
.ConfigureAwait(false)
. This is known to cause deadlocks and I suspect this is causing our function app to hang. More info on ConfigureAwait:https://devblogs.microsoft.com/dotnet/configureawait-faq/#why-would-i-want-to-use-configureawaitfalse
On the other hand it seems Task.Run() is also possible to use for avoiding deadlocks since it puts the work in a background thread:
https://devblogs.microsoft.com/dotnet/configureawait-faq/#can-i-use-task-run-to-avoid-using-configureawaitfalse
https://stackoverflow.com/a/28307965/114174
Here is when the synchronous wait was added:
1d1ced2#diff-67e525645019c5bdbfa30dd0862bf24bccea0d8d5bd4e95a37c06975d1d41e5eR145
Either way I'm not sure about this, I will change this to
IAsyncDisposable
in a local build instead and see if it resolves the hanging process on our end.Failing test
No response
The text was updated successfully, but these errors were encountered: