Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not connected with TLS (Centos 7) #22

Open
zaharinea opened this issue Aug 24, 2018 · 1 comment
Open

Not connected with TLS (Centos 7) #22

zaharinea opened this issue Aug 24, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@zaharinea
Copy link

Version:

CentOS Linux release 7.4.1708 (Core)
mosquitto  1.4.15-2.el7
tarantool  1.9.1.72-1 or tarantool  1.7.6.25-1
tarantool/mqtt 	1.2.1 from https://raw.githubusercontent.com/tarantool/mqtt/master/rockspecs/mqtt-scm-1.rockspec

Code:

log = require('log')
mqtt = require('mqtt')

function on_message(message_id, topic, payload, gos, retain)
    log.info('New message: message_id=%s topic=%s gos=%s retain=%s payload=%s',
            message_id, topic, gos, retain, payload)
end

connection = mqtt.new("gateway_mqtt", true)
ok, err = connection:login_set('admin', 'admin')
log.info("login_set ok=%s, err=%s", ok, err)
ok, err = connection:tls_insecure_set(true)
log.info("tls_insecure_set ok=%s, err=%s", ok, err)
ok, err = connection:tls_set('ca.crt')
log.info("tls_set ok=%s, err=%s", ok, err)
ok, err = connection:connect({
        host = "127.0.0.1",
        port = 8883,
        keepalive = 60,
        log_mask=mqtt.LOG_DEBUG,
        auto_reconect = true,
    })
log.info("connect ok=%s, err=%s", ok, err)
ok, err = connection:subscribe('xxxxxx', 1)
log.info("subscribe ok=%s, err=%s", ok, err)
ok, err = connection:on_message(on_message)
log.info("on_message ok=%s, err=%s", ok, err)

log tarantool:

2018-08-23 18:33:32.938 [2982] main/101/app_mqtt I> app "app_mqtt" init
2018-08-23 18:33:32.938 [2982] main/101/app_mqtt I> login_set ok=true, err=ok
2018-08-23 18:33:32.938 [2982] main/101/app_mqtt I> tls_insecure_set ok=true, err=ok
2018-08-23 18:33:32.938 [2982] main/101/app_mqtt I> tls_set ok=true, err=ok
2018-08-23 18:33:32.938 [2982] main/108/lua I> Not connected to mqtt broker. Try connect
tarantool> 2018-08-23 18:33:32.939 [2982] main/108/lua I> connect ok=true, err=ok
2018-08-23 18:33:32.939 [2982] main/108/lua I> subscribe ok=true, err=1
2018-08-23 18:33:32.939 [2982] main/101/app_mqtt I> on_message ok=true, err=ok

log mosquitto:

1535036941: New connection from 127.0.0.1 on port 8883.

after publish message to topic 'xxxxxx'

log tarantool:

2018-08-23 18:33:32.938 [2982] main/108/lua I> Not connected to mqtt broker. Try connect
tarantool> 2018-08-23 18:33:32.939 [2982] main/108/lua I> connect ok=true, err=ok
2018-08-23 18:33:32.939 [2982] main/108/lua I> subscribe ok=true, err=1
2018-08-23 18:33:32.939 [2982] main/101/app_mqtt I> on_message ok=true, err=ok
2018-08-23 18:34:32.596 [2982] main/109/lua utils.c:923 E> LuajitError: ./.rocks/share/lua/5.1/mqtt/init.lua:93: assign to undeclared variable '_'
2018-08-23 18:34:33.033 [2982] main/108/lua I> Not connected to mqtt broker. Try connect
2018-08-23 18:34:33.034 [2982] main/108/lua I> connect ok=true, err=ok
2018-08-23 18:34:33.034 [2982] main/108/lua I> subscribe ok=true, err=2
2018-08-23 18:35:32.267 [2982] main/110/lua utils.c:923 E> LuajitError: ./.rocks/share/lua/5.1/mqtt/init.lua:93: assign to undeclared variable '_'
2018-08-23 18:35:33.110 [2982] main/108/lua I> Not connected to mqtt broker. Try connect
2018-08-23 18:35:33.111 [2982] main/108/lua I> connect ok=true, err=ok
2018-08-23 18:35:33.111 [2982] main/108/lua I> subscribe ok=true, err=3

log mosquitto:

1535036947: New connection from 10.13.0.134 on port 8883.
1535036947: New client connected from 10.13.0.134 as mosqpub|10578-xxx (c1, k60, u'admin').
1535036947: Sending CONNACK to mosqpub|10578-xxx (0, 0)
1535036947: Received PUBLISH from mosqpub|10578-xxx (d0, q1, r0, m1, 'xxxxxx', ... (2 bytes))
1535036947: Sending PUBACK to mosqpub|10578-xxx (Mid: 1)
1535036947: Received DISCONNECT from mosqpub|10578-xxx
1535036947: Client mosqpub|10578-xxx disconnected.
1535037001: Socket error on client <unknown>, disconnecting.
1535037001: New connection from 127.0.0.1 on port 8883.
1535037006: Socket error on client <unknown>, disconnecting.
1535037006: New connection from 127.0.0.1 on port 8883.
1535037066: Socket error on client <unknown>, disconnecting.
1535037066: New connection from 127.0.0.1 on port 8883.
1535037071: Socket error on client <unknown>, disconnecting.

log install tarantool/mqtt:

[app_mqtt] Installed dep: https://raw.githubusercontent.com/moonlibs/package-reload/master/package.reload-scm-1.rockspec
Using https://raw.githubusercontent.com/tarantool/mqtt/master/rockspecs/mqtt-scm-1.rockspec... switching to 'build' mode
Cloning into 'mqtt'...
remote: Counting objects: 43, done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 43 (delta 4), reused 18 (delta 1), pack-reused 0
Receiving objects: 100% (43/43), 24.45 KiB | 0 bytes/s, done.
Resolving deltas: 100% (4/4), done.
-- The C compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found TARANTOOL: /usr/include (found version "1.9.1-72-gdcac64a") 
-- Tarantool LUADIR is /tmp/xxx/app_mqtt/.rocks/lib64/luarocks/rocks/mqtt/scm-1/lua
-- Tarantool LIBDIR is /tmp/xxx/app_mqtt/.rocks/lib64/luarocks/rocks/mqtt/scm-1/lib
-- Found MOSQUITTO: /usr/lib64/libmosquitto.so  
-- libmosquitto include dir: /usr/include
-- libmosquitto: /usr/lib64/libmosquitto.so
-- tarantool: /usr/include;/usr/include/tarantool
-- libmosquitto:  /usr/lib64/libmosquitto.so
-- /usr/lib64/libmosquitto.so
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks
gmake[1]: Вход в каталог `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
gmake[2]: Вход в каталог `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
gmake[3]: Вход в каталог `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
Scanning dependencies of target driver
gmake[3]: Выход из каталога `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
gmake[3]: Вход в каталог `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
[100%] Building C object mqtt/CMakeFiles/driver.dir/driver.c.o
Linking C shared library driver.so
gmake[3]: Выход из каталога `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
[100%] Built target driver
gmake[2]: Выход из каталога `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
gmake[1]: Выход из каталога `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
gmake[1]: Вход в каталог `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
gmake[2]: Вход в каталог `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
gmake[3]: Вход в каталог `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
gmake[3]: Выход из каталога `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
[100%] Built target driver
gmake[2]: Выход из каталога `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /tmp/xxx/app_mqtt/.rocks/lib64/luarocks/rocks/mqtt/scm-1/lib/mqtt/driver.so
-- Installing: /tmp/xxx/app_mqtt/.rocks/lib64/luarocks/rocks/mqtt/scm-1/lua/mqtt/init.lua
gmake[1]: Выход из каталога `/tmp/luarocks_mqtt-scm-1-3157/mqtt/build.luarocks'
Updating manifest for /tmp/xxx/app_mqtt/./.rocks/lib64/luarocks/rocks
mqtt scm-1 is now built and installed in /tmp/xxx/app_mqtt/./.rocks (license: BSD)

['luarocks', 'install', '--tree=./.rocks', 'https://raw.githubusercontent.com/tarantool/mqtt/master/rockspecs/mqtt-scm-1.rockspec'] finished
[app_mqtt] Installed dep: https://raw.githubusercontent.com/tarantool/mqtt/master/rockspecs/mqtt-scm-1.rockspec

@dedok dedok self-assigned this Nov 23, 2018
@dedok dedok added the bug Something isn't working label Nov 23, 2018
@dedok
Copy link
Contributor

dedok commented Nov 23, 2018

I can reproduce it. But I can't reproduce it on Debian/OSX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants