Skip to content

RequestSocket crash #1108

Open
Open
@cduret

Description

Environment

NetMQ Version:    4.0.1.13
Operating System:  WSL2 / Linux Debian
.NET Version:     dotnet sdk 8

I have a crash when using RequestSocket with a pyzmq Response server

server.py (pyzmq version 4.3.5)

import zmq

ctx = zmq.Context()
sock = ctx.socket(zmq.REP)
sock.bind('tcp://localhost:5554')
while True:
  message = sock.recv().decode()
  sock.send('hello {0} !'.format().encode())

client.cs

using System;
using NetMQ;
using NetMQ.Sockets;

namespace Test {
  class Program {
    private static void Main(string[] args) {
      using (var socket = new RequestSocket()) {
        socket.Connect("tcp://localhost:5554");
        socket.SendFrame("world");
        string res = socket.ReceiveFrameString();
        Console.WriteLine(res);
      }
    }
  }
}

Expected behaviour

Expect to have a response: "hello world !"

Actual behaviour

$ ./bin/Debug/net8.0/test 
Process terminated. Assertion failed.
Unexpected null of type Byte[]
   at NetMQ.Assumes.NotNull[T](T o) in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Utils/Assumes.cs:line 12
   at NetMQ.Core.Transports.V2Encoder.SizeReady() in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Transports/V2Encoder.cs:line 36
   at NetMQ.Core.Transports.V2Encoder.Next() in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Transports/V2Encoder.cs:line 25
   at NetMQ.Core.Transports.EncoderBase.Encode(ByteArraySegment& data, Int32 size) in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Transports/EncoderBase.cs:line 103
   at NetMQ.Core.Transports.StreamEngine.BeginSending() in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Transports/StreamEngine.cs:line 451
   at NetMQ.Core.Transports.StreamEngine.ProcessHandshakeCommand(Msg& msg) in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Transports/StreamEngine.cs:line 1186
   at NetMQ.Core.Transports.V2Decoder.PushMsg(ProcessMsgDelegate sink) in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Transports/V2Decoder.cs:line 133
   at NetMQ.Core.Transports.StreamEngine.ProcessInput() in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Transports/StreamEngine.cs:line 982
   at NetMQ.Core.Transports.StreamEngine.Handle(Action action, SocketError socketError, Int32 bytesTransferred) in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Transports/StreamEngine.cs:line 385
   at NetMQ.Core.Transports.StreamEngine.FeedAction(Action action, SocketError socketError, Int32 bytesTransferred) in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Transports/StreamEngine.cs:line 333
   at NetMQ.Core.Transports.StreamEngine.InCompleted(SocketError socketError, Int32 bytesTransferred) in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Transports/StreamEngine.cs:line 1008
   at NetMQ.Core.IOObject.InCompleted(SocketError socketError, Int32 bytesTransferred) in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/IOObject.cs:line 108
   at NetMQ.Core.Utils.Proactor.Loop() in /home/cydu/DEV/zmq/netmq-4.0.1.13/src/NetMQ/Core/Utils/Proactor.cs:line 123
Aborted (core dumped)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions