profile
viewpoint

slack-ruby/slack-ruby-bot 1050

The easiest way to write a Slack bot in Ruby.

andrewvc/learn-ruby-zeromq 279

Learn ZeroMQ using Ruby!

chuckremes/ffi-rzmq 233

FFI bindings for ZeroMQ so the library can be used under JRuby and other FFI-compliant ruby runtimes

methodmissing/rbczmq 127

Ruby extension that wraps the official high level ZeroMQ C API ( http://czmq.zeromq.org/ )

chuckremes/zmqmachine 78

A Ruby reactor library using 0mq sockets.

chuckremes/nn-core 34

Wraps the nanomsg networking library using FFI (foreign function interface) for Ruby.

chuckremes/ruby-io 11

A clean sheet redesign of Ruby's IO class. To include Sync and Async implementations.

chuckremes/ffi-rzmq-core 5

FFI wrapper around the zeromq libzmq C API. Utilized by other libraries to provide more Ruby-like API.

chuckremes/proto-rina 5

Prototype of a RINA (Recursive InterNetwork Architecture) stack

chuckremes/rzmq_brokers 3

A small toolkit for building 0mq-based brokers and protocols

Pull request review commentzeromq/libzmq

resizable_fast_vector_t resize crash fix

 template <typename T, size_t S> class resizable_fast_vector_t     {         if (_dynamic_buf)             _dynamic_buf->resize (nitems_);-        if (nitems_ > S) {-            _dynamic_buf = new (std::nothrow) std::vector<T>;+        else {

Should probably be if else ... instead to avoid allocations for few items.

boxkey

comment created time in 3 hours

issue commentoracle/truffleruby

Ruby 2.7 support

Could you also mark enumerator#produce as done per https://github.com/oracle/truffleruby/pull/2160 ? Thanks!

deepj

comment created time in 10 hours

issue commentoracle/truffleruby

Ruby 2.7 support

I'm marking "The flip-flop syntax deprecation is reverted." as done, since it doesn't seem we emitted the deprecation warning in the first place.

deepj

comment created time in 11 hours

PR opened kholia/OSX-KVM

UNRAID Documentation and Examples

As mentioned from #159 this PR adds UNRAID documentation: to show how this repository can be used to make VMs in UNRAID KVM. If there are any changes you'd like to make, please let me know - I will commit, no files should conflict between the base/head.

When the PR is ready, please merge (as more contributes to the documentation it'll be helpful for version controlling and git blame tracking).

Below is a sample of the documentation (so you don't have to preview from my fork).

Setting up OSX-KVM with UNRAID

Note: SpaceInvaderOne has a community app called "macinabox", and it is a Docker container that can automate the entire process that creates the VM and disks. This guide aims to provide utility in choosing specific macOS versions or bootloaders, and understanding the process of how this repository's resources can be used in hypervisor types (UNRAID, ESXi, etc.).

Motivation

This guide solely uses the files generated from this repository to construct a VM for use in UNRAID. This means updates to and features of this repository should be compatible with creating VMs in UNRAID. This type of setup also aims to utilize UNRAID's advantages to address items in the Contributing Back section of the main repository, including creating/re-using VM snapshots, build farms, VNC+SSH support, and capacity of delivering a bare-metal-like experience for development. Further customization in setting up Hackintosh on KVM is beyond the scope of this documentation, but feel free to provide relevant supplemental resources.

Pre-Requisites

Follow the Installation Preparation guide and have your disk image mac_hdd_ng.img and installation media BaseSystem.dmg ready.

Ensure you have VM support and passthrough parameters prepared (VFIO devices, PCI controllers, VNC remote, etc.). You should also have a way of reading/writing to the appropriate locations in your UNRAID server (I use Krusader).

Preparing the VM

Below are sample instructions for setting up the VM. We will keep the necessary files in the same directory for simplicity.

  • Place these 3 files BaseSystem.img, mac_hdd_ng.img and OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 into the directory of your VM
    • ie: Into /mnt/user/domains/BigSur, where domains is the folder for your VMs
  • Create a new VM and edit the XML. Use the OSX-KVM repository's macOS-libvirt-Catalina.xml as a guide
    • ie: You also have the option to use the GUI to adjust the CPUs, RAM, setting the OS installation media and disk images, as well as the devices you wish to pass into the VM. However, each time the template is edited via the GUI, you must go in the XML editor and paste the qemu args at the bottom of the XML file.
    • Note: The opencore qcow2 file should be prioritized first, it will contain the EFI boot partition that you can modify after installation using the OpenCore Configurator
  • Check that the three files' primary vDisk bus is SATA, and verify types:
    • OpenCore.qcow2 <driver name='qemu' type='qcow2' cache='writeback'/>
    • BaseSystem.img <driver name='qemu' type='raw' cache='writeback'/>
    • mac_hdd_ng.img <driver name='qemu' type='qcow2' cache='writeback'/>
  • After successful installation, the BaseSystem.img entry can be safely deleted from the XML

Starting the VM

  • Initialize the VM, and select the macOS base system when OpenCore prompts

  • Once the installer boots, go into disk utility and erase the qemu drive that relatively matches the space you've allocated in the qemu-img args

    • ie: Erase the disk and use these params - APFS, GUID Partition Table
  • After installation, you may need to change the NIC to vmxnet3 or e1000-82545em to login with your Apple ID or install your apps from the AppStore (consult Resources for other network interface types)

  • Download OpenCore Configurator and mount the EFI partition called EFI o (Tools > Mount EFI) OpenCore EFI Partitions

  • Open the plist from Tools > Scan Configurations OpenCore plist

  • Customize aml/kext/nvram/drivers and save

    • Note: Making modifications here will write to the OpenCore.qcow2 file copied from this repository.

Optional Notes

In no particular order,

  • For the RX 5700XT, the boot-args agdpmod=pikera is necessary to successfully boot. Change in NVRAM > UUID > boot-args (right-click) > WhateverGreen > agdpmod=pikera
    • Use VNC or another GPU until able to configure the EFI partition, or pre-configure the qcow2 file
  • Simplify updates by creating another VM template that does not passthrough the GPU (noVNC)
    • During OS updates, multiple restarts occur. If you use an AMD GPU that has the reset-bug, this process can be jarring
    • Each restart there will be another boot option alongside your default one (from the update), choose that one until the update is complete
  • For passing PCIe USB controllers. ensure they work with macOS and ensure its free by vfio-bind them on server boot

When there is a home for this section, feel free to share optimizations and configurations that require modifications to the qemu args, XML, config plist, etc.

Misc

qemu args

  <qemu:commandline>
    <qemu:arg value='-usb'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd,bus=usb-bus.0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check'/>
  </qemu:commandline>

Resources

+78 -0

0 comment

3 changed files

pr created time in 15 hours

push eventServiceStack/ServiceStack

Demis Bellot

commit sha 7c09be646300c0bf490ccadb90da620d68e4860e

Allow Sync OAuthProviders

view details

push time in 15 hours

PR closed kholia/OSX-KVM

Reformat Big-Sur.md and unRAID documentation

I found the resources in this repository very helpful in setting up OSX Catalina and macOS Big Sur in unRAID. In this PR I'd like to propose a slight re-ordering of content in the Big-Sur.md tutorial file, and share some setup steps for unRAID users (possibly transferable to other hypervisor setups). This could be advantageous for testing across different OS versions, or backing up when updating to a new beta version.

I have tested this with an AMD Ryzen 5 3600, ASUS X570-P mobo, RX 5700XT, and R9 270X on unRAID beta 6.9.0-beta35. UnRAID makes it relatively easy to deploy multiple bare metal VMs on their KVM (passthrough each of these AMD GPUs for each OSX VM to run them simultaneously), and my use case here is fast concurrent development across different OS'ses locally.

Here are the steps I've taken to make one (or more) OSX VMs on Big Sur, using the resources provided from this repository. I have made a commit for Big-Sur.md with the contents of the first half of this PR post, and if this documentation is helpful please let me know where to make another markdown file with unRAID steps (or as a Wiki entry).

Install Dependencies

Fedora

sudo dnf install p7zip p7zip-plugins qemu git wget libguestfs-tools

Download and install: https://src.fedoraproject.org/rpms/uml_utilities

Ubuntu

sudo apt-get install qemu uml-utilities virt-manager git wget libguestfs-tools p7zip-full -y

Creating Installation Media and Disk Image

Open terminal and copy and paste the following code blocks below each step.

  • Clone and navigate into OSX-KVM repository, make a placeholder for mounting HFS
    • git clone https://github.com/kholia/OSX-KVM.git
    • cd OSX-KVM && mkdir tmp
  • Select macOS version Big Sur and download
    • ./fetch-macOS.py
  • Extract and mount filesystem to tmp
    • 7z e -txar InstallAssistant.pkg '*.dmg'
    • 7z e -tdmg SharedSupport.dmg 5.hfs
    • sudo mount -oloop *.hfs tmp
  • Extract BaseSystem.dmg and convert it to .img
    • 7z l tmp/com_apple_MobileAsset_MacSoftwareUpdate/*.zip
    • 7z e tmp/*MacSoftwareUpdate/*.zip AssetData/Restore/Base*.dmg
    • qemu-img convert BaseSystem.dmg -O raw BaseSystem.img
  • Create Disk Image and Unmount
    • qemu-img create -f qcow2 mac_hdd_ng.img 280G
    • sudo umount tmp

Loading into UNRAID

Note: SpaceInvaderOne has a community app called "macinabox", and it is a Docker container that can automate the entire process that creates the VM and disks. The motive behind this PR is if you want to have more control during the setup process, and possibly adding supporting documentation for other hypervisors like ESXi.

Ensure you have VM support and passthrough parameters prepared (VFIO devices, PCI controllers, VNC remote, etc.). You should also have a way of reading/writing to the appropriate locations in your unRAID server (I use Krusader).

Preparing the VM

Below are sample instructions for setting up the VM (as long as the VM has access to these files they can go anywhere).

  • Copy these 3 files BaseSystem.img, mac_hdd_ng.img and OSX-KVM/OpenCore-Catalina/OpenCore.qcow2 into the directory of your VM
    • ie: Into /mnt/user/domains/BigSur where domains is the folder of your VMs
  • Create a new VM and edit the XML. Use the OSX-KVM repository's macOS-libvirt-Catalina.xml as a guide
    • ie: I create a VM, use the GUI to adjust the CPUs, RAM, setting the OS installation media and disk images, as well as the devices I wish to pass into the VM. Then, I go in and paste the qemu args at the bottom of the XML file.
    • Note: The opencore qcow2 file should be prioritized first, it will contain the EFI boot partition that you can modify after installation using the OpenCore Configurator
  • Check that the three files' primary vDisk bus is SATA, and verify types:
    • OpenCore.qcow2 <driver name='qemu' type='qcow2' cache='writeback'/>
    • BaseSystem.img <driver name='qemu' type='raw' cache='writeback'/>
    • mac_hdd_ng.img <driver name='qemu' type='qcow2' cache='writeback'/>
  • After successful installation you can remove the BaseSystem.img entry from your xml

Starting the VM

  • Run the VM, and select the macOS base system in the bootloader
  • Once the installer boots, go into disk utility and erase the qemu drive that relatively matches the space you've allocated in the qemu-img args
    • ie: Erase the disk and use these params - APFS, GUID Partition Table
  • After installation, you may need to change the NIC to vmxnet3 or e1000-82545em to login with your Apple ID or install your apps from the AppStore
  • Download OpenCore Configurator and tweak settings (ie: for the RX 5700XT, the args agdpmod=pikera is necessary to successfully boot)

Misc

qemu args

  <qemu:commandline>
    <qemu:arg value='-usb'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='usb-kbd,bus=usb-bus.0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc'/>
    <qemu:arg value='-smbios'/>
    <qemu:arg value='type=2'/>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check'/>
  </qemu:commandline>

Resources

+179 -203

8 comments

7 changed files

mikkeyboi

pr closed time in 15 hours

pull request commentkholia/OSX-KVM

Reformat Big-Sur.md and unRAID documentation

I will close this and open a PR for UNRAID documentation as suggested. I'll remake my fork for merging.

mikkeyboi

comment created time in 15 hours

issue openedzeromq/libzmq

zmq_ctx_term() blocks, if socket bind failed!

Issue description

I made a communication between 2 RK3399 chips using ZMQ. I already set linger=0 flag and zmq_close in the same thread. I use ctrl+c to interrupt my program. But I found sometimes, zmq_ctx_term() is still blocked, when sockets were closed.

In my program the subscriber-socket uses zmq_bind not zmq_connect, and the socket reconnects every 0.5s when these is no message comes.

Through many experiments, I found this problem only occurs when "socket bind failed! "(address is already in use). I know because of short-time(500ms) reconnect, the last socket is still in TIME_WAIT state, the socket in ZMQbg/Reaper maybe not closed actually?

Environment

  • libzmq version (commit hash if unreleased): 4.3
  • OS: Docker in ubuntu18.04 or RK3399 chip (linaro)

Minimal test code / Steps to reproduce the issue

I can reproduce this issue in docker or RK3399. And I write a piece of code used to reproduce it. On my laptop the socket can always reconnect every 500ms, so it never occurs on laptop.

#include <zmq.h>
#include <iostream>
#include <string>
#include <memory>
#include <functional>
#include <map>
#include <string>
#include <string.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <vector>
#include <unistd.h>
#include <signal.h>
#include<thread>

std::string randstr(const int len)
{
    char str[20];
    srand(time(NULL));
    int i;
    for (i = 0; i < len; ++i)
    {
        switch ((rand() % 3))
        {
        case 1:
            str[i] = 'A' + rand() % 26;
            break;
        case 2:
            str[i] = 'a' + rand() % 26;
            break;
        default:
            str[i] = '0' + rand() % 10;
            break;
        }
    }
    str[i] = '\0';
    std::string res = str;
    return res;
}


struct nbZmqSockets{
    zmq_pollitem_t items [2];
};

class SimpleSuber{
    public:
        SimpleSuber(void* context, const std::string& ip): 
                    m_Sockets(new nbZmqSockets()), 
                    m_context(context), 
                    m_ip(ip){
            if (init() < 0){
                std::abort();
            }
        }

        ~SimpleSuber(){
            for (auto x: m_Sockets->items){
                zmq_close(x.socket);
            }
        }

        int init(){
            //-------- 1st socket: used to sub ------------
            std::string port = "33567";
            if(port.empty()){
                std::cout<<"[ZMQ Subscriber]: Error msgType does not match a port! Please check defined ports in 'common.h' !"<<std::endl;
                return -1;
            }

            void* receiver = zmq_socket(m_context, ZMQ_SUB);
            std::string endpoint = m_ip + ":" + port;

            if (zmq_bind(receiver, endpoint.c_str()) < 0){
                std::cout<<"[ZMQ subscriber]: Bind failed! "<< endpoint.c_str()<<std::endl;
                return -1;
            }
            std::cout<<"[ZMQ Subscriber]: Bind ok! " << endpoint.c_str()<<std::endl;
            int linger = 0;
            zmq_setsockopt (receiver, ZMQ_LINGER, &linger, sizeof(linger)); // important!!!
            
            //-------- 2nd socket: used to terminate Blocking sub ------------
            void *ctrlPuller = zmq_socket (m_context, ZMQ_REP);
            std::string IPC_CTRL_CHANNEL_SUB = "inproc:///sdcard/ctrlChannel_sub";
            m_endpointCtrl = IPC_CTRL_CHANNEL_SUB + randstr(8);
            if (zmq_bind (ctrlPuller, m_endpointCtrl.c_str()) < 0){
                std::cout<<"[ZMQ Subscriber]: [ctrlPuller] Bind failed!!! "<< m_endpointCtrl.c_str()<<std::endl;
                return -1;
            }
            zmq_setsockopt (ctrlPuller, ZMQ_LINGER, &linger, sizeof(linger)); // important!!!

            m_Sockets->items[0] = { receiver, 0, ZMQ_POLLIN, 0 };
            m_Sockets->items[1] = { ctrlPuller, 0, ZMQ_POLLIN, 0 };
            std::cout<<"[ZMQ Subscriber]: [ctrlPuller] Bind ok! ."<< m_endpointCtrl.c_str()<<std::endl;
            return 1;
        }

        int reconnect(){
            closeSocket();
            if (init() < 0){
                std::cout<<"[ZMQ Subscriber]: Reconnect failed !!!"<<std::endl;  
                return -1; 
            } else{
                std::cout<<"[ZMQ Subscriber]: Reconnect ok !!!"<<std::endl;  
                return 1;
            }

        }

        void closeSocket(){
            for (auto x: m_Sockets->items){
                zmq_close(x.socket);
            }
        }

        int subscribe(std::string & str_msg, long timeout=500){
            std::cout << "subscribe" << std::endl;
            void* receiver = m_Sockets->items[0].socket;
            std::string topicStr = "str_msg";
            const char* topic = topicStr.c_str(); // Topic filter
            zmq_setsockopt (receiver, ZMQ_SUBSCRIBE, topic, strlen(topic));

            int poll_flag = zmq_poll (m_Sockets->items, 2, timeout);
            if (0 == poll_flag){ // blcoking point !
                std::cout<<"[ZMQ Subscriber]: Not receive Ts2WithID msg exceeded %ld[ms] ! Reconnecting now..." << timeout << std::endl;
                while (1){
                    if (reconnect() > 0){
                        return 0; 
                    }
                    std::this_thread::sleep_for (std::chrono::milliseconds(timeout)); //TODO important!!!  
                }
                return 0; 
            } else if (-1 == poll_flag){
                std::cout<<"[ZMQ Subscriber]: Error occur by zmq_poll Ts2WithID!" << std::endl;
                return -1; 
            }

            //-------------------- 1st socket: used to Sub ---------------------------------
            if (m_Sockets->items[0].revents & ZMQ_POLLIN){
                {
                    zmq_msg_t recvMsg;
                    int rc_env = zmq_msg_init(&recvMsg);
                    rc_env = zmq_msg_recv(&recvMsg, receiver, 0);
                    if (-1 == rc_env){
                        std::cout<<"[ZMQ Subscriber]: Recv Stop Signal or error occurs when receiving msg..."<<std::endl;
                        return -1;
                    }
                    size_t size = zmq_msg_size(&recvMsg);
                    char *str_msg = (char*)malloc(size + 1);
	                memcpy(str_msg, zmq_msg_data(&recvMsg), size);
                    zmq_msg_close(&recvMsg);
                }
            }
            // ----------------2nd socket: used to terminate Blocking ----------------------
            if (m_Sockets->items[1].revents & ZMQ_POLLIN){
                return executeTerminateCmd();
            }
            return 1;
        }


        int terminateBlocking(){
            void* ctrlPusher = zmq_socket(m_context, ZMQ_REQ);

            if (zmq_connect (ctrlPusher, m_endpointCtrl.c_str()) < 0){
                std::cout<<"[ZMQ Subscriber]: [ctrlPusher] Connect failed!!!  " << m_endpointCtrl.c_str()<<std::endl;
                std::abort(); //TODO...
            }
            int linger = 0;
            zmq_setsockopt (ctrlPusher, ZMQ_LINGER, &linger, sizeof(linger)); // important!!!
            std::cout<<"[ZMQ Subscriber]: [ctrlPusher] Connect ok!!!  (%s)"<< m_endpointCtrl.c_str()<<std::endl;

            const char* ctrlCmd = "KILL";
            zmq_msg_t ctrlMsg;
            zmq_msg_init_size(&ctrlMsg, strlen(ctrlCmd));
            memcpy(zmq_msg_data(&ctrlMsg), ctrlCmd, strlen(ctrlCmd));
            int rc = zmq_msg_send(&ctrlMsg, ctrlPusher, 0); // TODO...
            if (-1 == rc){
                std::cout<<"[ZMQ Subscriber]: [ctrlPusher] Send '%s' as ctrlCmd failed!!!"<< ctrlCmd<<std::endl;
                zmq_close(ctrlPusher);
                return -1;
            }
            zmq_msg_close(&ctrlMsg);
            std::cout<<"[ZMQ Subscriber]: [ctrlPusher] Send ctrlCmd successfully, the blocked subscriber will be closed..."<<std::endl;

            //  watting for a reply, with timeout
            zmq_pollitem_t items[] = {{static_cast<void*>(ctrlPusher), 0, ZMQ_POLLIN, 0}};
            int poll_rc = zmq_poll(&items[0], 1, 500); //TODO timeout ms 
            if (poll_rc <= 0){
                std::cout<<"[ZMQ Subscriber]: [ctrlPusher] Time out when receiving reply from control..."<<std::endl;
                zmq_close(ctrlPusher);
                return -1; //TODO return 1?
            }
            //  If we got a reply, process it
            if (items[0].revents & ZMQ_POLLIN) {
                zmq_msg_t replyMsg;
                rc = zmq_msg_init(&replyMsg);
                rc = zmq_msg_recv(&replyMsg, ctrlPusher, 0);
                if (-1 == rc){
                    std::cout<<"[ZMQ Subscriber]: [ctrlPusher] Error occurs when receiving Reply from server"<<std::endl;
                    zmq_close(ctrlPusher);
                    return -1;
                }
                zmq_msg_close(&replyMsg);
                std::cout<<"[ZMQ Subscriber]: [ctrlPusher] Succ get reply from control"<<std::endl;
            }

            zmq_close(ctrlPusher);
            std::cout<<"[ZMQ Subscriber]: [ctrlPusher] Finish terminateBlocking task successfully!"<<std::endl;
            return 1;
        }
    private:
        /**
         * Receive Terminate signal
         */
        int executeTerminateCmd(){
            //ALOGD("[ZMQ Subscriber]: [ctrlPuller] Running executeTerminateCmd, begin:");
            void* ctrlPuller = m_Sockets->items[1].socket;
                
            zmq_msg_t ctrlMsg;
            int rc = zmq_msg_init(&ctrlMsg);
            rc = zmq_msg_recv(&ctrlMsg, ctrlPuller, 0);
            if (-1 == rc) {
                std::cout<<"[ZMQ Subscriber]: [ctrlPuller] pull ctrlCmd failed!!!"<<std::endl;
                return -1;
            }

            size_t msgSize = zmq_msg_size(&ctrlMsg);
            char *recvMsg = (char*)malloc(msgSize + 1);
            memcpy(recvMsg, zmq_msg_data(&ctrlMsg), msgSize);
            zmq_msg_close(&ctrlMsg);
            recvMsg[msgSize] = 0;
            std::cout<<"[ZMQ Subscriber]: [ctrlPuller] recv '%s' as ctrlCmd." <<  recvMsg << std::endl;

            // Reply info: "OK"    
            const char* ans = "OK"; // can be anything
            zmq_msg_t replyMsg;
            zmq_msg_init_size(&replyMsg, strlen(ans));
            memcpy(zmq_msg_data(&replyMsg), ans, strlen(ans));
            rc = zmq_msg_send(&replyMsg, ctrlPuller, 0);
            if (-1 == rc){
                std::cout<<"[ZMQ Subscriber]:[ctrlPuller] Send 'OK' as reply failed!"<<std::endl;
                return -1;
            }
            std::cout<<"[ZMQ Subscriber]: [ctrlPuller] Reply 'OK' successfully!"<<std::endl;
            zmq_msg_close(&replyMsg);

            // call close sockets
            closeSocket();
            std::cout<<"[ZMQ Subscriber]: [ctrlPuller] Terminate Blocking sub successfully! Sockets (%s) are already closed!"<<std::endl;
            return -2; // TODO... return 0? 
        }

        void* m_context;
        std::string m_ip;
        std::shared_ptr<nbZmqSockets> m_Sockets;
        std::string m_endpointCtrl;
};

bool app_stopped = false;
void sigint_handler(int sig){
	if(sig == SIGINT){
		// ctrl+c退出时执行的代码
		std::cout << "ctrl+c pressed!" << std::endl;
		app_stopped = true;
	}
}

void t_sub(std::shared_ptr<SimpleSuber> suber){
    std::string msg_str = "";
    while(1){
        int sleep_t = 100000;
        usleep(sleep_t);
        std::cout << ">>> loop begin after "<< sleep_t << " us"<<std::endl;
        if (suber->subscribe(msg_str) <= -1){
            break;
            std::cout << ">> loop finish"<<std::endl;
        }
        std::cout << ">>> loop end"<<std::endl;
    }
}

int main(int argc, char **argv){
    if (argc < 2){
        std::cout<< "Usage: simple_sub [ip]" << std::endl;
        std::cout<< "Ex: simple_sub tcp://127.0.0.1" << std::endl;
        return -1;
    }
    std::cout << "=== This is simple_sub ... ===" << std::endl;
    std::string ip = argv[1]; // "tcp://127.0.0.1";
    signal(SIGINT, sigint_handler); // ctrl + c

    void* m_context = zmq_ctx_new();
    std::shared_ptr<SimpleSuber> suber = std::make_shared<SimpleSuber>(m_context, ip);
    std::thread thread_sub(t_sub, suber);
    

    int sleep_t = 50000000;
    usleep(sleep_t);
    std::cout<<">>> After sleep: " << sleep_t << "us"<<std::endl;
   
    int cnt = 0;
    while(1){
        cnt++;
        if (cnt % 10000 == 0){
            std::cout<< "cnt=" << cnt << std::endl;
        }
        if (app_stopped){
            suber->terminateBlocking(); // terminate socket, stop socket in the same thread
			break;
		}
    }

    if (thread_sub.joinable()){
        thread_sub.join();
    }

    zmq_ctx_destroy(m_context);
    std::cout<< " --- end ---" << std::endl;
    return 0;
}

What's the actual result? (include assertion message & call stack if applicable)

Block inside zmq_ctx_term()! 672502605

Never bind failed, can exit successfully! 1787261099

What's the expected result?

Even though socket binds failed somethimes, we can release all resources after calling zmq_ctx_term(), and it should not be blocked!

created time in 16 hours

issue openedzeromq/libzmq

Want to port ZMQ_ROUTER_HANDOVER to zeromq4.0.1

Please use this template for reporting suspected bugs or requests for help.

Issue description

I came to know about ZMQ_ROUTER_HANDOVER feature and would like to port it to zeromq4.0.1 version. Is this possible? Can someone please point me to the git commits done for the ZMQ_ROUTER_HANDOVER feature?

Environment

  • libzmq version (commit hash if unreleased):
  • OS:

Minimal test code / Steps to reproduce the issue

What's the actual result? (include assertion message & call stack if applicable)

What's the expected result?

created time in 18 hours

push eventkholia/OSX-KVM

Dhiru Kholia

commit sha 3ee4d9aac1d04c28b5ddb830918af099a8ab5f49

Batch Update 2 - November 2020 - Big Sur Stuff - Add makefile to build Big Sur recovery/full installer (nick) - Typo fixes (Gelma) - Simplify Big-Sur installation notes (ivy-rew) - Simplify Big-Sur installation notes (Broly1) - Simplify Big-Sur installation notes (mikkeyboi) - Xcode + OSX-KVM tutorial (ADawesomeguy) - Remove broken links (CyberShadow) - Expand "Docker on macOS " notes (mikehardy)

view details

push time in a day

push eventkholia/OSX-KVM

Dhiru Kholia

commit sha 12bf9db07405f10522b39f051e23ba301738ec15

Batch Update 2 - November 2020 - Big Sur Stuff - Add makefile to build Big Sur recovery/full installer (nick) - Typo fixes (Gelma) - Simplify Big-Sur installation notes (ivy-rew) - Simplify Big-Sur installation notes (Broly1) - Simplify Big-Sur installation notes (mikkeyboi) - Xcode + OSX-KVM tutorial (ADawesomeguy) - Remove broken links (CyberShadow) - Expand "Docker on macOS " notes (mikehardy)

view details

push time in a day

issue commentoracle/truffleruby

Ruby 2.7 support

I'll take a stab at the rescue parser bug.

deepj

comment created time in a day

PR closed oracle/truffleruby

Implement beginless range in-ci oca-signed

Starting to implement beginless ranges for Ruby 2.7 compatibility https://github.com/oracle/truffleruby/issues/2004

So far: Implemented or added specs for Range#{new, bsearch, count, each, equal_value, first, inspect, max, min, size} regarding beginless range compatibility Implemented or added specs for Array#{[], []=, slice, slice!, to_a, fill, values_at} regarding beginless range compatibility

To do: Range#cover?/include/=== some or all of Range#{entires, eql?, hash, last, member?, minmax, step/%, to_s} Methods outside of Array and Range, such as String methods.

https://github.com/Shopify/truffleruby/issues/1

+427 -31

24 comments

21 changed files

LillianZ

pr closed time in a day

pull request commentoracle/truffleruby

Implement beginless range

Merged! Congrats 👍

LillianZ

comment created time in a day

push eventoracle/truffleruby

Lillian Zhang

commit sha 67478a244debe830eb479c50ad7e4b3b2db62f06

allow beginless Range creation and untag

view details

Lillian Zhang

commit sha 6e647a95a3923a8d76f028baf92e88d3560b8de5

Array#[] and #slice shared specs for beginless and endless ranges

view details

Lillian Zhang

commit sha 6d2565f509441eac956c22a979a95971b695fdfb

Implement Array#[] and #slice for beginless ranges

view details

Lillian Zhang

commit sha 0175193cbe4427e35b80cdc275dbebc1ad782559

Spec for beginless range to_a

view details

Lillian Zhang

commit sha 3f8050d65f810b0905102a5c7f7cdacd94c0da82

Implement beginless range to_a

view details

Lillian Zhang

commit sha e247fcce01e6fe36997485f4b6d185c80b6c6e75

Specs for Array#[]= for beginless ranges

view details

Lillian Zhang

commit sha 803a688fa6eb50a1c341bd6255c14a6d48da4db7

Specs for Array#slice! for beginless ranges

view details

Lillian Zhang

commit sha 9d54e3ea0fc02461ff5f67e599e149725c34ab38

Specs for Array #fill and #values_at with beginless ranges

view details

Lillian Zhang

commit sha 64b349fae474ae784faacf3f6ff9c85a2fb2745f

Fix Range#bsearch specs with infinity bounds

view details

Lillian Zhang

commit sha 44371cd207ef10b826af2a341e3fe49c8f98f5e3

Specs for Range#bsearch on beginless ranges

view details

Lillian Zhang

commit sha 16205c71c85ba7c000bcfb4c9639cdbe994d889e

Implement Range#bsearch for beginless ranges

view details

Lillian Zhang

commit sha 692b60405db5916c701f92a3905f7fd9a9e4e8bc

Implement Range#inspect for beginless ranges Co-authored-by: Nicolas Laurent norswap@gmail.com

view details

Lillian Zhang

commit sha 6fd52623be912776add66b4ab8a8f8456e12851a

Array specs: replace Range.new with eval dot notation

view details

Lillian Zhang

commit sha 8c67f4a3672a9c30b510388b5858890eff8f7d5c

Specs for Range#{count, each, equal_value, first, inspect, max, min, size}

view details

Lillian Zhang

commit sha 9208aeba41cd585eb71ce82eeb3ad7617525c7f7

Implement Range#{count, size, first, max, min} for beginless ranges and internal beginless? predicate

view details

Lillian Zhang

commit sha 0458acc086de9da45d201008354075a4fc9c2fd1

Use Primitive.nil? instead of beginless? and endless?

view details

Lillian Zhang

commit sha d2c7dd7373d251bba3b9c968ab4ecb145a12b73c

Range#count spec fix: Range#count runs infinitely on endless ranges in 2.6

view details

Lillian Zhang

commit sha 7995bb5495d58783d6d3f11d25074af4e29afd3d

Array specs: remove extraneous nil during range creation

view details

Lillian Zhang

commit sha f7805255e1f50558b7b364d709ae1f7193af2861

Range#max spec version 2.7.2 -> 3.0

view details

Lillian Zhang

commit sha ea1542e53226c8344aa60eda4f5e100eb244fdf6

Remove Primitive.infect from Range#inspect

view details

push time in a day

push eventkholia/OSX-KVM

Dhiru Kholia

commit sha 801e6410b901609ca8208ae9d7d477fd97954c21

Batch Update 2 - November 2020 - Big Sur Stuff - Add makefile to build Big Sur recovery/full installer (nick) - Typo fixes (Gelma) - Simplify Big-Sur installation notes (ivy-rew) - Simplify Big-Sur installation notes (Broly1) - Simplify Big-Sur installation notes (mikkeyboi) - Xcode + OSX-KVM tutorial (ADawesomeguy) - Remove broken links (CyberShadow) - Expand "Docker on macOS " notes (mikehardy)

view details

push time in 2 days

push eventkholia/OSX-KVM

Dhiru Kholia

commit sha 23a6a9099d06cf2c99589882c7cc1804edc16720

Batch Update 2 - November 2020 - Big Sur Stuff - Add makefile to build Big Sur recovery/full installer (nick) - Typo fixes (Gelma) - Simplify Big-Sur installation notes (ivy-rew) - Simplify Big-Sur installation notes (Broly1) - Simplify Big-Sur installation notes (mikkeyboi) - Xcode + OSX-KVM tutorial (ADawesomeguy) - Remove broken links (CyberShadow) - Expand "Docker on macOS " notes (mikehardy)

view details

push time in 2 days

PR closed kholia/OSX-KVM

docs(notes): add info on passing "odd" core counts

This is required to pass through a 6-core/12-thread processor

worth noting that the existing -smp line in the boot script doesn't map the named variables into what I would expect is their proper argument, specifically there is a "threads" argument, and what is named CPU_THREADS right now is used for what is more like the total, and has to be passed as "maxcpus" in other configs to avoid an error where total smp count is greater than maxcpu count

Regardless, this proposed doc snippet is what I'm actually booting right now, and successfully melting my CPU with ;-)

Cheers

+675 -207

1 comment

12 changed files

mikehardy

pr closed time in 2 days

pull request commentkholia/OSX-KVM

docs(notes): add info on passing "odd" core counts

This was manually merged. Thanks! :+1:

mikehardy

comment created time in 2 days

push eventkholia/OSX-KVM

Dhiru Kholia

commit sha 2af94a97c4030223266844911338d8e6c81c2d32

Batch Update 2 - November 2020 - Big Sur Stuff - Add makefile to build Big Sur recovery/full installer (nick) - Typo fixes (Gelma) - Simplify Big-Sur installation notes (ivy-rew) - Simplify Big-Sur installation notes (Broly1) - Simplify Big-Sur installation notes (mikkeyboi) - Xcode + OSX-KVM tutorial (ADawesomeguy) - Remove broken links (CyberShadow) - Expand "Docker on macOS " notes (mikehardy)

view details

push time in 2 days

push eventkholia/OSX-KVM

Dhiru Kholia

commit sha 71d422804091d70b88c68c40c154bae59027d90f

Batch Update 2 - November 2020 - Big Sur Stuff - Add makefile to build Big Sur recovery/full installer (nick) - Typo fixes (Gelma) - Simplify Big-Sur installation notes (ivy-rew) - Simplify Big-Sur installation notes (Broly1) - Simplify Big-Sur installation notes (mikkeyboi) - Xcode + OSX-KVM tutorial (ADawesomeguy) - Remove broken links (CyberShadow) - Expand "Docker on macOS " notes (mikehardy)

view details

push time in 2 days

push eventkholia/OSX-KVM

Mike Hardy

commit sha 05ae440180400cc886daaebb25acbb6a725a4ff2

Expand "Docker" note to more general/practical nested virt section (#163) * Expand Docker section to general Nested Virtualization - Add some specifics on how to troubleshoot / verify nested virtualization functionality - Add a couple strategies to achieve nested virtualization, with links to background info for folks that need it - Add Android Emulator (a common case, even if available on the host) and generalize the section to all nested virtualization / hypervisor framework * docs(notes): fix typo in proposed change

view details

push time in 2 days

PR merged kholia/OSX-KVM

Expand "Docker" note to more general/practical nested virt section

Thank you tons for this project, it really helps me :bow:

One thing I always find myself doing when I make a fresh VM is struggling through getting the hypervisor framework lit up again, so I thought I would document it for myself for the future, and others might find it useful :-)

+14 -4

0 comment

1 changed file

mikehardy

pr closed time in 2 days

pull request commentkholia/OSX-KVM

Convert TXT Files to Markdown

Sorry if this was unclear 😬, but I only changed the TXT files to Markdown, but did not actually change the contents of the files themselves. However, if you would like me to I could change to networking guide itself before this is implemented. Thanks!

ADawesomeguy

comment created time in 2 days

fork timgaleckas/parlour

An RBI generator, merger and parser system for Sorbet

fork in 2 days

push eventServiceStack/ServiceStack

Demis Bellot

commit sha 6ac4bd1842c170f1569bb5aa1020a37c7bb4017d

Guard against NRE when feature not available Feature missing when hosted in AWS https://stackoverflow.com/q/64973401/85785

view details

push time in 2 days

PR opened kholia/OSX-KVM

docs(notes): add info on passing "odd" core counts

This is required to pass through a 6-core/12-thread processor

worth noting that the existing -smp line in the boot script doesn't map the named variables into what I would expect is their proper argument, specifically there is a "threads" argument, and what is named CPU_THREADS right now is used for what is more like the total, and has to be passed as "maxcpus" in other configs to avoid an error where total smp count is greater than maxcpu count

Regardless, this proposed doc snippet is what I'm actually booting right now, and successfully melting my CPU with ;-)

Cheers

+20 -0

0 comment

1 changed file

pr created time in 2 days

push eventoracle/truffleruby

Nicolas Laurent

commit sha af850f0358242059b688320c0f77b5b5343f6db3

flatten ConcatRope when taking its substring see comment in diff for more context

view details

Nicolas Laurent

commit sha b7796b9d4cc4d1216923348ce2c89c5e3251dd89

[GR-27582] Flatten ConcatRope when taking its substring. PullRequest: truffleruby/2185

view details

push time in 2 days

PR opened kholia/OSX-KVM

Expand "Docker" note to more general/practical nested virt section

Thank you tons for this project, it really helps me :bow:

One thing I always find myself doing when I make a fresh VM is struggling through getting the hypervisor framework lit up again, so I thought I would document it for myself for the future, and others might find it useful :-)

+14 -4

0 comment

1 changed file

pr created time in 2 days

more