nanomsg library

Welcome to nanomsg

Release MIT License Linux Status Windows Status Coverage Gitter

The nanomsg library is a simple high-performance implementation of several "scalability protocols". These scalability protocols are light-weight messaging protocols which can be used to solve a number of very common messaging patterns, such as request/reply, publish/subscribe, surveyor/respondent, and so forth. These protocols can run over a variety of transports such as TCP, UNIX sockets, and even WebSocket.

For more information check the website.

Prerequisites

  1. Windows.

    • Windows Vista or newer (Windows XP and 2003 are NOT supported)
    • Microsoft Visual Studio 2010 (including C++) or newer, or mingw-w64. (Specifically mingw and older Microsoft compilers are *NOT supported, and we do not test mingw-w64 at all, so YMMV.)
    • CMake 2.8.7 or newer, available in $PATH as cmake
  2. POSIX (Linux, MacOS X, UNIX)

    • ANSI C compiler supporting C89
    • POSIX pthreads (should be present on all modern POSIX systems)
    • BSD sockets support for both TCP and UNIX domain sockets
    • CMake (http://cmake.org) 2.8.7 or newer, available in $PATH as cmake
  3. Documentation (optional)

Quick Build Instructions

These steps here are the minimum steps to get a default Debug build. Using CMake you can do many other things, including setting additional variables, setting up for static builds, or generation project or solution files for different development environments. Please check the CMake website for all the various options that CMake supports.

POSIX

This assumes you have a shell in the project directory, and have the cmake and suitable compilers (and any required supporting tools like linkers or archivers) on your path.

  1. % mkdir build
  2. % cd build
  3. % cmake ..
  4. % cmake --build .
  5. % ctest .
  6. % sudo cmake --build . --target install
  7. % sudo ldconfig (if on Linux)

Windows

This assumes you are in a command or powershell window and have the appropriate variables setup to support Visual Studio, typically by running vcvarsall.bat or similar with the appropriate argument(s). It also assumes you are in the project directory.

  1. md build
  2. cd build
  3. cmake ..
  4. cmake --build . --config Debug
  5. ctest -C Debug .
  6. cmake --build . --config Debug --target install NB: This may have to be done using an Administrator account.

Alternatively, you can build and install nanomsg using vcpkg dependency manager:

  1. git clone https://github.com/Microsoft/vcpkg.git
  2. cd vcpkg
  3. ./bootstrap-vcpkg.bat
  4. ./vcpkg integrate install
  5. ./vcpkg install nanomsg

The nanomsg port in vcpkg is kept up to date by microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

Static Library

We normally build a dynamic library (.so or .DLL) by default.

If you want a static library (.a or .LIB), configure by passing -DNN_STATIC_LIB=ON to the first cmake command.

POSIX

POSIX systems will need to link with the libraries normally used when building network applications. For some systems this might mean -lnsl or -lsocket.

Windows

You will also need to define NN_STATIC_LIB in your compilation environment when building programs that use this library. This is required because of the way Windows changes symbol names depending on whether the symbols should be exported in a DLL or not.

When using the .LIB on Windows, you will also need to link with the ws2_32, mswsock, and advapi32 libraries, as nanomsg depends on them.

Support

This library is considered to be in "sustaining" mode, which means that new feature development has ended, and bug fixes are made only when strictly necessary for severe issues.

New development is now occurring in the NNG project, which offers both protocol and API compatibility with this project. Please consider using NNG for new projects.

Please see the file SUPPORT for more details.

Resources

Website: http://nanomsg.org

Source code: https://github.com/nanomsg/nanomsg

Documentation: http://nanomsg.org/documentation.html

Bug tracker: https://github.com/nanomsg/nanomsg/issues

Mailing list: [email protected]

Gitter Chat: https://gitter.im/nanomsg/nanomsg

IRC chatroom: #nanomsg at irc.freenode.net/8001

Owner
nanomsg
Nanomsg Project
nanomsg
Comments
  • Change from malloc to calloc

    Change from malloc to calloc

    changes to make sure that the alloced memory block is zero filled, takes a little more time but ALWAYS worth it.. to keep garbage out of the memory block.

    These changes are submitted under the MIT License

  • Memory leak on nn_send from REQ endpoint

    Memory leak on nn_send from REQ endpoint

    nn_device is seen to fail, where the client will receive 4 bytes too many (probably the request ID) from the server when used over a device.

    Please read down til near the end, to get the full details; the history of messages that led us to this conclusion is -- convoluted.

    Original description (which ultimately led to this bug, below):

    Using req/rep model, on NN_REQ enpoint I send messages with nn_send(..., NN_DONTWAIT) and wait for NN_POLLIN event of nn_poll with dynamic timeout. If nothing recieved, another message can be send after some time (during which the response to the previous can come). If the response really comes, then we have a memory leak. At least, it looks like this. The workaround is call of nn_recv(..., NN_DONTWAIT) just before any nn_send; but it seems strange.

  • Providing test to demonstrate hang in nn_close on websocket transport

    Providing test to demonstrate hang in nn_close on websocket transport

    This test demonstrates an occasional hang (at least on Windows) on line 100 when the PUB socket is closed. Creating PR in order to kick off automated builds on other platforms to see if they fail here as well, or if it is limited to just Windows.

    This only appears to hang on the WebSocket transport. This could be just a problem with the WebSocket transport implementation (the most likely scenario), or it could be because the WebSocket transport incidentally requires more time to connect and perhaps disconnect sockets, as compared to say TCP, and is thus more likely to trigger a race condition.

  • Nanomsg an order of magnitude slower than zmq

    Nanomsg an order of magnitude slower than zmq

    I thought nanomsg is supposed to be faster than zmq, but when I tested on my Thinkpad W520 running Centos6.4, I was very surprised to find out that it was an order of magnitude slower.

    Here is my program:

    #include "../src/nn.h"
    #include "../src/pair.h"
    #include <cstdio>
    #include <unistd.h>
    #include <cstring>
    #include <cassert>
    #include <pthread.h>
    #include <sys/time.h>
    
    void* Send(void* context)
    {
        int responder = nn_socket(AF_SP, NN_PAIR);
        assert(responder != -1);
        int rc = nn_connect(responder, "inproc://test");
        assert(rc >= 0);
    
        char buf[1024];
        unsigned long bytes = 0;
        int sz[] = { 16,32,64,96,128,160,192,224,256,384,512,768,1024};
        int p =0;
        for (unsigned count = 1048576; count--;)
        {
        unsigned len = sz[p];
            nn_send(responder, buf, len, 0);
        bytes += len;
        p = (p+1) % (sizeof(sz)/sizeof(sz[0]));
        }
        nn_send(responder, buf, 0, 0);
        printf("sent %lu bytes\n", bytes);
        nn_close(responder);
        return NULL;
    }
    
    
    void* Receive(void* arg)
    {
        int receiver = (long)arg;
        char buf[1024];
        unsigned long bytes = 0;
        while (1)
        {
            int len = nn_recv(receiver, buf, sizeof(buf), 0);
        if (!len)
            break;
        if (len < 0)
        {
            perror("zmq_recv");
            break;
        }
        bytes += len;
        }
        printf("received %lu bytes\n", bytes);
        return NULL;
    }
    
    int main ()
    {
        int receiver = nn_socket(AF_SP, NN_PAIR);
        assert(receiver != -1);
        int rc = nn_bind(receiver, "inproc://test");
        assert(rc >= 0);
    
        struct timeval tv;
        gettimeofday(&tv, NULL);
        unsigned long t0 = tv.tv_usec + tv.tv_sec * 1000000;
    
        pthread_t th;
        pthread_create(&th, NULL, Receive, (void*)receiver);
        Send(NULL);
        void* ret;
        pthread_join(th, &ret);
    
        gettimeofday(&tv, NULL);
        unsigned long t = tv.tv_usec + tv.tv_sec * 1000000 - t0;
        printf("elapsed=%.3f\n", t/1000000.);
        return 0;
    }
    

    On my Thinkpad W520, it takes about 3.6-4.3s to run; whereas a similar version using zmq only took 0.4s. Can someone please point out what I did wrong? Thanks!

  • Mac OS X: assertion failed (aio_posix.inc)

    Mac OS X: assertion failed (aio_posix.inc)

    I have written a small echo client/server example in LuaJIT. It runs fine on Linux but on OS X I sometimes have the following error on the client side:

    Assertion failed: errno == ECONNRESET || errno == ETIMEDOUT || errno == EPIPE (/[...]/nanomsg/src/utils/aio_posix.inc:779)
    Abort trap: 6
    

    The error occurs on that line (nn_recv).

  • assertion failure (NN_QUEUE_NOTINQUEUE)

    assertion failure (NN_QUEUE_NOTINQUEUE)

    Assertion failed: self->next == NN_QUEUE_NOTINQUEUE (/home/mike/nanomsg/src/utils/queue.c:78)

    Program received signal SIGABRT, Aborted. [Switching to Thread 0x7ffff1e37700 (LWP 2527)] 0x00007ffff707f425 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007ffff707f425 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x00007ffff7082b8b in __GI_abort () at abort.c:91 #2 0x00007ffff795d379 in nn_err_abort () from /usr/local/lib/libnanomsg.so.0.0.0 #3 0x00007ffff795e3ec in nn_queue_item_term () from /usr/local/lib/libnanomsg.so.0.0.0 #4 0x00007ffff795bf9f in nn_worker_task_term () from /usr/local/lib/libnanomsg.so.0.0.0 #5 0x00007ffff7959457 in nn_usock_term () from /usr/local/lib/libnanomsg.so.0.0.0 #6 0x00007ffff796af36 in nn_aipc_term () from /usr/local/lib/libnanomsg.so.0.0.0 #7 0x00007ffff796bceb in nn_bipc_handler () from /usr/local/lib/libnanomsg.so.0.0.0 #8 0x00007ffff795789e in nn_fsm_event_process () from /usr/local/lib/libnanomsg.so.0.0.0 #9 0x00007ffff795763b in nn_ctx_leave () from /usr/local/lib/libnanomsg.so.0.0.0 #10 0x00007ffff795c53f in nn_worker_routine () from /usr/local/lib/libnanomsg.so.0.0.0 #11 0x00007ffff795e8d4 in nn_thread_main_routine () from /usr/local/lib/libnanomsg.so.0.0.0 #12 0x00007ffff56efe9a in start_thread (arg=0x7ffff1e37700) at pthread_create.c:308 #13 0x00007ffff713cccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #14 0x0000000000000000 in ?? ()

    (gdb)

    on another thread: Assertion failed: 0 (/home/mike/nanomsg/src/transports/utils/streamhdr.c:284)

    Program received signal SIGABRT, Aborted. [Switching to Thread 0x7ffff1e37700 (LWP 2533)] 0x00007ffff707f425 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007ffff707f425 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x00007ffff7082b8b in __GI_abort () at abort.c:91 #2 0x00007ffff795d379 in nn_err_abort () from /usr/local/lib/libnanomsg.so.0.0.0 #3 0x00007ffff7968962 in nn_streamhdr_handler () from /usr/local/lib/libnanomsg.so.0.0.0 #4 0x00007ffff795789e in nn_fsm_event_process () from /usr/local/lib/libnanomsg.so.0.0.0 #5 0x00007ffff795763b in nn_ctx_leave () from /usr/local/lib/libnanomsg.so.0.0.0 #6 0x00007ffff795c53f in nn_worker_routine () from /usr/local/lib/libnanomsg.so.0.0.0 #7 0x00007ffff795e8d4 in nn_thread_main_routine () from /usr/local/lib/libnanomsg.so.0.0.0 #8 0x00007ffff56efe9a in start_thread (arg=0x7ffff1e37700) at pthread_create.c:308 #9 0x00007ffff713cccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #10 0x0000000000000000 in ?? ()

    (gdb)

    another: Assertion failed: self->next == NN_QUEUE_NOTINQUEUE (/home/mike/nanomsg/src/utils/queue.c:78)

    Program received signal SIGABRT, Aborted. [Switching to Thread 0x7ffff1e37700 (LWP 2539)] 0x00007ffff707f425 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007ffff707f425 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x00007ffff7082b8b in __GI_abort () at abort.c:91 #2 0x00007ffff795d379 in nn_err_abort () from /usr/local/lib/libnanomsg.so.0.0.0 #3 0x00007ffff795e3ec in nn_queue_item_term () from /usr/local/lib/libnanomsg.so.0.0.0 #4 0x00007ffff795bf9f in nn_worker_task_term () from /usr/local/lib/libnanomsg.so.0.0.0 #5 0x00007ffff7959457 in nn_usock_term () from /usr/local/lib/libnanomsg.so.0.0.0 #6 0x00007ffff796af36 in nn_aipc_term () from /usr/local/lib/libnanomsg.so.0.0.0 #7 0x00007ffff796bceb in nn_bipc_handler () from /usr/local/lib/libnanomsg.so.0.0.0 #8 0x00007ffff795789e in nn_fsm_event_process () from /usr/local/lib/libnanomsg.so.0.0.0 #9 0x00007ffff795763b in nn_ctx_leave () from /usr/local/lib/libnanomsg.so.0.0.0 #10 0x00007ffff795c53f in nn_worker_routine () from /usr/local/lib/libnanomsg.so.0.0.0 #11 0x00007ffff795e8d4 in nn_thread_main_routine () from /usr/local/lib/libnanomsg.so.0.0.0 #12 0x00007ffff56efe9a in start_thread (arg=0x7ffff1e37700) at pthread_create.c:308 #13 0x00007ffff713cccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #14 0x0000000000000000 in ?? ()

    (gdb)

    code:

    int main(int argc, char *argv[]) { void *data = NULL; int r_len = 0; int timeout = 1000; unsigned char *s_data = NULL; int s_len = 0; int s; int a; int len; int _time=time(0); int i; int found_command=0; char file[1024]; char ipc[1024]; int ipc_num = 0;

    if (argc > 1) {
        ipc_num = atoi(argv[1]) + 1;
    } else ipc_num = 1;
    
    if (strstr(argv[0], "curl") || strstr(argv[0], "adreplace")) {
        sprintf(file, "/tmp/curl%d.ipc", ipc_num);
        sprintf(ipc, "ipc:///tmp/curl%d.ipc", ipc_num);
    
    } else {
        sprintf(file, "/tmp/adserver%d.ipc", ipc_num);
        sprintf(ipc, "ipc:///tmp/adserver%d.ipc", ipc_num);
    }
    
    // initialize mysql
    init();
    //mysql_reopen();
    s = nn_socket(AF_SP, NN_REP);
    nn_setsockopt(s, NN_SOL_SOCKET, NN_RCVTIMEO, &timeout, sizeof(timeout));
    nn_setsockopt(s, NN_SOL_SOCKET, NN_SNDTIMEO, &timeout, sizeof(timeout));
    a = nn_bind(s, ipc);
    chmod(file, 0777);
    
    printf("Bound to IPC: %s\n", ipc);
    
    _time = time(0);
    while (1) {
    
        s_len = 0;
        s_data = NULL;
        found_command=0;
    
        len = nn_recv(s, &data, NN_MSG, 0);
    

    // if (len) { if (data && ((unsigned)len >= (unsigned)sizeof(NanoPkt))) { // do whatever with data here... always be sure to set s_data, and s_len NanoPkt _pkthdr = (NanoPkt *)data; printf("NN recv len %d nanopkt cmd %d nanopkt len %d - %d %d %d\n", len, pkthdr->type, pkthdr->len, sizeof(Genreplace_Req), sizeof(Findrep_Req), sizeof(Final_Req)); for (i = 0; Commands[i].func != NULL; i++) { if (pkthdr->type == Commands[i].type) { (_Commands[i].func)((unsigned char *)data, len, &s_data, &s_len); found_command=1; break; } }

            printf("FOund command: %d\n", found_command);
    
            // just in case something went wrong.. we have to return something or we will force a stall
            if (s_data == NULL || !s_len) {
                //printf("sending null\n");
                nn_send(s, "NULL", 4, 0);
            } else {
                //printf("sending %d bytes of real data %p\n", s_len, s_data);
                nn_send(s, s_data, s_len, 0);
    

    // free(s_data); } // nn_freemsg(data); data = NULL; }

        if ((time(0) - _time) > 10) {
            _time = time(0);
            removerep();
        }
    

    // }

    }
    nn_close(s);
    

    }

    client: if ((reqptr = (Genreplace_Req *)malloc(sizeof(Genreplace_Req) + 1)) == NULL) return NULL; memset(reqptr, 0, sizeof(Genreplace_Req)); reqptr->addr = ip; reqptr->addr2 = addr2; reqptr->width = width; reqptr->height = height; // memcpy(&reqptr->ip, straddr, 15); // memcpy(&reqptr->iso, iso, 3);

    pkt = (void *)nanopkt(GENREPLACE_REQ, &rep_len, reqptr, sizeof(Genreplace_Req));
    

    nanopkt: char *nanopkt(int type, int *_len, void *extra, int extra_size) { NanoPkt *pkthdr; char *ret = NULL; int msg_sock = 0; int len = 0; void *data = NULL; void *out_data = NULL; int out_size = 0; char *ptr; int value=1000; int prio=1; char ipc[1024];

    out_data = (void *)malloc(sizeof(NanoPkt) + extra_size + 1);
    ptr = (char *)out_data;
    pkthdr = (NanoPkt *)ptr;
    ptr += sizeof(NanoPkt);
    
    pkthdr->type = type;
    pkthdr->len = sizeof(NanoPkt) + extra_size;
    
    if (extra_size) {
        memcpy(ptr, extra, extra_size);
        ptr += extra_size;
    }
    
    out_size = sizeof(NanoPkt) + extra_size;
    
    if ((msg_sock = nn_socket(AF_SP, NN_REQ)) < 0) goto end;
    //nn_setsockopt(msg_sock, NN_SOL_SOCKET, NN_RCVTIMEO, &value, sizeof(value));
    //nn_setsockopt(msg_sock, NN_SOL_SOCKET, NN_SNDTIMEO, &value, sizeof(value));
    for (prio = 1; prio < 5; prio++) {
        sprintf(ipc, "ipc:///tmp/%s%d.ipc", (type==ADREPLACE_REQ) ? "curl" : "adserver",    prio);
        nn_setsockopt (msg_sock, NN_SOL_SOCKET, NN_SNDPRIO, &prio, sizeof (int));
        nn_connect(msg_sock, ipc);
    }
    

    // if (nn_connect(msg_sock, "ipc:///tmp/adserver0.ipc") < 0) goto end; // doconnect(msg_sock,10); if (nn_send(msg_sock, out_data, out_size, 0) < 0) goto end;

    len = nn_recv(msg_sock, &data, NN_MSG, 0);
    
    *_len = len;
    
    if (data && len) {
        ret = malloc(len + 1);
        if (ret == NULL) return NULL; // fatal should exit...
        memcpy(ret, data, len);
        nn_freemsg(data);
    }
    

    end:; if (msg_sock) nn_close(msg_sock); return ret; }

  • fixes #502 Assertion or Access Violation when calling nn_close while nn_recv blocks in separate thread

    fixes #502 Assertion or Access Violation when calling nn_close while nn_recv blocks in separate thread

    This PR replaces #502 by splitting out the test from tcp_shutdown into a new test called async_shutdown

    Again, for clarity, this PR fixes one type of bug on Windows, but then exposes a new failure mode downstream. The test -- but not the fix -- might expose further issues on *NIX systems.

  • Receiving up published messages

    Receiving up published messages

    This seems to be affecting both C and Go code. The sender on the Pub side uses a scatter array from the C library with nn_sendmsg. The sub side was receiving using nn_recv. The data comes in, but there seems to be a constant memory leak when receiving packets. I was trying to convert over to nn_recvmsg, but I'm having a bit of trouble trying to setup to pull all data including hdr.msg_control data to make sure I clear the buffers. Opendns is blocking nanomsg.org, so I'm having a hard time with this at work. I can get data off the packets with nn_recvmsg, but I still leak memory and that is where I was trying to pull control data as well. In all cases, the receiver is making sure to empty the receive queue, but leaks still occur.

  • Doesn't build on Windows with CMake + mingw32

    Doesn't build on Windows with CMake + mingw32

    Here are the steps performed to reproduce the issue (version 0.4 beta):

    1. Lunch CMake-gui, Configure, select 'MinGW Makefiles', specify native compiler for C by pointing to the path of gcc, Generate. OK
    2. Go the build directory (I created a sub-dir named build), lunch mingw32-make, error:
    Z:\sp\Dropbox\Prj\repo\nanomsg\__build\src\nanomsg-0.4-beta\build>mingw32-make
    Scanning dependencies of target nanomsg
    [  1%] Building C object src/CMakeFiles/nanomsg.dir/core/ep.c.obj
    In file included from Z:\sp\Dropbox\Prj\repo\nanomsg\__build\src\nanomsg-0.4-beta\src\core\../aio/../utils/mutex.h:27:0,
                     from Z:\sp\Dropbox\Prj\repo\nanomsg\__build\src\nanomsg-0.4-beta\src\core\../aio/ctx.h:26,
                     from Z:\sp\Dropbox\Prj\repo\nanomsg\__build\src\nanomsg-0.4-beta\src\core\sock.h:29,
                     from Z:\sp\Dropbox\Prj\repo\nanomsg\__build\src\nanomsg-0.4-beta\src\core\ep.c:27:
    Z:\sp\Dropbox\Prj\repo\nanomsg\__build\src\nanomsg-0.4-beta\src\core\../aio/../utils/win.h:38:5: error: unknown type name 'ADDRESS_FAMILY'
         ADDRESS_FAMILY sun_family;
         ^
    Z:\sp\Dropbox\Prj\repo\nanomsg\__build\src\nanomsg-0.4-beta\src\core\../aio/../utils/win.h:40:17: error: 'ADDRESS_FAMILY' undeclared here (not in a function)
             sizeof (ADDRESS_FAMILY)];
                     ^
    src\CMakeFiles\nanomsg.dir\build.make:53: recipe for target 'src/CMakeFiles/nanomsg.dir/core/ep.c.obj' failed
    mingw32-make[2]: *** [src/CMakeFiles/nanomsg.dir/core/ep.c.obj] Error 1
    CMakeFiles\Makefile2:1334: recipe for target 'src/CMakeFiles/nanomsg.dir/all' failed
    mingw32-make[1]: *** [src/CMakeFiles/nanomsg.dir/all] Error 2
    Makefile:146: recipe for target 'all' failed
    mingw32-make: *** [all] Error 2
    
  • NN_QUEUE_NOTINQUEUE fix incomplete

    NN_QUEUE_NOTINQUEUE fix incomplete

    Just saw this on Travis:

    Assertion failed: self->next == NN_QUEUE_NOTINQUEUE (../src/utils/queue.c:102) /bin/bash: line 5: 13356 Aborted (core dumped) ${dir}$tst

    Arrgh. This was the ipc_shutdown test.

  • ws.c test periodically hangs

    ws.c test periodically hangs

    This issue is to continue a conversation first started from a pull request: https://github.com/nanomsg/nanomsg/pull/503#issuecomment-153775151

    @gdamore writes: "I think the windows code is particularly fragile... I have some theories here, but it seems like some tests trash the stack. The tcp_shutdown test was particularly hard here; once it failed it left the stack in a state that even other tests would fail subsequently."

    Can you elaborate on this?

  • Add CodeQL workflow for GitHub code scanning

    Add CodeQL workflow for GitHub code scanning

    Hi nanomsg/nanomsg!

    This is a one-off automatically generated pull request from LGTM.com :robot:. You might have heard that we’ve integrated LGTM’s underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! We tested it before opening this pull request, so all should be working :heavy_check_mark:. In fact, you might already have seen some alerts appear on this pull request!

    Where needed and if possible, we’ve adjusted the configuration to the needs of your particular repository. But of course, you should feel free to tweak it further! Check this page for detailed documentation.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

  • "fg: no job control" build error

    While I try to build a rpm package with the spec file downloaded from other distributions like fedoraproject, rpmbuild says:

    ...
    + cd nanomsg-1.1.5
    + %cmake
    /var/tmp/rpm-tmp.yQW7pQ: line 29: fg: no job control
    error: Bad exit status from /var/tmp/rpm-tmp.yQW7pQ (%build)
    ...
    

    and then failed.

    I don't why build of this package works on other distributions but not my computer or my distribution. Could you please help me with this problem?

  • Bad file descriptor [9]

    Bad file descriptor [9]

    /home/root/application/latest/lib64/libnanomsg.so.5(nn_efd_signal+0x44)[0x7fae3938b4] /home/root/application/latest/lib64/libnanomsg.so.5(+0x121e4)[0x7fae38e1e4] /home/root/application/latest/lib64/libnanomsg.so.5(nn_ctx_leave+0x3c)[0x7fae38fa34] /home/root/application/latest/lib64/libnanomsg.so.5(+0x16930)[0x7fae392930] /home/root/application/latest/lib64/libnanomsg.so.5(+0x18ecc)[0x7fae394ecc] /home/root/application/latest/lib/libpthread.so.0(+0x77ac)[0x7fadb707ac] /lib/libc.so.6(+0xda70c)[0x7fad85d70c] Bad file descriptor [9] (/home/work/nanomsg/nanomsg-1.1.5/src/utils/efd_eventfd.inc:78)

    This error caused my program crash

  • Nanomsg gives signal 6 abort during fetching from couchbase

    Nanomsg gives signal 6 abort during fetching from couchbase

    Hi, I am getting a signal 6 error when i am trying to fetch data from couchbase, this occurs at erratic intervals. I am using version 1.1 and from the code i can see if poll returns value less than 0, errno_assert is being triggered which crashes the application with signal 6. Below is the backtrace of nanomsg thread:

    Program terminated with signal 6, Aborted. #0 0x00007ffff4c74a33 in select () from /usr/lib64/libc.so.6 Missing separate debuginfos, use: debuginfo-install boost-system-1.53.0-28.el7.x86_64 cyrus-sasl-lib-2.1.26-23.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-50.el7.x86_64 libcom_err-1.42.9-19.el7.x86_64 libcurl-7.29.0-59.el7_9.1.x86_64 libidn-1.28-4.el7.x86_64 libselinux-2.5-15.el7.x86_64 libssh2-1.8.0-4.el7.x86_64 nspr-4.32.0-1.el7_9.x86_64 nss-3.53.1-3.el7_9.x86_64 nss-util-3.67.0-1.el7_9.x86_64 openldap-2.4.44-22.el7.x86_64 openssl-libs-1.0.2k-21.el7_9.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-19.el7_9.x86_64 (gdb) thread 18 [Switching to thread 18 (Thread 0x7fffcef74700 (LWP 40630))] #0 0x00007ffff4bfce00 in _IO_cleanup () from /usr/lib64/libc.so.6 (gdb) bt full #0 0x00007ffff4bfce00 in _IO_cleanup () from /usr/lib64/libc.so.6 No symbol table info available. #1 0x00007ffff4bb6be5 in abort () from /usr/lib64/libc.so.6 No symbol table info available. #2 0x00000000009ff371 in nn_err_abort () No symbol table info available. #3 0x00000000009ff2cd in nn_efd_wait () No symbol table info available. #4 0x00000000009fbb13 in nn_sock_recv () No symbol table info available. #5 0x00000000009f95fa in nn_recvmsg () No symbol table info available. #6 0x00000000009f9015 in nn_recv () No symbol table info available. #7 0x000000000099b8c9 in vcmNpsIcmMsgRecv () No symbol table info available. #8 0x0000000000975a57 in __vcmNpsIcmRecv () No symbol table info available. #9 0x00000000007261f5 in vcmDpeEmaIcmStatsCb(void*) () No symbol table info available. #10 0x000000000099a54b in vcmNpsIcmInterfaceCreate () No symbol table info available. #11 0x000000000095b1c0 in ?? () No symbol table info available. #12 0x00007ffff7250ea5 in start_thread (arg=0x7fffcef74700) at pthread_create.c:307 __res = pd = 0x7fffcef74700 now = unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140736665700096, -1738215837302118578, 0, 33558528, 0, 140736665700096, 1738108024908031822, 1738235171653297998}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}} not_first_call = pagesize_m1 = ---Type to continue, or q to quit--- sp = freesize = #13 0x00007ffff4c7d9fd in clone () from /usr/lib64/libc.so.6 This is present in one of our stdout files: Invalid argument [22] (home/3rd-party/nanomsg/src/utils/efd.c:91)

    Code:: 88 rc = poll (&pfd, 1, timeout); 89 if (nn_slow (rc < 0 && errno == EINTR)) 90 return -EINTR; 91 errno_assert (rc >= 0);

    I found that in version 1.2, this errno_assert is not present in the code, Can this errno_assert be safely removed from our code without updating the nanomsg version . Please help.

  • nn_closefd nn_err_abort

    nn_closefd nn_err_abort

    please help me: Occasionally encounter exceptions in my project that cause the program to crash,gdb debugging information is as follows: #0 0x0000007f9e375378 in raise () from /lib/libc.so.6​ No symbol table info available.​ #1 0x0000007f9e3639c0 in abort () from /lib/libc.so.6​ No symbol table info available.​ #2 0x0000007f9e07ba78 in nn_err_abort ()​ at /home/iotbuild/DockerUb1804_jenkinsWork/workspace/PRE_rk356x_linux_T8030/env/app/baize_platform/baize_app/third_usage/nanomsg/nanomsg-1.1.5/src/utils/err.c:56​ No locals.​ #3 0x0000007f9e07b524 in nn_closefd (fd=0)​ at /home/iotbuild/DockerUb1804_jenkinsWork/workspace/PRE_rk356x_linux_T8030/env/app/baize_platform/baize_app/third_usage/nanomsg/nanomsg-1.1.5/src/utils/closefd.c:41​ rc = -1​ #4 0x0000007f9e078b18 in nn_usock_handler (self=0x7f7400ad88, src=1, type=1, srcptr=0x7f7400adf8)​ at /home/iotbuild/DockerUb1804_jenkinsWork/workspace/PRE_rk356x_linux_T8030/env/app/baize_platform/baize_app/third_usage/nanomsg/nanomsg-1.1.5/src/aio/usock_posix.inc:811​ rc = -104​ usock = 0x7f7400ad88​ s = 127​ sz = 9​ sockerr = 127​ #5 0x0000007f9e0751fc in nn_fsm_feed (self=0x7f7400ad88, src=1, type=1, srcptr=0x7f7400adf8)​ at /home/iotbuild/DockerUb1804_jenkinsWork/workspace/PRE_rk356x_linux_T8030/env/app/baize_platform/baize_app/third_usage/nanomsg/nanomsg-1.1.5/src/aio/fsm.c:83​ No locals.​ #6 0x0000007f9e07a5fc in nn_worker_routine (arg=0x7f9e0c5460 <self+32>)​ at /home/iotbuild/DockerUb1804_jenkinsWork/workspace/PRE_rk356x_linux_T8030/env/app/baize_platform/baize_app/third_usage/nanomsg/nanomsg-1.1.5/src/aio/worker_posix.inc:248​ rc = 0​ self = 0x7f9e0c5460 <self+32>​ pevent = 1​ phndl = 0x7f7400ae08​ thndl = 0x7f7c003f60​ tasks = {head = 0x0, tail = 0x0}​ item = 0x0​ task = 0x7f7c003de8​ fd = 0x7f7400adf8​ timer = 0x7f7c003f58​ #7 0x0000007f9e07db18 in nn_thread_main_routine (arg=0x7f9e0c56d8 <self+664>)​ at /home/iotbuild/DockerUb1804_jenkinsWork/workspace/PRE_rk356x_linux_T8030/env/app/baize_platform/baize_app/third_usage/nanomsg/nanomsg-1.1.5/src/uti--Type for more, q to quit, c to continue without paging--c​ ls/thread_posix.inc:35​ self = 0x7f9e0c56d8 <self+664>​ #8 0x0000007f9e3086d0 in start_thread () from /lib/libpthread.so.0​ No symbol table info available.​ #9 0x0000007f9e40c6cc in thread_start () from /lib/libc.so.6​ No symbol table info available.

  • SegFault in

    SegFault in "nn_usock_handler" at src/aio/usock_posix.inc : Line 601

    We are facing segfault issue in nanomsg library. We use PUB/SUB mechanism for communication. Following nanomsg thread routine is causing the crash.

    [Backtrace] #0 0x00007efd56091a2b in nn_usock_handler (self=0x56094724f870, src=1, type=1, srcptr=) at /usr/src/debug/git/nanomsg/src/aio/usock_posix.inc:601 usock = 0x56094724f870 s = rc = sz = 9 srcptr = type = 1 src = 1 self = 0x56094724f870 usock = 0x56094724f870 #1 0x00007efd5607709e in nn_worker_routine (arg=0x7efd562c06e0 <self+64>) at /usr/src/debug/git/tnanomsg/src/aio/worker_posix.inc:249 rc = self = 0x7efd562c06e0 <self+64> pevent = 1 phndl = 0x56094724f8f0 thndl = 0x560947506368 tasks = {head = 0x0, tail = 0x0} item = task = fd = 0x56094724f8e0 timer = #2 0x00007efd56078ccd in nn_thread_main_routine (arg=) at /usr/src/debug/git/nanomsg/src/utils/thread_posix.inc:35 self = #3 0x00007efd55144477 in start_thread (arg=0x7efd4e9cf700) at /usr/src/debug/glibc/2.27-r0/git/nptl/pthread_create.c:463 pd = 0x7efd4e9cf700 now = unwind_buf = {cancel_jmp_buf = {{jmp_buf = {139626410735360, -9064765947889294268, 139626582381214, 139626582381215, 8396800, 139626582381216, 9208144196267959364, 9208121042860401732}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}} not_first_call = #4 0x00007efd54affd9f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 No locals.

    Can anyone suggest if any patch available for this issue?

Cap'n Proto serialization/RPC system - core tools and C++ library
Cap'n Proto serialization/RPC system - core tools and C++ library

Cap'n Proto is an insanely fast data interchange format and capability-based RPC system. Think JSON, except binary. Or think Protocol Buffers, except

Dec 30, 2022
rpclib is a modern C++ msgpack-RPC server and client library

rpclib rpclib is a RPC library for C++, providing both a client and server implementation. It is built using modern C++14, and as such, requires a rec

Dec 30, 2022
nanomsg library

Welcome to nanomsg The nanomsg library is a simple high-performance implementation of several "scalability protocols". These scalability protocols are

Jan 3, 2023
nanomsg-next-generation -- light-weight brokerless messaging

nng - nanomsg-next-gen ℹ️ If you are looking for the legacy version of nanomsg, please see the nanomsg repository. This project is a rewrite of the Sc

Dec 30, 2022
SSD1306 library and simple graphics core library based on Adafruit GFX Library.

Raspberry Pico SSD1306 + GFX Library Based on Adafruit GFX Library https://github.com/adafruit/Adafruit-GFX-Library Usage Hardware Connect your SSD130

Sep 1, 2022
This library provides a cross-platform image loading library in C11 for projects based on our foundation library

Image Library - Public Domain This library provides a cross-platform image loading library in C11 for projects based on our foundation library.

Jan 29, 2022
The dgSPARSE Library (Deep Graph Sparse Library) is a high performance library for sparse kernel acceleration on GPUs based on CUDA.

dgSPARSE Library Introdution The dgSPARSE Library (Deep Graph Sparse Library) is a high performance library for sparse kernel acceleration on GPUs bas

Dec 5, 2022
C-based/Cached/Core Computer Vision Library, A Modern Computer Vision Library

Build Status Travis CI VM: Linux x64: Raspberry Pi 3: Jetson TX2: Backstory I set to build ccv with a minimalism inspiration. That was back in 2010, o

Jan 6, 2023
A simple header-only C++ argument parser library. Supposed to be flexible and powerful, and attempts to be compatible with the functionality of the Python standard argparse library (though not necessarily the API).

args Note that this library is essentially in maintenance mode. I haven't had the time to work on it or give it the love that it deserves. I'm not add

Jan 4, 2023
Bolt is a C++ template library optimized for GPUs. Bolt provides high-performance library implementations for common algorithms such as scan, reduce, transform, and sort.

Bolt is a C++ template library optimized for heterogeneous computing. Bolt is designed to provide high-performance library implementations for common

Dec 27, 2022
oneAPI DPC++ Library (oneDPL) https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-library.html

oneAPI DPC++ Library (oneDPL) The oneAPI DPC++ Library (oneDPL) aims to work with the oneAPI DPC++ Compiler to provide high-productivity APIs to devel

Dec 29, 2022
C-based/Cached/Core Computer Vision Library, A Modern Computer Vision Library

Build Status Travis CI VM: Linux x64: Raspberry Pi 3: Jetson TX2: Backstory I set to build ccv with a minimalism inspiration. That was back in 2010, o

Jan 6, 2023
MIRACL Cryptographic SDK: Multiprecision Integer and Rational Arithmetic Cryptographic Library is a C software library that is widely regarded by developers as the gold standard open source SDK for elliptic curve cryptography (ECC).

MIRACL What is MIRACL? Multiprecision Integer and Rational Arithmetic Cryptographic Library – the MIRACL Crypto SDK – is a C software library that is

Jan 7, 2023
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket,  MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

Jan 1, 2023
MIRACL Cryptographic SDK: Multiprecision Integer and Rational Arithmetic Cryptographic Library is a C software library that is widely regarded by developers as the gold standard open source SDK for elliptic curve cryptography (ECC).

MIRACL What is MIRACL? Multiprecision Integer and Rational Arithmetic Cryptographic Library – the MIRACL Crypto SDK – is a C software library that is

Jan 2, 2023
C Hypertext Library - A library for writing web applications in C

CHL C Hypertext Library - A library for writing web applications in C #include <chl/chl.h> int main() { chl_set_default_headers(); chl_print_header

Nov 14, 2022
This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, including language, program library, data structure, algorithm, system, network, link loading library, interview experience, recruitment, recommendation, etc.
This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, including language, program library, data structure, algorithm, system, network, link loading library, interview experience, recruitment, recommendation, etc.

?? C/C++ 技术面试基础知识总结,包括语言、程序库、数据结构、算法、系统、网络、链接装载库等知识及面试经验、招聘、内推等信息。This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, including language, program library, data structure, algorithm, system, network, link loading library, interview experience, recruitment, recommendation, etc.

Dec 31, 2022
C XML Minimalistic Library (CXML) - An XML library for C with a focus on simplicity and ease of use.
C XML Minimalistic Library (CXML) - An XML library for C with a focus on simplicity and ease of use.

cxml (C XML Minimalistic Library) is a powerful and flexible XML library for C with a focus on simplicity and ease of use, coupled with features that enables quick processing of XML documents.

Dec 26, 2022
Edge ML Library - High-performance Compute Library for On-device Machine Learning Inference
 Edge ML Library - High-performance Compute Library for On-device Machine Learning Inference

Edge ML Library (EMLL) offers optimized basic routines like general matrix multiplications (GEMM) and quantizations, to speed up machine learning (ML) inference on ARM-based devices. EMLL supports fp32, fp16 and int8 data types. EMLL accelerates on-device NMT, ASR and OCR engines of Youdao, Inc.

Jan 7, 2023
Edge ML Library - High-performance Compute Library for On-device Machine Learning Inference
 Edge ML Library - High-performance Compute Library for On-device Machine Learning Inference

Edge ML Library (EMLL) offers optimized basic routines like general matrix multiplications (GEMM) and quantizations, to speed up machine learning (ML) inference on ARM-based devices. EMLL supports fp32, fp16 and int8 data types. EMLL accelerates on-device NMT, ASR and OCR engines of Youdao, Inc.

Dec 20, 2022