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

MQTT-SN Gateway crashing when enabling QoS-1 with the error "Max number of Clients" #263

Open
bySimpson opened this issue Aug 18, 2022 · 2 comments

Comments

@bySimpson
Copy link

Hi!

I am currently having some problems setting up the MQTT-SN Gateway (UDP mode). It is working fine as long as I am not enabling the QoS-1 mode in the gateway.conf file.
image

I am currently using the following configuration:
gateway.conf:

#**************************************************************************
# Copyright (c) 2016-2021, Tomoaki Yamaguchi
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v1.0 which accompany this distribution.
#
# The Eclipse Public License is available at
#    http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
#   http://www.eclipse.org/org/documents/edl-v10.php.
#***************************************************************************
#
# config file of MQTT-SN Gateway
#

GatewayID=1
GatewayName=MQTTSNBridge
MaxNumberOfClients=30
KeepAlive=60
#LoginID=your_ID
#Password=your_Password

BrokerName=mosquitto
BrokerPortNo=1883
BrokerSecurePortNo=8883

#
# CertsKey for TLS connections to a broker
#

#RootCAfile=/etc/ssl/certs/ca-certificates.crt
#RootCApath=/etc/ssl/certs/
#CertKey=/path/to/certKey.pem
#PrivateKey=/path/to/privateKey.pem

#
# When AggregatingGateway=YES or ClientAuthentication=YES,
# All clients must be specified by the ClientList File  
#

AggregatingGateway=NO
QoS-1=YES
Forwarder=NO
PredefinedTopic=YES
ClientAuthentication=NO
ClientsList=/etc/paho/clients.conf
PredefinedTopicList=/etc/paho/predefinedTopic.conf


#==============================
#  SensorNetworks parameters
#==============================
#
# UDP | DTLS 
# 

GatewayPortNo=10000
MulticastPortNo=1883
MulticastIP=225.1.1.1
MulticastTTL=1

#
# UDP6 | DTLS6
#

GatewayIPv6PortNo=10000
MulticastIPv6PortNo=1883
MulticastIPv6=ff1e:feed:caca:dead::1
MulticastIPv6If=wlp4s0
MulticastHops=1

#
# DTLS | DTLS6  
#

#DtlsCertsKey=/etc/ssl/certs/gateway.pem
#DtlsPrivKey=/etc/ssl/private/privkey.pem

#
# XBee
#

#Baudrate=38400
#SerialDevice=/dev/ttyUSB0
#ApiMode=2

#
# LoRaLink
#

#BaudrateLoRaLink=115200
#DeviceRxLoRaLink=/dev/loralinkRx
#DeviceTxLoRaLink=/dev/loralinkTx

#
# Bluetooth RFCOMM
#

#RFCOMMAddress=60:57:18:06:8B:72.*

#
# LOG
#

ShearedMemory=NO


And this is the clients.conf file that I am currently using (Note that I am using a dummy IP address and this one will not be the final one)

#***********************************************************************
# Copyright (c) 2016, Tomoaki Yamaguchi
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v1.0 which accompany this distribution.
#
# The Eclipse Public License is available at
#    http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
#   http://www.eclipse.org/org/documents/edl-v10.php.
#***********************************************************************
#
# File format is:
#     Lines bigning with # are comment line.
#     ClientId, SensorNetAddress, "unstableLine", "secureConnection"
#     in case of UDP, SensorNetAddress format is IPAddress: port no.
#     if the SensorNetwork is not stable, specify "unstableLine".
#     if Broker's Connection is TLS, specify "secureConnection".
#     if the client is a forwarder,specify "forwarder".
#     if the client send PUBLISH QoS-1, specify "QoS-1".
#
# Ex:
#     #Client List
#     ClientId1,192.168.10.10:11200
#     ClientID2,192.168.50.200:35000,unstableLine
#     ClientID3,192.168.200.50:40000,secureConnection
#     ClientID4,192.168.200.52:41000,unstableLine,secureConnection
#     ClientID5,192.168.200.53:41000,unstableLine,secureConnection,QoS-1 
#     ClientID6,192.168.200.54:41000,unstableLine,secureConnection,forwarder
#
# SensorNetwork address format is defined by SensorNetAddress::setAddress(string* data) function.
#
# UDP6 (IPv6 UDP) [IPv6 address]:PortNo
# RFCOMM          Device_address.channel (1-30)
# XBee            FFFFFFFFFFFFFFFF 8bytes Hex
# LoRaLink        1-254 
#
#
# This is a sample of UDP. 
#
# REWRITE ALL ACCORDING TO YOUR CLIENTS.
#

#GatewayTester, 172.16.1.11:20020
#ClientPUB,172.16.1.11:2010
#Client01,172.16.1.11:12001
#Client02,172.16.1.11:12002
#Client03,172.16.1.11:13003

QoS-1_Client01,172.16.1.11:20001,QoS-1
# QoS-1_Client02,172.16.1.11:20002,QoS-1
# QoS-1_Client03,172.16.1.11:20003,QoS-1
# host.docker.internal
#Client,1.1.1.1:20001,unstableLine,QoS-1
# Forwarder01,172.16.1.11:22002,forwarder
# Forwarder01,172.16.1.11:22002,forwarder
# Forwarder02,172.16.1.11:22003,forwarder
# Forwarder03,172.16.1.11:22004,forwarder

The gateway is currently running in a docker container, but it also isn't working if I try to run it without docker. This is the Dockerfile I am currently using:

FROM alpine as builder
WORKDIR /usr/bin/app
RUN apk add git alpine-sdk bash cmake openssl-dev
RUN git clone https://github.com/eclipse/paho.mqtt-sn.embedded-c
RUN cd paho.mqtt-sn.embedded-c/MQTTSNGateway && \
    ./build.sh udp -DDEBUG_NW -DDEBUG_MQTTSN

FROM alpine as runner
WORKDIR /etc/paho
# RUN apk add alpine-sdk
RUN apk add --no-cache libgcc libstdc++ coreutils
COPY --from=builder /usr/local/lib /usr/local/lib
COPY --from=builder /usr/bin/app/paho.mqtt-sn.embedded-c/MQTTSNGateway/bin/ /etc/paho/
COPY --from=builder /usr/bin/app/paho.mqtt-sn.embedded-c/build.gateway/MQTTSNPacket/src/libMQTTSNPacket.so /lib
ENTRYPOINT [ "stdbuf", "-oL", "/etc/paho/MQTT-SNGateway"]
@HpLightcorner
Copy link

@ty4tw - any thoughts on that?

@trivialkettle
Copy link

Same problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants