[zeromq-dev] ZMQ 4.2.0 stack overflow on Windows

Robin Scher robin at uberware.net
Wed Nov 30 20:37:09 CET 2016


For testing purposes, no I am creating the context, creating the socket and binding the socket from a single thread (the main thread). There are other threads in my process, but none that interact with the ZeroMQ objects. I have not build a minimal sample to reproduce yet. Once this is resolved, my original code does pass the socket between threads, using a mutex to ensure that it is only accessed from a single thread, but I am not using that at the moment for testing.

The crash happens just after the main thread calls zmq_bind. There are no other uses of the socket object, for testing purposes, once it gets bound, the main thread just goes into an infinite loop that does nothing at all. No other thread is using any part of zmq for any purpose, and no other process is running that is trying to connect to this open socket or send any data to it. 

Thanks for any other help anyone can provide. 
-robin

Robin Scher  |  +1 (213) 448-0443  |  robin at uberware.net  |  www.uberware.net

-----Original Message-----
From: zeromq-dev [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Luca Boccassi
Sent: Wednesday, November 30, 2016 3:42 AM
To: ZeroMQ development list <zeromq-dev at lists.zeromq.org>
Subject: Re: [zeromq-dev] ZMQ 4.2.0 stack overflow on Windows

When you refer to main thread, are you by any chance creating a socket in a thread and using it from another?

On Tue, 2016-11-29 at 13:54 -0800, Robin Scher wrote:
> I am trying to update from 4.1.x to 4.2.0 for my project, and when I 
> run it linked to the 4.2.0 library, I get a stack overflow in a ZeroMQ 
> background thread when I bind a socket:
> 
>  
> 
> MyProgram.exe!__chkstk() Line 117
> 
> MyProgram.exe!std::map<unsigned
> short,zmq::select_t::family_entry_t,std::less<unsigned
> short>,std::allocator<std::pair<unsigned short const
> ,zmq::select_t::family_entry_t> > >::operator[](const unsigned short &
> _Keyval) Line 191
> 
> MyProgram.exe!zmq::select_t::add_fd(unsigned __int64 fd_, 
> zmq::i_poll_events
> * events_) Line 77
> 
> MyProgram.exe!zmq::socket_base_t::start_reaping(zmq::select_t * 
> poller_) Line 1312
> 
> MyProgram.exe!zmq::reaper_t::process_reap(zmq::socket_base_t * 
> socket_) Line
> 128
> 
> MyProgram.exe!zmq::object_t::process_command(zmq::command_t & cmd_) 
> Line 135
> 
> MyProgram.exe!zmq::reaper_t::in_event() Line 98
> 
> MyProgram.exe!zmq::select_t::loop() Line 318
> 
> MyProgram.exe!zmq::select_t::worker_routine(void * arg_) Line 393
> 
> MyProgram.exe!thread_routine(void * arg_) Line 47
> 
> msvcr110d.dll!_callthreadstartex() Line 354
> 
> msvcr110d.dll!_threadstartex(void * ptd) Line 337
> 
> kernel32.dll!00007ffd243013d2()               Unknown
> 
> ntdll.dll!00007ffd246054e4()       Unknown
> 
>  
> 
> The executable has done nothing but create the context, create the 
> socket, set a few socket options, and then calls zmq_bind on it. The 
> issue does not happen in the main thread, and the main thread does not 
> report any errors or have any faults. No other client is running on 
> this or any networked machine that is trying to connect to the process yet.
> 
>  
> 
> I am using MSVC 2012. Stack size is at the default.
> 
>  
> 
> Any ideas of where I can look to resolve this? I would like to use the 
> current version of the library, if possible. Thank you,
> 
> -robin
> 
>  
> 
> Robin Scher  |  +1 (213) 448-0443  |   <mailto:robin at uberware.net>
> robin at uberware.net  |   <http://www.uberware.net/> www.uberware.net
> 
>  
> 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev






More information about the zeromq-dev mailing list