Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sagfault with p2p socket #18

Closed
zeromq opened this issue Apr 14, 2010 · 6 comments
Closed

sagfault with p2p socket #18

zeromq opened this issue Apr 14, 2010 · 6 comments

Comments

@zeromq
Copy link
Collaborator

zeromq commented Apr 14, 2010

include <zmq.h>

include <stdio.h>

include <stdlib.h>

int main (int argc, char *argv [])
{
const char *bind_to;
int message_count;
int message_size;
void *ctx;
void *s;
int rc;
int i;
zmq_msg_t msg;
void *watch;
unsigned long elapsed;
unsigned long throughput;
double megabits;

if (argc != 4) {
    printf ("usage: local_thr <bind-to> <message-size> <message-count>\n");
    return 1;
}
bind_to = argv [1];
message_size = atoi (argv [2]);
message_count = atoi (argv [3]);

ctx = zmq_init (1, 1, 0);
if (!ctx) {
    printf ("error in zmq_send: %s\n", zmq_strerror (errno));
    return -1;
}

s = zmq_socket (ctx, ZMQ_P2P);
if (!s) {
    printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
    return -1;
}

//rc = zmq_setsockopt (s, ZMQ_SUBSCRIBE , "", 0);
//if (rc != 0) {
//    printf ("error in zmq_setsockopt: %s\n", zmq_strerror (errno));
//    return -1;
//}

//  Add your socket options here.
//  For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.

rc = zmq_bind (s, bind_to);
if (rc != 0) {
    printf ("error in zmq_bind: %s\n", zmq_strerror (errno));
    return -1;
}

rc = zmq_msg_init (&msg);
if (rc != 0) {
    printf ("error in zmq_msg_init: %s\n", zmq_strerror (errno));
    return -1;
}

rc = zmq_recv (s, &msg, 0);
if (rc != 0) {
    printf ("error in zmq_recv: %s\n", zmq_strerror (errno));
    return -1;
}
if (zmq_msg_size (&msg) != message_size) {
    printf ("message of incorrect size received\n");
    return -1;
}

watch = zmq_stopwatch_start ();

for (i = 0; i != message_count - 1; i++) {
    rc = zmq_recv (s, &msg, 0);
    if (rc != 0) {
        printf ("error in zmq_recv: %s\n", zmq_strerror (errno));
        return -1;
    }
    if (zmq_msg_size (&msg) != message_size) {
        printf ("message of incorrect size received\n");
        return -1;
    }
}

elapsed = zmq_stopwatch_stop (watch);
if (elapsed == 0)
    elapsed = 1;

rc = zmq_msg_close (&msg);
if (rc != 0) {
    printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
    return -1;
}
//rc = zmq_msg_init_size(&msg, 2);
//rc = zmq_send(s, &msg, 0);
//rc = zmq_msg_close(&msg);

throughput = (unsigned long)
    ((double) message_count / (double) elapsed * 1000000);
megabits = (double) (throughput * message_size * 8) / 1000000;

printf ("message size: %d [B]\n", (int) message_size);
printf ("message count: %d\n", (int) message_count);
printf ("mean throughput: %d [msg/s]\n", (int) throughput);
printf ("mean throughput: %.3f [Mb/s]\n", (double) megabits);

rc = zmq_close (s);
if (rc != 0) {
    printf ("error in zmq_close: %s\n", zmq_strerror (errno));
    return -1;
}

rc = zmq_term (ctx);
if (rc != 0) {
    printf ("error in zmq_term: %s\n", zmq_strerror (errno));
    return -1;
}

return 0;

}

output:
(gdb) run
Starting program: /home/tcip/src/zeromq/foo/local_thr tcp://192.168.2.2:20000 1000000 100
[Thread debugging using libthread_db enabled]
[New Thread 0x7fefeca12750 (LWP 9184)]
[New Thread 0x7fefeb68d950 (LWP 9187)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fefeca12750 (LWP 9184)]
zmq_msg_close (msg_=0x7fffb76ff780) at zmq.cpp:168
168 if (content->ffn)
Current language: auto; currently c++
(gdb) bt
#0 zmq_msg_close (msg_=0x7fffb76ff780) at zmq.cpp:168
#1 0x00007fefec5e9fec in zmq::p2p_t::xrecv (this=0x1782fe0,

msg_=0x7fffb76ff780, flags_=0) at p2p.cpp:115

#2 0x00007fefec5f208f in zmq::socket_base_t::recv (this=0x1782fe0,

msg_=0x7fffb76ff780, flags_=0) at socket_base.cpp:393

#3 0x0000000000400dc7 in main ()

(gdb)

@sophacles
Copy link

I double checked this against a build from the latest trunk (above was against the 2.0.6 in Adrian's hg repo) and the backtrace becomes (note a couple of line number changes):

#0 zmq_msg_close (msg_=0x7fffe5061e10) at zmq.cpp:170
#1 0x00007f9afd1a0f4c in zmq::p2p_t::xrecv (this=0x20143f0,
msg_=0x7fffe5061e10, flags_=0) at p2p.cpp:115
#2 0x00007f9afd1a8ef9 in zmq::socket_base_t::recv (this=0x20143f0,
msg_=0x7fffe5061e10, flags_=0) at socket_base.cpp:442
#3 0x0000000000400dc7 in main ()

@zeromq
Copy link
Collaborator Author

zeromq commented Apr 15, 2010

I have run the remote_thr supplied and it simply stays still, waiting for messages. What do you use as the other peer?

@sophacles
Copy link

The orignially linked code is the local_thr code, this code below is the remote_thr code that causes local_thr to segfault (atho it is literally a s/ZMQ_SUB/ZMQ_P2P/):

#include "../include/zmq.h"
#include 
#include 

int main (int argc, char *argv [])
{
    const char *connect_to;
    int message_count;
    int message_size;
    void *ctx;
    void *s;
    int rc;
    int i;
    int stime;
    zmq_msg_t msg;

    if (argc != 5) {
        printf ("usage: remote_thr   "
            " \n");
        return 1;
    }
    connect_to = argv [1];
    message_size = atoi (argv [2]);
    message_count = atoi (argv [3]);
    stime = atoi (argv[4]);

    ctx = zmq_init (1, 1, 0);
    if (!ctx) {
        printf ("error in zmq_recv: %s\n", zmq_strerror (errno));
        return -1;
    }

    s = zmq_socket (ctx, ZMQ_P2P);
    if (!s) {
        printf ("error in zmq_socket: %s\n", zmq_strerror (errno));
        return -1;
    }

    //  Add your socket options here.
    //  For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.

    rc = zmq_connect (s, connect_to);
    if (rc != 0) {
        printf ("error in zmq_connect: %s\n", zmq_strerror (errno));
        return -1;
    }

    for (i = 0; i != message_count; i++) {
        rc = zmq_msg_init_size (&msg, message_size);
        if (rc != 0) {
            printf ("error in zmq_msg_init_size: %s\n", zmq_strerror (errno));
            return -1;
        }
        rc = zmq_send (s, &msg, 0);
        if (rc != 0) {
            printf ("error in zmq_send: %s\n", zmq_strerror (errno));
            return -1;
        }
        rc = zmq_msg_close (&msg);
        if (rc != 0) {
            printf ("error in zmq_msg_close: %s\n", zmq_strerror (errno));
            return -1;
        }
    }

    zmq_sleep (stime);

    rc = zmq_close (s);
    if (rc != 0) {
        printf ("error in zmq_close: %s\n", zmq_strerror (errno));
        return -1;
    }

    rc = zmq_term (ctx);
    if (rc != 0) {
        printf ("error in zmq_term: %s\n", zmq_strerror (errno));
        return -1;
    }

    return 0;
}

@sophacles
Copy link

Also, I did a fresh build of everything involved, there is still a segfault, but excitingly not every time. Sometimes everything works fine, and sometimes I get the following glibc backtrace:

*** glibc detected *** ./lthrp2p: double free or corruption (!prev): 0x0000000000614100 ***
======= Backtrace: =========
/lib/libc.so.6[0x2ac24a608d16]
/lib/libc.so.6(cfree+0x6c)[0x2ac24a60d9bc]
/usr/lib/libzmq.so.0(zmq_msg_close+0x2e)[0x2ac24a34e82e]
/usr/lib/libzmq.so.0(_ZN3zmq5p2p_t5xrecvEP9zmq_msg_ti+0x1c)[0x2ac24a34145c]
/usr/lib/libzmq.so.0(_ZN3zmq13socket_base_t4recvEP9zmq_msg_ti+0x86)[0x2ac24a348af6]
./lthrp2p[0x400dd1]
/lib/libc.so.6(__libc_start_main+0xfd)[0x2ac24a5b6abd]
./lthrp2p[0x400ad9]
======= Memory map: ========
00400000-00402000 r-xp 00000000 03:01 336666                             /home/tcip/src/zeromq/foo/lthrp2p
00601000-00602000 rw-p 00001000 03:01 336666                             /home/tcip/src/zeromq/foo/lthrp2p
00602000-00623000 rw-p 00602000 00:00 0                                  [heap]
2ac24a0f7000-2ac24a114000 r-xp 00000000 03:01 50190                      /lib/ld-2.10.2.so
2ac24a114000-2ac24a117000 rw-p 2ac24a114000 00:00 0 
2ac24a313000-2ac24a314000 r--p 0001c000 03:01 50190                      /lib/ld-2.10.2.so
2ac24a314000-2ac24a315000 rw-p 0001d000 03:01 50190                      /lib/ld-2.10.2.so
2ac24a315000-2ac24a394000 r-xp 00000000 03:01 24998                      /usr/lib/libzmq.so.0.0.0
2ac24a394000-2ac24a594000 ---p 0007f000 03:01 24998                      /usr/lib/libzmq.so.0.0.0
2ac24a594000-2ac24a598000 rw-p 0007f000 03:01 24998                      /usr/lib/libzmq.so.0.0.0
2ac24a598000-2ac24a6e2000 r-xp 00000000 03:01 50558                      /lib/libc-2.10.2.so
2ac24a6e2000-2ac24a8e2000 ---p 0014a000 03:01 50558                      /lib/libc-2.10.2.so
2ac24a8e2000-2ac24a8e6000 r--p 0014a000 03:01 50558                      /lib/libc-2.10.2.so
2ac24a8e6000-2ac24a8e7000 rw-p 0014e000 03:01 50558                      /lib/libc-2.10.2.so
2ac24a8e7000-2ac24a8ec000 rw-p 2ac24a8e7000 00:00 0 
2ac24a8ec000-2ac24a9de000 r-xp 00000000 03:01 24806                      /usr/lib/libstdc++.so.6.0.13
2ac24a9de000-2ac24abde000 ---p 000f2000 03:01 24806                      /usr/lib/libstdc++.so.6.0.13
2ac24abde000-2ac24abe5000 r--p 000f2000 03:01 24806                      /usr/lib/libstdc++.so.6.0.13
2ac24abe5000-2ac24abe7000 rw-p 000f9000 03:01 24806                      /usr/lib/libstdc++.so.6.0.13
2ac24abe7000-2ac24abfc000 rw-p 2ac24abe7000 00:00 0 
2ac24abfc000-2ac24ac00000 r-xp 00000000 03:01 25550                      /usr/lib/libgthread-2.0.so.0.2200.4
2ac24ac00000-2ac24adff000 ---p 00004000 03:01 25550                      /usr/lib/libgthread-2.0.so.0.2200.4
2ac24adff000-2ac24ae00000 rw-p 00003000 03:01 25550                      /usr/lib/libgthread-2.0.so.0.2200.4
2ac24ae00000-2ac24ae01000 rw-p 2ac24ae00000 00:00 0 
2ac24ae01000-2ac24ae08000 r-xp 00000000 03:01 50548                      /lib/librt-2.10.2.so
2ac24ae08000-2ac24b007000 ---p 00007000 03:01 50548                      /lib/librt-2.10.2.so
2ac24b007000-2ac24b008000 r--p 00006000 03:01 50548                      /lib/librt-2.10.2.so
2ac24b008000-2ac24b009000 rw-p 00007000 03:01 50548                      /lib/librt-2.10.2.so
2ac24b009000-2ac24b0ce000 r-xp 00000000 03:01 50573                      /lib/libglib-2.0.so.0.2200.4
2ac24b0ce000-2ac24b2cd000 ---p 000c5000 03:01 50573                      /lib/libglib-2.0.so.0.2200.4
2ac24b2cd000-2ac24b2cf000 rw-p 000c4000 03:01 50573                      /lib/libglib-2.0.so.0.2200.4
2ac24b2cf000-2ac24b2d2000 r-xp 00000000 03:01 49245                      /lib/libuuid.so.1.3.0
2ac24b2d2000-2ac24b4d2000 ---p 00003000 03:01 49245                      /lib/libuuid.so.1.3.0
2ac24b4d2000-2ac24b4d3000 rw-p 00003000 03:01 49245                      /lib/libuuid.so.1.3.0
2ac24b4d3000-2ac24b4d4000 rw-p 2ac24b4d3000 00:00 0 
2ac24b4d4000-2ac24b4ea000 r-xp 00000000 03:01 50563                      /lib/libpthread-2.10.2.so
2ac24b4ea000-2ac24b6ea000 ---p 00016000 03:01 50563                      /lib/libpthread-2.10.2.so
2ac24b6ea000-2ac24b6eb000 r--p 00016000 03:01 50563                      /lib/libpthread-2.10.2.so
2ac24b6eb000-2ac24b6ec000 rw-p 00017000 03:01 50563                      /lib/libpthread-2.10.2.so
2ac24bAborted

@zeromq
Copy link
Collaborator Author

zeromq commented May 11, 2010

The terminal zero of the string is not part of the message.

@sustrik
Copy link
Member

sustrik commented Sep 29, 2010

User error AFAIU. Closing the issue.

abaelhe added a commit to abaelhe/libzmq that referenced this issue Jul 17, 2022
Build all projects

** BUILD SUCCEEDED **

bash-3.2# cd  bin/Debug/
bash-3.2# for x in ./* ; do ./$x 1> /dev/null 2>/dev/null  || echo $x ; done
./test_bind_curve_fuzzer
./test_bind_fuzzer
./test_bind_null_fuzzer
./test_connect_curve_fuzzer
./test_connect_fuzzer
./test_connect_null_fuzzer
Segmentation fault: 11
./test_security_curve
./test_z85_decode_fuzzer
bash-3.2# ./test_bind_curve_fuzzer
bash-3.2# ./test_bind_curve_fuzzer
bash-3.2# ./test_bind_fuzzer 
bash-3.2# ./test_bind_null_fuzzer 
bash-3.2# ./test_connect_curve_fuzzer 
bash-3.2# ./test_connect_fuzzer 
bash-3.2# ./test_security_curve 
Segmentation fault: 11
bash-3.2# lldb ./test_security_curve 
(lldb) target create "./test_security_curve"
Current executable set to '/Users/abaelhe/Downloads/libzmq-master/build/bin/Debug/test_security_curve' (x86_64).
(lldb) r
Process 39009 launched: '/Users/abaelhe/Downloads/libzmq-master/build/bin/Debug/test_security_curve' (x86_64)
Process 39009 stopped
* thread zeromq#3, name = 'ZMQbg/IO/0', stop reason = signal SIGSEGV
    frame #0: 0x00007ff80f64f192 libsystem_kernel.dylib`__pthread_sigmask + 10
libsystem_kernel.dylib`__pthread_sigmask:
->  0x7ff80f64f192 <+10>: jae    0x7ff80f64f19c            ; <+20>
    0x7ff80f64f194 <+12>: movq   %rax, %rdi
    0x7ff80f64f197 <+15>: jmp    0x7ff80f64a1c5            ; cerror_nocancel
    0x7ff80f64f19c <+20>: retq   
Target 0: (test_security_curve) stopped.
(lldb) bt
warning: could not find Objective-C class data in the process. This may reduce the quality of type information available.
* thread zeromq#3, name = 'ZMQbg/IO/0', stop reason = signal SIGSEGV
  * frame #0: 0x00007ff80f64f192 libsystem_kernel.dylib`__pthread_sigmask + 10
    frame zeromq#1: 0x00007ff80f685acb libsystem_pthread.dylib`pthread_sigmask + 9
    frame zeromq#2: 0x00007ff80f5d1d19 libsystem_c.dylib`abort + 112
    frame zeromq#3: 0x0000000100333551 libsodium.23.dylib`_out_of_bounds.cold.1 + 17
    frame zeromq#4: 0x0000000100316229 libsodium.23.dylib`_out_of_bounds + 9
    frame zeromq#5: 0x0000000100316218 libsodium.23.dylib`sodium_free + 408
    frame zeromq#6: 0x00000001005a6d0d libzmq.5.dylib`zmq::secure_allocator_t<unsigned char>::deallocate(this=0x00007000014c6ce0, p="", (null)=96) at secure_allocator.hpp:63:56
    frame zeromq#7: 0x00000001005a6c25 libzmq.5.dylib`std::__1::allocator_traits<zmq::secure_allocator_t<unsigned char> >::deallocate(__a=0x00007000014c6ce0, __p="", __n=96) at allocator_traits.h:282:13
    frame zeromq#8: 0x00000001005a6484 libzmq.5.dylib`std::__1::__vector_base<unsigned char, zmq::secure_allocator_t<unsigned char> >::~__vector_base(this=0x00007000014c6cd0) at vector:488:9
    frame zeromq#9: 0x00000001005acae2 libzmq.5.dylib`std::__1::vector<unsigned char, zmq::secure_allocator_t<unsigned char> >::~vector(this=0x00007000014c6cd0 size=0) at vector:579:5
    frame zeromq#10: 0x00000001005ac165 libzmq.5.dylib`std::__1::vector<unsigned char, zmq::secure_allocator_t<unsigned char> >::~vector(this=0x00007000014c6cd0 size=0) at vector:574:5
    frame zeromq#11: 0x00000001005ab2e7 libzmq.5.dylib`zmq::curve_server_t::process_hello(this=0x000000010182c600, msg_=0x00006000037001e8) at curve_server.cpp:208:1
    frame zeromq#12: 0x00000001005aad30 libzmq.5.dylib`zmq::curve_server_t::process_handshake_command(this=0x000000010182c600, msg_=0x00006000037001e8) at curve_server.cpp:104:18
    frame zeromq#13: 0x000000010062ccd7 libzmq.5.dylib`zmq::stream_engine_base_t::process_handshake_command(this=0x000000010182d400, msg_=0x00006000037001e8) at stream_engine_base.cpp:491:32
    frame zeromq#14: 0x000000010062ba21 libzmq.5.dylib`zmq::stream_engine_base_t::in_event_internal(this=0x000000010182d400) at stream_engine_base.cpp:309:14
    frame zeromq#15: 0x000000010062b665 libzmq.5.dylib`zmq::stream_engine_base_t::in_event(this=0x000000010182d400) at stream_engine_base.cpp:243:22
    frame zeromq#16: 0x00000001005c0889 libzmq.5.dylib`zmq::kqueue_t::loop(this=0x00006000037000c0) at kqueue.cpp:218:30
    frame zeromq#17: 0x00000001005eefa9 libzmq.5.dylib`zmq::worker_poller_base_t::worker_routine(arg_=0x00006000037000c0) at poller_base.cpp:146:51
    frame zeromq#18: 0x0000000100637e66 libzmq.5.dylib`thread_routine(arg_=0x0000600003700100) at thread.cpp:256:5
    frame zeromq#19: 0x00007ff80f6864e1 libsystem_pthread.dylib`_pthread_start + 125
    frame zeromq#20: 0x00007ff80f681f6b libsystem_pthread.dylib`thread_start + 15
(lldb)
bluca pushed a commit to abaelhe/libzmq that referenced this issue Aug 10, 2022
…ntation

Build all projects

** BUILD SUCCEEDED **

bash-3.2# cd  bin/Debug/
bash-3.2# for x in ./* ; do ./$x 1> /dev/null 2>/dev/null  || echo $x ; done
./test_bind_curve_fuzzer
./test_bind_fuzzer
./test_bind_null_fuzzer
./test_connect_curve_fuzzer
./test_connect_fuzzer
./test_connect_null_fuzzer
Segmentation fault: 11
./test_security_curve
./test_z85_decode_fuzzer
bash-3.2# ./test_bind_curve_fuzzer
bash-3.2# ./test_bind_curve_fuzzer
bash-3.2# ./test_bind_fuzzer
bash-3.2# ./test_bind_null_fuzzer
bash-3.2# ./test_connect_curve_fuzzer
bash-3.2# ./test_connect_fuzzer
bash-3.2# ./test_security_curve
Segmentation fault: 11
bash-3.2# lldb ./test_security_curve
(lldb) target create "./test_security_curve"
Current executable set to '/Users/abaelhe/Downloads/libzmq-master/build/bin/Debug/test_security_curve' (x86_64).
(lldb) r
Process 39009 launched: '/Users/abaelhe/Downloads/libzmq-master/build/bin/Debug/test_security_curve' (x86_64)
Process 39009 stopped
* thread zeromq#3, name = 'ZMQbg/IO/0', stop reason = signal SIGSEGV
    frame #0: 0x00007ff80f64f192 libsystem_kernel.dylib`__pthread_sigmask + 10
libsystem_kernel.dylib`__pthread_sigmask:
->  0x7ff80f64f192 <+10>: jae    0x7ff80f64f19c            ; <+20>
    0x7ff80f64f194 <+12>: movq   %rax, %rdi
    0x7ff80f64f197 <+15>: jmp    0x7ff80f64a1c5            ; cerror_nocancel
    0x7ff80f64f19c <+20>: retq
Target 0: (test_security_curve) stopped.
(lldb) bt
warning: could not find Objective-C class data in the process. This may reduce the quality of type information available.
* thread zeromq#3, name = 'ZMQbg/IO/0', stop reason = signal SIGSEGV
  * frame #0: 0x00007ff80f64f192 libsystem_kernel.dylib`__pthread_sigmask + 10
    frame zeromq#1: 0x00007ff80f685acb libsystem_pthread.dylib`pthread_sigmask + 9
    frame zeromq#2: 0x00007ff80f5d1d19 libsystem_c.dylib`abort + 112
    frame zeromq#3: 0x0000000100333551 libsodium.23.dylib`_out_of_bounds.cold.1 + 17
    frame zeromq#4: 0x0000000100316229 libsodium.23.dylib`_out_of_bounds + 9
    frame zeromq#5: 0x0000000100316218 libsodium.23.dylib`sodium_free + 408
    frame zeromq#6: 0x00000001005a6d0d libzmq.5.dylib`zmq::secure_allocator_t<unsigned char>::deallocate(this=0x00007000014c6ce0, p="", (null)=96) at secure_allocator.hpp:63:56
    frame zeromq#7: 0x00000001005a6c25 libzmq.5.dylib`std::__1::allocator_traits<zmq::secure_allocator_t<unsigned char> >::deallocate(__a=0x00007000014c6ce0, __p="", __n=96) at allocator_traits.h:282:13
    frame zeromq#8: 0x00000001005a6484 libzmq.5.dylib`std::__1::__vector_base<unsigned char, zmq::secure_allocator_t<unsigned char> >::~__vector_base(this=0x00007000014c6cd0) at vector:488:9
    frame zeromq#9: 0x00000001005acae2 libzmq.5.dylib`std::__1::vector<unsigned char, zmq::secure_allocator_t<unsigned char> >::~vector(this=0x00007000014c6cd0 size=0) at vector:579:5
    frame zeromq#10: 0x00000001005ac165 libzmq.5.dylib`std::__1::vector<unsigned char, zmq::secure_allocator_t<unsigned char> >::~vector(this=0x00007000014c6cd0 size=0) at vector:574:5
    frame zeromq#11: 0x00000001005ab2e7 libzmq.5.dylib`zmq::curve_server_t::process_hello(this=0x000000010182c600, msg_=0x00006000037001e8) at curve_server.cpp:208:1
    frame zeromq#12: 0x00000001005aad30 libzmq.5.dylib`zmq::curve_server_t::process_handshake_command(this=0x000000010182c600, msg_=0x00006000037001e8) at curve_server.cpp:104:18
    frame zeromq#13: 0x000000010062ccd7 libzmq.5.dylib`zmq::stream_engine_base_t::process_handshake_command(this=0x000000010182d400, msg_=0x00006000037001e8) at stream_engine_base.cpp:491:32
    frame zeromq#14: 0x000000010062ba21 libzmq.5.dylib`zmq::stream_engine_base_t::in_event_internal(this=0x000000010182d400) at stream_engine_base.cpp:309:14
    frame zeromq#15: 0x000000010062b665 libzmq.5.dylib`zmq::stream_engine_base_t::in_event(this=0x000000010182d400) at stream_engine_base.cpp:243:22
    frame zeromq#16: 0x00000001005c0889 libzmq.5.dylib`zmq::kqueue_t::loop(this=0x00006000037000c0) at kqueue.cpp:218:30
    frame zeromq#17: 0x00000001005eefa9 libzmq.5.dylib`zmq::worker_poller_base_t::worker_routine(arg_=0x00006000037000c0) at poller_base.cpp:146:51
    frame zeromq#18: 0x0000000100637e66 libzmq.5.dylib`thread_routine(arg_=0x0000600003700100) at thread.cpp:256:5
    frame zeromq#19: 0x00007ff80f6864e1 libsystem_pthread.dylib`_pthread_start + 125
    frame zeromq#20: 0x00007ff80f681f6b libsystem_pthread.dylib`thread_start + 15
(lldb)
bluca pushed a commit that referenced this issue Aug 10, 2022
…ntation

Build all projects

** BUILD SUCCEEDED **

bash-3.2# cd  bin/Debug/
bash-3.2# for x in ./* ; do ./$x 1> /dev/null 2>/dev/null  || echo $x ; done
./test_bind_curve_fuzzer
./test_bind_fuzzer
./test_bind_null_fuzzer
./test_connect_curve_fuzzer
./test_connect_fuzzer
./test_connect_null_fuzzer
Segmentation fault: 11
./test_security_curve
./test_z85_decode_fuzzer
bash-3.2# ./test_bind_curve_fuzzer
bash-3.2# ./test_bind_curve_fuzzer
bash-3.2# ./test_bind_fuzzer
bash-3.2# ./test_bind_null_fuzzer
bash-3.2# ./test_connect_curve_fuzzer
bash-3.2# ./test_connect_fuzzer
bash-3.2# ./test_security_curve
Segmentation fault: 11
bash-3.2# lldb ./test_security_curve
(lldb) target create "./test_security_curve"
Current executable set to '/Users/abaelhe/Downloads/libzmq-master/build/bin/Debug/test_security_curve' (x86_64).
(lldb) r
Process 39009 launched: '/Users/abaelhe/Downloads/libzmq-master/build/bin/Debug/test_security_curve' (x86_64)
Process 39009 stopped
* thread #3, name = 'ZMQbg/IO/0', stop reason = signal SIGSEGV
    frame #0: 0x00007ff80f64f192 libsystem_kernel.dylib`__pthread_sigmask + 10
