Skip to content

[Bug]: tcp://localhost:55554 vs tcp://127.0.0.1:55554 #55

@outsinre

Description

@outsinre

Bug Description

I can use stm to connect to the broker via tcp://127.0.0.1:55554, but not tcp://localhost:55554.

Here is the output of localhost. Seems stm only tries the IPv6 address.

$ stm receive --url 'tcp://localhost:55554' --vpn default -u default -p default -q PartitionedQ --acknowledge-mode AUTO --client-name "cli_consumer_tcp" --output-mode full

█████╗ █████╗ ██╗    ████╗  ████╗████╗  ████████╗█████╗ ██╗   ██╗    ███╗  ███╗█████╗
█╔═══╝██╔══██╗██║   ██╔═██╗██╔══╝██══╝  ╚══██╔══╝██╔═██╗╚██╗ ██╔╝    ████╗ ███║██╔══╝
█████╗██║  ██║██║   ██████║██║   ███╗      ██║   █████╔╝ ╚████╔╝     ██╔███╔██║███╗
╚══██║██║  ██║██║   ██╔═██║██║   ██╔╝      ██║   ██╔═██╗  ╚██╔╝ ███  ██║╚██╝██║██╔╝
█████║╚█████╔╝█████╗██║ ██║╚████╗████╗     ██║   ██║ ██║   ██║       ██║ ╚╝ ██║█████╗
╚════╝ ╚════╝ ╚════╝╚═╝ ╚═╝ ╚═══╝╚═══╝     ╚═╝   ╚═╝ ╚═╝   ╚═╝       ╚═╝    ╚═╝╚════╝
v0.0.81 - https://github.com/SolaceLabs/solace-tryme-cli

ℹ  info      info: loading 'receive' command from configuration '/Users/zachary/.stm/stm-cli-config.json'
…  waiting   connecting to broker [tcp://localhost:55554, vpn: default, username: default, password: ******]
ℹ  info      info: client name: cli_consumer_tcp
✖  error     error: connection failed to the message router Connection failed. Message:connect ECONNREFUSED ::1:55554 -  - check the connection parameters!
✖  error     error:

Here is the output of 127.0.0.1.

$ stm receive --url 'tcp://127.0.0.1:55554' --vpn default -u default -p default -q PartitionedQ --acknowledge-mode AUTO --client-name "cli_consumer_tcp" --output-mode full

█████╗ █████╗ ██╗    ████╗  ████╗████╗  ████████╗█████╗ ██╗   ██╗    ███╗  ███╗█████╗
█╔═══╝██╔══██╗██║   ██╔═██╗██╔══╝██══╝  ╚══██╔══╝██╔═██╗╚██╗ ██╔╝    ████╗ ███║██╔══╝
█████╗██║  ██║██║   ██████║██║   ███╗      ██║   █████╔╝ ╚████╔╝     ██╔███╔██║███╗
╚══██║██║  ██║██║   ██╔═██║██║   ██╔╝      ██║   ██╔═██╗  ╚██╔╝ ███  ██║╚██╝██║██╔╝
█████║╚█████╔╝█████╗██║ ██║╚████╗████╗     ██║   ██║ ██║   ██║       ██║ ╚╝ ██║█████╗
╚════╝ ╚════╝ ╚════╝╚═╝ ╚═╝ ╚═══╝╚═══╝     ╚═╝   ╚═╝ ╚═╝   ╚═╝       ╚═╝    ╚═╝╚════╝
v0.0.81 - https://github.com/SolaceLabs/solace-tryme-cli

ℹ  info      info: loading 'receive' command from configuration '/Users/zachary/.stm/stm-cli-config.json'
…  waiting   connecting to broker [tcp://127.0.0.1:55554, vpn: default, username: default, password: ******]
ℹ  info      info: client name: cli_consumer_tcp
✔  success   success: === cli_consumer_tcp successfully connected and ready to receive events. ===
✔  success   success: starting receiver for queue PartitionedQ
✔  success   success: ready to receive messages.
…  waiting   waiting for events...
❤  favorite  hint: Use 'stm manage queue --list PartitionedQ' to review the queue and topic subscriptions on the queue
ℹ  info      info: press Ctrl-C to exit
^Cℹ  info      info: operation interrupted...
✔  success   success: disconnecting from Solace PubSub+ Event Broker...
✔  success   success: disconnected
✔  success   success:

I launched a broker via docker compose as illustrated here //github.com/SolaceLabs/solace-single-docker-compose, and all ports are exactly mapped to my macOS host.

$ docker compose -p solace ps
NAME                       IMAGE                                  COMMAND               SERVICE   CREATED       STATUS       PORTS
pubSubStandardSingleNode   solace/solace-pubsub-standard:latest   "/usr/sbin/boot.sh"   solace    5 weeks ago   Up 5 weeks   0.0.0.0:1443->1443/tcp, 0.0.0.0:1883->1883/tcp, 0.0.0.0:1943->1943/tcp, 0.0.0.0:2222->2222/tcp, 0.0.0.0:5671-5672->5671-5672/tcp, 0.0.0.0:8000->8000/tcp, 0.0.0.0:8008->8008/tcp, 0.0.0.0:8080->8080/tcp, 0.0.0.0:8443->8443/tcp, 0.0.0.0:8883->8883/tcp, 0.0.0.0:9000->9000/tcp, 0.0.0.0:9443->9443/tcp, 0.0.0.0:55003->55003/tcp, 0.0.0.0:55443->55443/tcp, 0.0.0.0:55554->55555/tcp

At the very beginning, the localhost works as expected, but after some settings, do not how it does not work again. The main management I did is enabling OAuth authentication and authorization, and TLS certificate, as stated here https://docs.solace.com/Security/Configuring-Client-Authentication.htm#OAuth.

In the broker container, I am sure the IPv6 listening port is enabled:

State                           Recv-Q                           Send-Q                                                     Local Address:Port                                                      Peer Address:Port                          Process
LISTEN                          0                                4096                                                             0.0.0.0:5550                                                           0.0.0.0:*
LISTEN                          0                                128                                                              0.0.0.0:5553                                                           0.0.0.0:*
LISTEN                          0                                4096                                                             0.0.0.0:5672                                                           0.0.0.0:*
LISTEN                          0                                128                                                              0.0.0.0:5671                                                           0.0.0.0:*
LISTEN                          0                                4096                                                             0.0.0.0:55003                                                          0.0.0.0:*
LISTEN                          0                                4096                                                             0.0.0.0:55555                                                          0.0.0.0:*
LISTEN                          0                                4096                                                          127.0.0.11:33977                                                          0.0.0.0:*
LISTEN                          0                                128                                                              0.0.0.0:55443                                                          0.0.0.0:*
LISTEN                          0                                64                                                             127.0.0.1:5345                                                           0.0.0.0:*
LISTEN                          0                                4096                                                             0.0.0.0:8008                                                           0.0.0.0:*
LISTEN                          0                                4096                                                             0.0.0.0:8000                                                           0.0.0.0:*
LISTEN                          0                                511                                                              0.0.0.0:8080                                                           0.0.0.0:*
LISTEN                          0                                128                                                              0.0.0.0:8443                                                           0.0.0.0:*
LISTEN                          0                                4096                                                             0.0.0.0:9000                                                           0.0.0.0:*
LISTEN                          0                                128                                                              0.0.0.0:8883                                                           0.0.0.0:*
LISTEN                          0                                128                                                              0.0.0.0:1443                                                           0.0.0.0:*
LISTEN                          0                                128                                                              0.0.0.0:9443                                                           0.0.0.0:*
LISTEN                          0                                4096                                                             0.0.0.0:1883                                                           0.0.0.0:*
LISTEN                          0                                511                                                              0.0.0.0:1943                                                           0.0.0.0:*
LISTEN                          0                                128                                                              0.0.0.0:2222                                                           0.0.0.0:*
LISTEN                          0                                512                                                            127.0.0.1:1025                                                           0.0.0.0:*
LISTEN                          0                                128                                                                 [::]:5553                                                              [::]:*
LISTEN                          0                                4096                                                                [::]:5672                                                              [::]:*
LISTEN                          0                                128                                                                 [::]:5671                                                              [::]:*
LISTEN                          0                                4096                                                                [::]:55003                                                             [::]:*
LISTEN                          0                                4096                                                                [::]:55555                                                             [::]:*
LISTEN                          0                                128                                                                 [::]:55443                                                             [::]:*
LISTEN                          0                                4096                                                                [::]:8008                                                              [::]:*
LISTEN                          0                                4096                                                                [::]:8000                                                              [::]:*
LISTEN                          0                                511                                                                 [::]:8080                                                              [::]:*
LISTEN                          0                                128                                                                 [::]:8443                                                              [::]:*
LISTEN                          0                                4096                                                                [::]:9000                                                              [::]:*
LISTEN                          0                                128                                                                 [::]:8883                                                              [::]:*
LISTEN                          0                                128                                                                 [::]:1443                                                              [::]:*
LISTEN                          0                                128                                                                 [::]:9443                                                              [::]:*
LISTEN                          0                                4096                                                                [::]:1883                                                              [::]:*
LISTEN                          0                                511                                                                 [::]:1943                                                              [::]:*
LISTEN                          0                                128                                                                 [::]:2222                                                              [::]:*

Expected Behavior

tcp://localhosst:55554 should connect to broker.

Steps to Reproduce

Jus run:

$ stm receive --url 'tcp://localhost:55554' --vpn default -u default -p default -q PartitionedQ --acknowledge-mode AUTO --client-name "cli_consumer_tcp" --output-mode full

$ stm receive --url 'tcp://127.0.0.1:55554' --vpn default -u default -p default -q PartitionedQ --acknowledge-mode AUTO --client-name "cli_consumer_tcp" --output-mode full

Solace Broker version

Solace PubSub+ Standard Version 10.25.0.24

Solace API

No response

Solace API version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions