-
-
Notifications
You must be signed in to change notification settings - Fork 754
Open
Description
MessagePack 3.1.4, targeting .NET 8.
I'm seeing a deadlock for a quite simple client/server solution. Basically it goes like this:
- Client writes message X (112 bytes):
SerializeAsync - Client reads (waits) for message Y (response to X):
DeserializeAsync - Server reads message X (112 bytes):
DeserializeAsync- blocks in second call in while loop. See below!
So the server never exits the read call, not allowing it to write an answer to the client. While debugging, I identified the cause of this. See this line in MessagePackSerializer.DeserializeAsync:
| while (bytesRead > 0); |
There, the server has read 112 bytes but the loop takes it back to the stream.ReadAsync() call where it blocks.
Bug or not?
Is this expected behavior? I asked it to deserialize a message, and it got all bytes needed for it. What am I missing here?
The message sent (112 bytes written and 112 bytes read)
[MessagePackObject]
[Union(0, typeof(HelloMessage))]
// Additional unions...
public abstract class PipeMessage
{
[Key(0)]
public required Guid Id { get; init; }
}
[MessagePackObject]
public sealed class HelloMessage : PipeMessage
{
[Key(1)]
public required Guid SessionId { get; init; }
[Key(2)]
public required string Secret { get; init; }
[Key(3)]
public required int ProtocolVersion { get; init; }
}Metadata
Metadata
Assignees
Labels
No labels