libsystem_kernel.dylib`__pthread_sigmask:
->  0x7ff80f64f192 <+10>: jae    0x7ff80f64f19c            ; <+20>
    0x7ff80f64f194 <+12>: movq   %rax, %rdi
    0x7ff80f64f197 <+15>: jmp    0x7ff80f64a1c5            ; cerror_nocancel
    0x7ff80f64f19c <+20>: retq
Target 0: (test_security_curve) stopped.
(lldb) bt
warning: could not find Objective-C class data in the process. This may reduce the quality of type information available.
* thread #3, name = 'ZMQbg/IO/0', stop reason = signal SIGSEGV
  * frame #0: 0x00007ff80f64f192 libsystem_kernel.dylib`__pthread_sigmask + 10
    frame #1: 0x00007ff80f685acb libsystem_pthread.dylib`pthread_sigmask + 9
    frame #2: 0x00007ff80f5d1d19 libsystem_c.dylib`abort + 112
    frame #3: 0x0000000100333551 libsodium.23.dylib`_out_of_bounds.cold.1 + 17
    frame #4: 0x0000000100316229 libsodium.23.dylib`_out_of_bounds + 9
    frame #5: 0x0000000100316218 libsodium.23.dylib`sodium_free + 408
    frame #6: 0x00000001005a6d0d libzmq.5.dylib`zmq::secure_allocator_t<unsigned char>::deallocate(this=0x00007000014c6ce0, p="", (null)=96) at secure_allocator.hpp:63:56
    frame #7: 0x00000001005a6c25 libzmq.5.dylib`std::__1::allocator_traits<zmq::secure_allocator_t<unsigned char> >::deallocate(__a=0x00007000014c6ce0, __p="", __n=96) at allocator_traits.h:282:13
    frame #8: 0x00000001005a6484 libzmq.5.dylib`std::__1::__vector_base<unsigned char, zmq::secure_allocator_t<unsigned char> >::~__vector_base(this=0x00007000014c6cd0) at vector:488:9
    frame #9: 0x00000001005acae2 libzmq.5.dylib`std::__1::vector<unsigned char, zmq::secure_allocator_t<unsigned char> >::~vector(this=0x00007000014c6cd0 size=0) at vector:579:5
    frame #10: 0x00000001005ac165 libzmq.5.dylib`std::__1::vector<unsigned char, zmq::secure_allocator_t<unsigned char> >::~vector(this=0x00007000014c6cd0 size=0) at vector:574:5
    frame #11: 0x00000001005ab2e7 libzmq.5.dylib`zmq::curve_server_t::process_hello(this=0x000000010182c600, msg_=0x00006000037001e8) at curve_server.cpp:208:1
    frame #12: 0x00000001005aad30 libzmq.5.dylib`zmq::curve_server_t::process_handshake_command(this=0x000000010182c600, msg_=0x00006000037001e8) at curve_server.cpp:104:18
    frame #13: 0x000000010062ccd7 libzmq.5.dylib`zmq::stream_engine_base_t::process_handshake_command(this=0x000000010182d400, msg_=0x00006000037001e8) at stream_engine_base.cpp:491:32
    frame #14: 0x000000010062ba21 libzmq.5.dylib`zmq::stream_engine_base_t::in_event_internal(this=0x000000010182d400) at stream_engine_base.cpp:309:14
    frame #15: 0x000000010062b665 libzmq.5.dylib`zmq::stream_engine_base_t::in_event(this=0x000000010182d400) at stream_engine_base.cpp:243:22
    frame #16: 0x00000001005c0889 libzmq.5.dylib`zmq::kqueue_t::loop(this=0x00006000037000c0) at kqueue.cpp:218:30
    frame #17: 0x00000001005eefa9 libzmq.5.dylib`zmq::worker_poller_base_t::worker_routine(arg_=0x00006000037000c0) at poller_base.cpp:146:51
    frame #18: 0x0000000100637e66 libzmq.5.dylib`thread_routine(arg_=0x0000600003700100) at thread.cpp:256:5
    frame #19: 0x00007ff80f6864e1 libsystem_pthread.dylib`_pthread_start + 125
    frame #20: 0x00007ff80f681f6b libsystem_pthread.dylib`thread_start + 15
(lldb)
benjdero pushed a commit to benjdero/libzmq that referenced this issue Feb 20, 2023
Various changes to ensure connection with peers are stable
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants