Skip to content

Instantly share code, notes, and snippets.

@mgdm
Created July 8, 2015 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgdm/667172cad4c87b8007b1 to your computer and use it in GitHub Desktop.
Save mgdm/667172cad4c87b8007b1 to your computer and use it in GitHub Desktop.
Websockets HTTP server crash
michael@ns360722:~% gdb mosquitto core 13:24:44
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from mosquitto...Reading symbols from /usr/lib/debug/.build-id/a5/b0da0c6554f86d5c69791356e56196ca628086.debug...done.
done.
[New LWP 317]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/sbin/mosquitto -v -c /etc/mosquitto/mosquitto.conf'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 callback_http (context=0x9696f0, wsi=0x970220, user=0x0, in=<optimised out>, len=<optimised out>, reason=<optimised out>) at websockets.c:437
437 websockets.c: No such file or directory.
(gdb) bt full
#0 callback_http (context=0x9696f0, wsi=0x970220, user=0x0, in=<optimised out>, len=<optimised out>, reason=<optimised out>) at websockets.c:437
hack = <optimised out>
http_dir = <optimised out>
buflen = <optimised out>
slen = 32
filename = 0x963d40 "/opt/mosquitto-http/index.html"
buf = '\000' <repeats 1272 times>...
filestat = {st_dev = 0, st_ino = 0, st_nlink = 0, st_mode = 0, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 0, st_blocks = 0, st_atim = {tv_sec = 0, tv_nsec = 0}, st_mtim = {tv_sec = 0, tv_nsec = 0}, st_ctim = {tv_sec = 0,
tv_nsec = 0}, __glibc_reserved = {0, 0, 0}}
#1 0x00007f4cd614c1a7 in libwebsocket_read (context=context@entry=0x9696f0, wsi=wsi@entry=0x970220, buf=<optimised out>,
buf@entry=0x969c20 "GET /index.html HTTP/1.1\r\nHost: taransay.mgdm.net:1884\r\nConnection: keep-alive\r\nCache-Control: max-age=0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\nUser-Agent"..., len=397) at handshake.c:124
n = 0
#2 0x00007f4cd6150566 in lws_server_socket_service (context=context@entry=0x9696f0, wsi=wsi@entry=0x970220, pollfd=pollfd@entry=0x96ac88) at server.c:180
new_wsi = <optimised out>
accept_fd = <optimised out>
clilen = 16
cli_addr = {sin_family = 2, sin_port = 43101, sin_addr = {s_addr = 4047194562}, sin_zero = "\000\000\000\000\000\000\000"}
n = <optimised out>
len = <optimised out>
m = <optimised out>
bio = <optimised out>
#3 0x00007f4cd6149e1e in libwebsocket_service_fd (context=context@entry=0x9696f0, pollfd=0x96ac88) at libwebsockets.c:922
wsi = 0x970220
n = <optimised out>
m = <optimised out>
listen_socket_fds_index = <optimised out>
tv = {tv_sec = 1436354576, tv_usec = 990239}
more = 1
eff_buf = {token = 0x2 <error: Cannot access memory at address 0x2>, token_len = 6445216}
#4 0x00007f4cd614a024 in libwebsocket_service (context=0x9696f0, timeout_ms=timeout_ms@entry=0) at libwebsockets.c:1220
n = 1
#5 0x000000000040e0bb in mosquitto_main_loop (db=db@entry=0x6258a0 <int_db>, listensock=listensock@entry=0x967760, listensock_count=listensock_count@entry=2, listener_max=listener_max@entry=6) at loop.c:374
start_time = 10397
last_backup = 10397
now = <optimised out>
now_time = <optimised out>
time_count = <optimised out>
context = <optimised out>
ctxt_tmp = <optimised out>
sigblock = {__val = {2, 0 <repeats 15 times>}}
origsig = {__val = {0, 6, 139967985911200, 4096, 1, 139968008508704, 139968008507848, 139968006306193, 0, 139968008455992, 7738151124464566273, 0, 1, 139968008507848, 4294967420, 9858384}}
i = 0
pollfds = 0x962900
pollfd_count = 2
pollfd_index = 2
bridge_sock = 0
rc = <optimised out>
context_count = <optimised out>
expiration_check_time = 0
id = <optimised out>
#6 0x0000000000404a58 in main (argc=<optimised out>, argv=<optimised out>) at mosquitto.c:366
listensock = 0x967760
listensock_count = 2
listensock_index = <optimised out>
config = {config_file = 0x957a90 "/etc/mosquitto/mosquitto.conf", acl_file = 0x0, allow_anonymous = true, allow_duplicate_messages = false, allow_zero_length_clientid = true, auto_id_prefix = 0x0, auto_id_prefix_len = 0, autosave_interval = 1800,
autosave_on_changes = false, clientid_prefixes = 0x0, connection_messages = true, daemon = false, default_listener = {fd = 0, host = 0x0, port = 1883, max_connections = -1, mount_point = 0x0, socks = 0x0, sock_count = 0, client_count = 0, protocol = mp_mqtt,
use_username_as_clientid = false, cafile = 0x0, capath = 0x0, certfile = 0x0, keyfile = 0x0, ciphers = 0x0, psk_hint = 0x0, require_certificate = false, ssl_ctx = 0x0, crlfile = 0x0, use_identity_as_username = false, tls_version = 0x0, ws_context = 0x0,
http_dir = 0x0, ws_protocol = 0x0}, listeners = 0x95fe00, listener_count = 2, log_dest = 2, log_facility = 24, log_type = 2147483647, log_timestamp = true, log_file = 0x957d40 "/var/log/mosquitto/mosquitto.log", log_fptr = 0x0, message_size_limit = 0,
password_file = 0x0, persistence = true, persistence_location = 0x957d20 "/var/lib/mosquitto/", persistence_file = 0x95fde0 "mosquitto.db", persistence_filepath = 0x95fdb0 "/var/lib/mosquitto/mosquitto.db", persistent_client_expiration = 0,
pid_file = 0x957d00 "/var/run/mosquitto.pid", psk_file = 0x0, queue_qos0_messages = false, retry_interval = 20, sys_interval = 10, upgrade_outgoing_qos = false, user = 0x41d7c7 "mosquitto", verbose = true, websockets_log_level = 0,
have_websockets_listener = true, bridges = 0x0, bridge_count = 0, auth_plugin = 0x0, auth_options = 0x0, auth_option_count = 0}
buf = "Mon, 18 May 2015 15:25:19 +0100\000\000\000\000\000\000\000\000\000xsl\327L\177\000\000\000\220l\327L\177\000\000|\027K\327L\177\000\000x\r\331\325L\177\000\000 \024K\327L\177\000\000\000\000\000\000\001\000\000\000\242\b\000\000\001\000\000\000`|\352\\\374\177\000\000P~\352\\\374\177\000\000\220}\352\\\374\177\000\000xsl\327L\177\000\000\001\000\000\000\000\000\000\000 Um\327L\177\000\000\370Im\327L\177\000\000\221\271K\327L\177\000\000\000\000\000\000\000\000\000\000xsl\327L\177\000\000\001\000\000\000\374\177\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"...
i = 0
j = <optimised out>
pid = <optimised out>
listener_max = 6
rc = <optimised out>
err = "Mon, 18 May 2015 15:25:19 +0100\000\000\000\000\000\000\000\000\000xsl\327L\177\000\000\000\220l\327L\177\000\000|\027K\327L\177\000\000x\r\331\325L\177\000\000 \024K\327L\177\000\000\000\000\000\000\001\000\000\000\242\b\000\000\001\000\000\000`|\352\\\374\177\000\000P~\352\\\374\177\000\000\220}\352\\\374\177\000\000xsl\327L\177\000\000\001\000\000\000\000\000\000\000 Um\327L\177\000\000\370Im\327L\177\000\000\221\271K\327L\177\000\000\000\000\000\000\000\000\000\000xsl\327L\177\000\000\001\000\000\000\374\177\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"...
tv = {tv_sec = 1436354575, tv_usec = 353552}
ctxt = <optimised out>
ctxt_tmp = <optimised out>
(gdb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment