zeromq / netmq

A 100% native C# implementation of ZeroMQ for .NET
Other
2.97k stars 744 forks source link

MQ Client fails at sending #1100

Open LexaGV opened 3 months ago

LexaGV commented 3 months ago

Environment

NetMQ Version: latest at 6 Aug (probably 4.0.0.0 as *.csproj says). Built from sources for .NET FW 4.8 Operating System: Win7 x64 SP1 .NET Version: Framework 4.8

Sample

Sample is taken from "HelloWorld" of the author:

var client = new RequestSocket("tcp://localhost:5556");
client.SendFrame("123");

After SendFrame is executed, clumsy dialog with "Assert" appears (which says me literally nothing what and where is wrong). In V2Encoder.cs I replaced line 38 (with assertion) to this:

if (m_inProgress.UnsafeData == null) throw new Exception("m_inProgress.UnsafeData is NULL!");

...and only then I could catch in VS debugger where problem happens (client or server) and what's going on + stack: m_inProgress.UnsafeData really was null, but... WHY??

NetMQ.dll!NetMQ.Core.Transports.V2Encoder.SizeReady() Line 38   C#
NetMQ.dll!NetMQ.Core.Transports.V2Encoder.Next() Line 27    C#
NetMQ.dll!NetMQ.Core.Transports.EncoderBase.Encode(ref NetMQ.Core.Transports.ByteArraySegment data, int size) Line 103  C#
NetMQ.dll!NetMQ.Core.Transports.StreamEngine.BeginSending() Line 451    C#
NetMQ.dll!NetMQ.Core.Transports.StreamEngine.Handle(NetMQ.Core.Transports.StreamEngine.Action action, System.Net.Sockets.SocketError socketError, int bytesTransferred) Line 424    C#
NetMQ.dll!NetMQ.Core.Transports.StreamEngine.FeedAction(NetMQ.Core.Transports.StreamEngine.Action action, System.Net.Sockets.SocketError socketError, int bytesTransferred) Line 333    C#
NetMQ.dll!NetMQ.Core.Transports.StreamEngine.ActivateOut() Line 1028    C#
NetMQ.dll!NetMQ.Core.SessionBase.ReadActivated(NetMQ.Core.Pipe pipe) Line 337   C#
NetMQ.dll!NetMQ.Core.Pipe.ProcessActivateRead() Line 391    C#
NetMQ.dll!NetMQ.Core.ZObject.ProcessCommand(NetMQ.Core.Command cmd) Line 268    C#
NetMQ.dll!NetMQ.Core.IOThread.Ready() Line 95   C#
NetMQ.dll!NetMQ.Core.IOThreadMailbox.RaiseEvent() Line 102  C#
NetMQ.dll!NetMQ.Core.Utils.Proactor.Loop() Line 110 C#

It's elementary program, which must work w/o any efforts! In reality I cannot send even "123". I repeat: code is taken from author sample, so it should be verified 100%.