tarantool / mqtt

Tarantool MQTT client
tarantool.org
BSD 2-Clause "Simplified" License
39 stars 10 forks source link

Cartridge segmentation fault when using "mqtt" module #45

Open vsier opened 2 years ago

vsier commented 2 years ago

Description

The mqtt module produces segmentation fault on a Cartridge cluster after the callback in on_message is invoked some number of times.

Steps to reproduce

  1. Install mqtt module to a cartridge app
  2. Connect to an instance through tarantoolctl connect
  3. Set mqtt broker's address and port in console:
    host_addr = <address>
    host_port = <port>
  4. Execute following lines:
    mqtt = require('mqtt'); log = require('log'); fiber = require('fiber')
    connection = mqtt.new('test-client', true)
    connection:connect({ host = host_addr, port = host_port })
    connection:on_message(function(...) log.warn{...} end)
    connection:subscribe('test')
    while true do connection:publish('test', 'testing testing testing'); fiber.sleep(2) end

After awhile this will produce a segmentation fault.

Segmentation fault

Segmentation fault
  code: SEGV_MAPERR
  addr: 0xc02ca91
  context: 0x7f5d503ff980
  siginfo: 0x7f5d503ffab0
  rax      0xc02ca91          201509521
  rbx      0x41a37ec0         1101233856
  rcx      0x10784a0          17269920
  rdx      0x27               39
  rsi      0xffffd8f0         4294957296
  rdi      0x41a37ec0         1101233856
  rsp      0x7f5d503ffdc0     140038755057088
  rbp      0x10784c8          17269960
  r8       0x27               39
  r9       0x4d5adcc461d      5315790390813
  r10      0x1529658cb8124a   5956490640233034
  r11      0x1                1
  r12      0x1051838          17111096
  r13      0x7f5d503ffe08     140038755057160
  r14      0x4132c080         1093845120
  r15      0x7f5d84145710     140039624611600
  rip      0x61c78c           6408076
  eflags   0x10202            66050
  cs       0x33               51
  gs       0x0                0
  fs       0x0                0
  cr2      0xc02ca91          201509521
  err      0x4                4
  oldmask  0x0                0
  trapno   0xe                14
Current time: 1651160523
Please file a bug at http://github.com/tarantool/tarantool/issues
Attempting backtrace... Note: since the server has already crashed, 
this may fail as well
#0  0x5ebfb2 in crash_signal_cb+92
tarantool/tarantool#1  0x7f5d86180730 in funlockfile+50
tarantool/tarantool#2  0x61c78c in lua_rawgeti+c
tarantool/tarantool#3  0x7f5d841449d0 in mosq_message_f+30
tarantool/tarantool#4  0x7f5d84150274 in handle__publish+234
tarantool/tarantool#5  0x7f5d8414b61e in packet__read+16e
tarantool/tarantool#6  0x7f5d84147285 in mosquitto_loop_read+c5
tarantool/tarantool#7  0x7f5d841458fc in mosq_io_run_one+1ec
tarantool/tarantool#8  0x656beb in lj_BC_FUNCC+34
tarantool/tarantool#9  0x61d0b8 in lua_pcall+78
tarantool/tarantool#10 0x5d5b33 in luaT_call+13
tarantool/tarantool#11 0x5d0b65 in lua_fiber_run_f+55
tarantool/tarantool#12 0x4563fc in _ZL16fiber_cxx_invokePFiP13__va_list_tagES0_+c
tarantool/tarantool#13 0x5f2d70 in fiber_loop+30
tarantool/tarantool#14 0x7fe19f in coro_init+3f