{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/mosquitto/issues/278","repository_url":"https://api.github.com/repos/eclipse/mosquitto","labels_url":"https://api.github.com/repos/eclipse/mosquitto/issues/278/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/mosquitto/issues/278/comments","events_url":"https://api.github.com/repos/eclipse/mosquitto/issues/278/events","html_url":"https://github.com/eclipse/mosquitto/issues/278","id":179647072,"number":278,"title":"Running with a websockets listener mosquitto triggers a segfault in libwebsockets","user":{"login":"mtreinish","id":2447371,"avatar_url":"https://avatars.githubusercontent.com/u/2447371?v=3","gravatar_id":"","url":"https://api.github.com/users/mtreinish","html_url":"https://github.com/mtreinish","followers_url":"https://api.github.com/users/mtreinish/followers","following_url":"https://api.github.com/users/mtreinish/following{/other_user}","gists_url":"https://api.github.com/users/mtreinish/gists{/gist_id}","starred_url":"https://api.github.com/users/mtreinish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtreinish/subscriptions","organizations_url":"https://api.github.com/users/mtreinish/orgs","repos_url":"https://api.github.com/users/mtreinish/repos","events_url":"https://api.github.com/users/mtreinish/events{/privacy}","received_events_url":"https://api.github.com/users/mtreinish/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-09-27T23:59:35Z","updated_at":"2016-09-29T17:50:07Z","closed_at":null,"body":"I'm running mosquitto 1.4.8 (from the ubuntu xenial packages) and running with a websocket listener configured. After establishing a number of connections over the websocket port I eventually hit a segfault on mosquitto. I haven't found the exact trigger yet so I just establish a few hundred websocket subscribers at once and run a couple daemons to publish messages and just wait for it to crash.\r\n\r\nFrom dmesg I get:\r\n\r\nmosquitto[15317] general protection ip:7f096c270a29 sp:7ffdac0c6530 error:0 in libwebsockets.so.7[7f096c268000+1f000]\r\n\r\nand running it under gdb shows:\r\n\r\n```\r\n#0  0x00007ffff69fa072 in ?? () from /usr/lib/x86_64-linux-gnu/libwebsockets.so.7\r\n#1  0x00007ffff69ee072 in lws_callback_on_writable () from /usr/lib/x86_64-linux-gnu/libwebsockets.so.7\r\n#2  0x0000000000412b74 in _mosquitto_packet_queue (mosq=<optimized out>, packet=<optimized out>) at ../lib/net_mosq.c:169\r\n#3  0x0000000000418d97 in _mosquitto_send_real_publish (mosq=<optimized out>, mid=<optimized out>, topic=<optimized out>, payloadlen=<optimized out>, payload=0x0, qos=<optimized out>, retain=false, dup=false) at ../lib/send_mosq.c:281\r\n#4  0x0000000000418fc3 in _mosquitto_send_publish (mosq=mosq@entry=0xab9530, mid=<optimized out>, topic=0x9412a0 \"gerrit/openstack/neutron/ref-replicated\", payloadlen=184, payload=0xbb3970, qos=0, retain=false, dup=false) at ../lib/send_mosq.c:176\r\n#5  0x000000000040cc9c in mqtt3_db_message_write (db=0x6268e0 <int_db>, context=0xab9530) at database.c:848\r\n#6  0x0000000000419b04 in _subs_process (db=db@entry=0x6268e0 <int_db>, hier=hier@entry=0x66a5c0, source_id=source_id@entry=0x800760 \"paho/34D87591DAA2E0874A\", topic=<optimized out>, topic@entry=0x647ee0 \"gerrit/openstack/neutron/ref-replicated\", qos=qos@entry=0, retain=retain@entry=0, stored=0x7a6bc0, set_retain=false) at subs.c:135\r\n#7  0x0000000000419d23 in _sub_search (db=db@entry=0x6268e0 <int_db>, subhier=subhier@entry=0x66a6e0, tokens=0xaba2a0, source_id=source_id@entry=0x800760 \"paho/34D87591DAA2E0874A\", topic=topic@entry=0x647ee0 \"gerrit/openstack/neutron/ref-replicated\", qos=qos@entry=0, retain=0, stored=0x7a6bc0, set_retain=true) at subs.c:422\r\n#8  0x0000000000419c6f in _sub_search (db=db@entry=0x6268e0 <int_db>, subhier=subhier@entry=0x645120, tokens=tokens@entry=0x7d5370, source_id=source_id@entry=0x800760 \"paho/34D87591DAA2E0874A\", topic=topic@entry=0x647ee0 \"gerrit/openstack/neutron/ref-replicated\", qos=qos@entry=0, retain=0, stored=0x7a6bc0, set_retain=true) at subs.c:413\r\n#9  0x000000000041a336 in mqtt3_db_messages_queue (db=db@entry=0x6268e0 <int_db>, source_id=0x800760 \"paho/34D87591DAA2E0874A\", topic=0x647ee0 \"gerrit/openstack/neutron/ref-replicated\", qos=qos@entry=0, retain=retain@entry=0, stored=stored@entry=0x7fffffffdd10) at subs.c:533\r\n#10 0x0000000000413cad in mqtt3_handle_publish (db=0x6268e0 <int_db>, context=0xa1e630) at read_handle.c:233\r\n#11 0x0000000000412d79 in _mosquitto_packet_read (db=db@entry=0x6268e0 <int_db>, mosq=mosq@entry=0xa1e630) at ../lib/net_mosq.c:1035\r\n#12 0x000000000040e0f9 in loop_handle_reads_writes (pollfds=0x660320, db=0x6268e0 <int_db>) at loop.c:493\r\n#13 mosquitto_main_loop (db=db@entry=0x6268e0 <int_db>, listensock=listensock@entry=0x6455e0, listensock_count=listensock_count@entry=2, listener_max=listener_max@entry=5) at loop.c:326\r\n#14 0x0000000000404ab6 in main (argc=<optimized out>, argv=<optimized out>) at mosquitto.c:382\r\n```\r\n\r\nThe libwebsockets version installed is 1.7.1 (also from the ubuntu xenial package)"},"comment":{"url":"https://api.github.com/repos/eclipse/mosquitto/issues/comments/250540957","html_url":"https://github.com/eclipse/mosquitto/issues/278#issuecomment-250540957","issue_url":"https://api.github.com/repos/eclipse/mosquitto/issues/278","id":250540957,"user":{"login":"ralight","id":79578,"avatar_url":"https://avatars.githubusercontent.com/u/79578?v=3","gravatar_id":"","url":"https://api.github.com/users/ralight","html_url":"https://github.com/ralight","followers_url":"https://api.github.com/users/ralight/followers","following_url":"https://api.github.com/users/ralight/following{/other_user}","gists_url":"https://api.github.com/users/ralight/gists{/gist_id}","starred_url":"https://api.github.com/users/ralight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralight/subscriptions","organizations_url":"https://api.github.com/users/ralight/orgs","repos_url":"https://api.github.com/users/ralight/repos","events_url":"https://api.github.com/users/ralight/events{/privacy}","received_events_url":"https://api.github.com/users/ralight/received_events","type":"User","site_admin":false},"created_at":"2016-09-29T17:50:07Z","updated_at":"2016-09-29T17:50:07Z","body":"Ok, that's good at least. I propose that we leave this open for the moment and I'll try and reproduce and narrow the problem down.\r\n\r\nThanks for the code!"}}
{"actor":{"display_login":"ralight"}}