Memory leaks when using a socket identity greater than 29 characters

Description

I detected a small memory leak (76 bytes) when a socket identity is greater than 29 chars on a DEALER socket. I was unable to reproduce this leak on a small test case. The leak only appears on my integration tests using my implemented version of a async majordomo server ( DEALER <--> ROUTER ). This is the stack trace using Visual Leak Detector Win64 with "19d773fe-5f0e-41b4-91c4-747a863d 6f92" as the socket identity :

WARNING: Visual Leak Detector detected memory leaks!
---------- Block 2988 at 0x0000000000497E60: 76 bytes ----------
Call Stack:
c:\users\benoit\git\analyze\zeromq-3.0.2\src\msg.cpp (62): libzmq.dll!zmq::msg_t::init_size + 0x12 bytes
c:\users\benoit\git\analyze\zeromq-3.0.2\src\decoder.cpp (76): libzmq.dll!zmq::decoder_t::one_byte_size_ready + 0x24 bytes
c:\users\benoit\git\analyze\zeromq-3.0.2\src\decoder.hpp (122): libzmq.dll!zmq::decoder_base_t<zmq::decoder_t>:face with tonguerocess_buffer + 0x28 bytes
c:\users\benoit\git\analyze\zeromq-3.0.2\src\zmq_engine.cpp (126): libzmq.dll!zmq::zmq_engine_t::in_event + 0x23 bytes
c:\users\benoit\git\analyze\zeromq-3.0.2\src\select.cpp (191): libzmq.dll!zmq::select_t::loop
c:\users\benoit\git\analyze\zeromq-3.0.2\src\select.cpp (205): libzmq.dll!zmq::select_t::worker_routine
c:\users\benoit\git\analyze\zeromq-3.0.2\src\thread.cpp (33): libzmq.dll!thread_routine
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c (314): MSVCR100D.dll!_callthreadstartex + 0x17 bytes
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\threadex.c (297): MSVCR100D.dll!_threadstartex
0x000000007711652D (File and line number not available): kernel32.dll!BaseThreadInitThunk + 0xD bytes
0x000000007734C521 (File and line number not available): ntdll.dll!RtlUserThreadStart + 0x21 bytes
Data:
88 7E 49 00 00 00 00 00 24 00 00 00 00 00 00 00 .~I..... $.......
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ........ ........
00 00 00 00 CD CD CD CD 31 39 64 37 37 33 66 65 ........ 19d773fe
2D 35 66 30 65 2D 34 31 62 34 2D 39 31 63 34 2D 5f0e-41 b4-91c4
37 34 37 61 38 36 33 64 36 66 39 32 747a863d 6f92....
---------------------------------------------------------------------------------------------------------------------------------------------------------

Environment

Win64, 0MQ 3.0.2

Activity

Show:

PieterP November 16, 2011 at 9:17 PM

Benoit, can you retest 3-0 master and if OK, close this issue? Thanks.

PieterP November 16, 2011 at 9:17 PM

OK, patch applied to 3-0 and pushed to master.

Martin Sustrik November 1, 2011 at 5:54 PM

The code in question doesn't exist in the trunk, thus there'll be no downstream patch. The two lines have to be added directly to 3.0 repo.

Benoit Laplante November 1, 2011 at 5:47 PM
Edited

Martin suggests to add these two lines at zmq_init.cpp:114:
msg_->close();
msg_->init ();

All my tests successfully pass with those changes.

Fixed

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created November 1, 2011 at 5:45 PM
Updated August 29, 2013 at 4:19 PM
Resolved November 16, 2011 at 9:17 PM