chirpstack / chirpstack-concentratord

Concentrator HAL daemon for LoRa gateways.
https://www.chirpstack.io/
MIT License
76 stars 53 forks source link

Crash when receiving configuration command? #114

Closed cyclops1982 closed 5 months ago

cyclops1982 commented 11 months ago

What happened?

chirpstack-concentratord-sx1302 crashes stops/crashes when it receives a 'Configuration' command.

What did you expect?

That it keeps running :)

Steps to reproduce this issue

I've installed the chirpstack-concentratord-sx1302 and the mqtt forwarder. I've linked these two together (config's below). My docker deployed chirpstack is on another machine, so the mqtt forwarder connects to that.

It seems that on update from chirpstack, a configuration is passed along to the concentrator and then it crashes.

Could you share your log output?

mqtt.log crash.log

Your Environment

forwarder.toml:

# Logging settings.
[logging]

  # Log level.
  #
  # Valid options are:
  #   * TRACE
  #   * DEBUG
  #   * INFO
  #   * WARN
  #   * ERROR
  #   * OFF
  level="DEBUG"

  # Log to syslog.
  #
  # If set to true, log messages are being written to syslog instead of stdout.
  log_to_syslog=false

# MQTT settings.
[mqtt]

  # Topic prefix.
  #
  # ChirpStack MQTT Forwarder publishes to the following topics:
  #
  #  * [Prefix/]gateway/[Gateway ID]/event/[Event]
  #  * [Prefix/]gateway/[Gateway ID]/state/[State]
  #
  # And subscribes to the following topic:
  #
  #  * [Prefix/]gateway/[Gateway ID]/command/[Command]
  #
  # The topic prefix can be used to define the region of the gateway.
  # Note, there is no need to add a trailing '/' to the prefix. The trailing
  # '/' is automatically added to the prefix if it is configured.
  topic_prefix="eu868"

  # Use JSON encoding instead of Protobuf (binary).
  #
  # Note, only use this for debugging purposes.
  json=false

  # MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
  server="tcp://jubilee.lnd.prof-x.net:1883"

  # Connect with the given username (optional)
  username=""

  # Connect with the given password (optional)
  password=""

  # Quality of service level
  #
  # 0: at most once
  # 1: at least once
  # 2: exactly once
  #
  # Note: an increase of this value will decrease the performance.
  # For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
  qos=0

  # Clean session
  #
  # Set the "clean session" flag in the connect message when this client
  # connects to an MQTT broker. By setting this flag you are indicating
  # that no messages saved by the broker for this client should be delivered.
  clean_session=false

  # Client ID
  #
  # Set the client id to be used by this client when connecting to the MQTT
  # broker. A client id must be no longer than 23 characters. If left blank,
  # a random id will be generated by ChirpStack.
  client_id=""

  # CA certificate file (optional)
  #
  # Use this when setting up a secure connection (when server uses ssl://...)
  # but the certificate used by the server is not trusted by any CA certificate
  # on the server (e.g. when self generated).
  ca_cert=""

  # TLS certificate file (optional)
  tls_cert=""

  # TLS key file (optional)
  tls_key=""

# Backend configuration.
[backend]

  # Enabled backend.
  #
  # Set this to the backend that must be used by the ChirpStack MQTT Forwarder.
  # Valid options are:
  #   * concentratord
  #   * semtech_udp
  enabled="concentratord"

  # Filters.
  [backend.filters]

    # Forward CRC ok.
    forward_crc_ok=true

    # Forward CRC invalid.
    forward_crc_invalid=true

    # Forward CRC missing.
    forward_crc_missing=true

    # DevAddr prefix filters.
    #
    # Example configuration:
    # dev_addr_prefixes=["0000ff00/24"]
    #
    # The above filter means that the 24MSB of 0000ff00 will be used to
    # filter DevAddrs. Uplinks with DevAddrs that do not match any of the
    # configured filters will not be forwarded. Leaving this option empty
    # disables filtering on DevAddr.
    dev_addr_prefixes=[
    ]

    # JoinEUI prefix filters.
    #
    # Example configuration:
    # join_eui_prefixes=["0000ff0000000000/24"]
    #
    # The above filter means that the 24MSB of 0000ff0000000000 will be used
    # to filter JoinEUIs. Uplinks with JoinEUIs that do not match any of the
    # configured filters will not be forwarded. Leaving this option empty
    # disables filtering on JoinEUI.
    join_eui_prefixes=[
    ]

  # ChirpStack Concentratord backend configuration.
  [backend.concentratord]

    # Event API URL.
    event_url="ipc:///tmp/concentratord_event"

    # Command API URL.
    command_url="ipc:///tmp/concentratord_command"

  # Semtech UDP backend configuration.
  [backend.semtech_udp]

    # ip:port to bind the UDP listener to.
    #
    # Example: 0.0.0.0:1700 to listen on port 1700 for all network interfaces.
    # This is the listener to which the packet-forwarder forwards its data
    # so make sure the 'serv_port_up' and 'serv_port_down' from your
    # packet-forwarder matches this port.
    bind="0.0.0.0:1700"

    # Time fallback.
    #
    # In case the UDP packet-forwarder does not set the 'time' field, then the
    # server-time will be used as fallback if this option is enabled.
    time_fallback_enabled=false

# Gateway metadata configuration.
[metadata]

  # Static key / value metadata.
  [metadata.static]

    # Example:
    # serial_number="1234"

  # Commands returning metadata.
  [metadata.commands]

    # Example:
    # datetime=["date", "-R"]

# Executable commands.
[commands]

  # Example:
  # reboot=["/usr/bin/reboot"]

Concentrator.toml:

# Concentratord configuration.
[concentratord]
  # Log level.
  #
  # Valid options are:
  #   * TRACE
  #   * DEBUG
  #   * INFO
  #   * WARN
  #   * ERROR
  #   * OFF
  log_level="DEBUG"

  # Log to syslog.
  #
  # When set to true, log messages are being written to syslog instead of stdout.
  log_to_syslog=false

  # Statistics interval.
  stats_interval="30s"

  # Disable CRC status filter.
  #
  # By default, the Concentratord will ignore received frames which do not have
  # a valid CRC. This option makes it possible to disable this filter such that
  # received frames without (valid) CRC can be analyzed.
  disable_crc_filter=false

  # Configuration for the (ZeroMQ based) API.
  [concentratord.api]
    # Event PUB socket bind.
    event_bind="ipc:///tmp/concentratord_event"

    # Command REP socket bind.
    command_bind="ipc:///tmp/concentratord_command"

# LoRa gateway configuration.
[gateway]

  # Antenna gain (dB).
  antenna_gain=0

  # Public LoRaWAN network.
  lorawan_public=true

  # Region.
  #
  # The region of the gateway. Options:
  #  EU868, US915, CN779, EU433, AU915, CN470, AS923, AS923_2, AS923_3, AS923_4,
  #  KR923, IN865, RU864
  #
  # Not not all the gateway models implement all regions.
  region="EU868"

  # Gateway vendor / model.
  #
  # This configures various vendor and model specific settings.
  model="rak_5146"

  # Gateway vendor / model flags.
  #
  # Flag can be used to configure additional vendor / model features. The
  # following flags can be used:
  #
  #   Global flags:
  #     GNSS - Enable GNSS / GPS support
  #     USB  - Use USB for concentrator communication (default is SPI)
  model_flags=[ "GNSS" ]

  # Time fallback.
  #
  # In case the gateway does not have a GNSS module or is unable to aquire a
  # GNSS fix, use the system-time for setting the 'time' field on RX.
  time_fallback_enabled=true

  # LoRa concentrator configuration.
  [gateway.concentrator]

    # Multi spreading-factor channels (LoRa).
    multi_sf_channels=[
      868100000,
      868300000,
      868500000,
      867100000,
      867300000,
      867500000,
      867700000,
      867900000,
    ]

    # LoRa std channel (single spreading-factor).
    [gateway.concentrator.lora_std]
      frequency=868300000
      bandwidth=250000
      spreading_factor=7

    # FSK channel.
    [gateway.concentrator.fsk]
      frequency=868800000
      bandwidth=125000
      datarate=50000

  # Static gateway location.
  [gateway.location]

    # When set to non-zero values, the static gateway location will be reported
    # when the gateway does not have a GNSS module or when no GNSS location fix
    # is available.
    latitude=0.0
    longitude=0.0
    altitude=0

Versions

cyclops@octoprint:~/chirpstack-concentrator $ ./chirpstack-mqtt-forwarder  --version
chirpstack-mqtt-forwarder 4.1.2

cyclops@octoprint:~/chirpstack-concentrator $ ./chirpstack-concentratord-sx1302 --version
chirpstack-concentratord-sx1302 4.3.3

Chirpstack:

[17:32:36] cyclops@jubilee:~$ docker ps -a | grep chirp
9c3fa9351dee   chirpstack/chirpstack-rest-api:4.1.1          "/usr/bin/chirpstack…"   26 minutes ago   Up 26 minutes                                                                                                                                chirpstack_chirpstack-rest-api_1
53df63f34941   chirpstack/chirpstack-gateway-bridge:4.0.3    "/usr/bin/chirpstack…"   26 minutes ago   Up 26 minutes         0.0.0.0:1700->1700/udp                                                                                                 chirpstack_chirpstack-gateway-bridge-eu868_1
e227798d73fa   chirpstack/chirpstack:4.1.1                   "/usr/bin/chirpstack…"   26 minutes ago   Up 26 minutes         0.0.0.0:8088->8080/tcp                                                                                                 chirpstack_chirpstack_1
3524c80ae870   postgres:14-alpine                            "docker-entrypoint.s…"   26 minutes ago   Up 26 minutes         5432/tcp                                                                                                               chirpstack_postgres_1
89f774a33d19   eclipse-mosquitto:2                           "/docker-entrypoint.…"   26 minutes ago   Up 26 minutes         0.0.0.0:1883->1883/tcp                                                                                                 chirpstack_mosquitto_1
548e57d1c80e   redis:7-alpine                                "docker-entrypoint.s…"   26 minutes ago   Up 26 minutes         6379/tcp                                                                                                               chirpstack_redis_1
brocaar commented 11 months ago

The reconfiguration might not be the issue:

thread '' panicked at 'read from gps error: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }', chirpstack-concentratord-sx1302/src/handler/gps.rs:75:14

Could you please try without the GPS / GNSS enabled?

cyclops1982 commented 10 months ago

Without GNSS it has been working fine.

I'm wondering how RAK5146 should do GNSS. I have the module that has it built in and the antenna is connected.

brocaar commented 6 months ago

The module works fine for me. Assuming you are using a Raspberry Pi, have you tested with the ChirpStack Gateway OS? Please note that you need to make some Raspberry Pi config changes to make the GNSS work (by default the Bluetooth module is mapped to the UART pins, which collides with the GNSS).