[zeromq-dev] Assertion failed: input_stopped (..\..\..\..\src\stream_engine.cpp:444)

Jensen, Jesper jesper.klit.jensen at Honeywell.com
Thu Nov 16 00:58:57 CET 2017


Hi

I have this subscriber and under windows (only place tested) version 4.2.2 and running it from a command line only I get an exception:

                KernelBase.dll!7649c54f()            Unknown            No symbols loaded.
               [Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]                   Annotated Frame
               hwclient_wait.exe!zmq::zmq_abort() Line 83       C++        Symbols loaded.
>             hwclient_wait.exe!zmq::stream_engine_t::restart_input() Line 444           C++        Symbols loaded.
               hwclient_wait.exe!zmq::session_base_t::write_activated() Line 300          C++        Symbols loaded.
               hwclient_wait.exe!zmq::pipe_t::process_activate_write() Line 273            C++        Symbols loaded.
               hwclient_wait.exe!zmq::object_t::process_command() Line 82    C++        Symbols loaded.
               hwclient_wait.exe!zmq::io_thread_t::in_event() Line 86 C++        Symbols loaded.
               hwclient_wait.exe!zmq::select_t::loop() Line 317               C++        Symbols loaded.
               hwclient_wait.exe!zmq::select_t::worker_routine() Line 393         C++        Symbols loaded.
               hwclient_wait.exe!thread_routine() Line 46         C++        Symbols loaded.
               msvcr100d.dll!_callthreadstartex() Line 314          C             Symbols loaded.
               msvcr100d.dll!_threadstartex(void * ptd) Line 297             C             Symbols loaded.
               kernel32.dll!75f4336a() Unknown            No symbols loaded.
               ntdll.dll!770098f2()          Unknown            No symbols loaded.
               ntdll.dll!770098c5()          Unknown            No symbols loaded.

The exception happens here  src\stream_engine.cpp

void zmq::stream_engine_t::restart_input ()
{
    zmq_assert (input_stopped);

As far as I can see the other place that calls restart_input does a check if input_stopped is set to true but the zmq::session_base_t::write_activated don't. My question is should it? Or am I doing something wrong in the code below.


My test subscriber:

#define ZMQ_STATIC

#include <conio.h>
#include <stdlib.h>
#include <iostream>

#include <string.h>
#include <string>
#include <zmq.hpp>
#include <zmq_addon.hpp>
#include <string>

using namespace std;

#define CATCH_ERROR_T                              \
   catch (zmq::error_t &e)                         \
   {                                               \
      printf("Exception caught: %s", e.what());    \
   }

int main()
{
   //  Prepare our context and socket
   try
   {
      zmq::context_t context(1);

      zmq::socket_t socket(context, ZMQ_SUB);
      try
      {
         socket.setsockopt(ZMQ_SUBSCRIBE, "", 0);
      }
      CATCH_ERROR_T;

      try
      {
         int hwm = 10;
         socket.setsockopt(ZMQ_RCVHWM, &hwm, sizeof(hwm));
      }
      CATCH_ERROR_T;

      try
      {
         int no = 250;
         socket.setsockopt(ZMQ_HEARTBEAT_IVL, &no, sizeof(no));
      }
      CATCH_ERROR_T;

      try
      {
         int no = 500;
         socket.setsockopt(ZMQ_HEARTBEAT_TIMEOUT, &no, sizeof(no));
      }
      CATCH_ERROR_T;

      std::cout << "Connecting to pub server!" << std::endl;
      try
      {
         socket.connect("tcp://localhost:5555");
      }
      CATCH_ERROR_T;

      Sleep(1000);

      int seq = 0;
      int last = -1;
      for (;;) {
         //  Get the reply.
         zmq::multipart_t sub;
         try
         {
            sub.recv(socket);
         }
         CATCH_ERROR_T;

         if (sub.size() == 2)
         {
            string t(static_cast<char *>(sub.at(0).data()), sub.at(0).size());
            memcpy(&seq, sub.at(1).data(), sizeof(seq));
            ++last;
            if (last != seq)
            {
               std::cout << "Sequence error last " << last << " Sequence: " << seq << std::endl;
               last = seq;
            }
            if (!(seq % 100000))
            {
               std::cout << "Type: " << t << " Sequence: " << seq << std::endl;
            }
         }
         else
         {
            std::cout << "Invalid format!" << std::endl;
         }
      }
   }
   CATCH_ERROR_T;

   return 0;
}

Jesper K


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20171115/b1b0f278/attachment.htm>


More information about the zeromq-dev mailing list