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

Improve alias handling in outlet creation #5898

Closed
davide-baldo opened this issue Sep 5, 2023 · 3 comments
Closed

Improve alias handling in outlet creation #5898

davide-baldo opened this issue Sep 5, 2023 · 3 comments
Assignees

Comments

@davide-baldo
Copy link
Member

Observed behavior

When creating multiple outlets with the same alias, ockam command doesn't report a conflict and only the last outlet is listed in the status.
See the outlet listed by show.

$ ockam tcp-outlet create --to 127.0.0.1:1080 --alias my-alias --from outlet1
       Creating TCP Outlet to 127.0.0.1:1080...

       There is no node, on this machine, marked as your default.
       Creating a new Ockam node for you...
       Created a new node named default
       Marked this node as your default, on this machine.

     ✔︎ Created a new TCP Outlet on node default from address /service/outlet1 to 127.0.0.1:1080
$ ockam node show default

Node:
  Name: default (Default)
  Status: UP
  Route To Node:
    Short: /node/default
    Verbose: /dnsaddr/localhost/tcp/56734
  Identity: Pc25b4dbe8acecda55438a6babcd209c86fae806f0b12e3d6c8d9eafe44f1b184
  Transports:
    Transport:
      Type: TCP
      Mode: Listening
      Socket: 127.0.0.1:56734
      Worker: <none>
      FlowControlId: 7fa70d15c9a1b5e430ad1c544c7b8c9e
  Secure Channel Listeners:
    Listener:
      Address: /service/api
      FlowControlId: 9ece9ed3123ec83081b8179c284a225a
  Inlets:
  Outlets:
    Outlet:
      Forward Address: 127.0.0.1:1080
      Address: /service/outlet1
  Services:
    Service:
      Type: uppercase
      Address: /service/uppercase
    Service:
      Type: echo
      Address: /service/echo
davidebaldo@mac ~/workspace/github/build-trust/ockam
$ ockam tcp-outlet create --to 127.0.0.1:1080 --alias my-alias --from outlet2
       Creating TCP Outlet to 127.0.0.1:1080...

     ✔︎ Created a new TCP Outlet on node default from address /service/outlet2 to 127.0.0.1:1080
$ ockam node show default

Node:
  Name: default (Default)
  Status: UP
  Route To Node:
    Short: /node/default
    Verbose: /dnsaddr/localhost/tcp/56734
  Identity: Pc25b4dbe8acecda55438a6babcd209c86fae806f0b12e3d6c8d9eafe44f1b184
  Transports:
    Transport:
      Type: TCP
      Mode: Listening
      Socket: 127.0.0.1:56734
      Worker: <none>
      FlowControlId: 7fa70d15c9a1b5e430ad1c544c7b8c9e
  Secure Channel Listeners:
    Listener:
      Address: /service/api
      FlowControlId: 9ece9ed3123ec83081b8179c284a225a
  Inlets:
  Outlets:
    Outlet:
      Forward Address: 127.0.0.1:1080
      Address: /service/outlet2
  Services:
    Service:
      Type: uppercase
      Address: /service/uppercase
    Service:
      Type: echo
      Address: /service/echo

Steps to reproduce

  1. ockam reset -y
  2. ockam tcp-outlet create --to 127.0.0.1:1080 --alias my-alias --from outlet1
  3. ockam tcp-outlet create --to 127.0.0.1:1080 --alias my-alias --from outlet2

Expected behavior

The second outlet creation onward should fail since the alias is already in-use.

Ockam Version

0.90.0/8a77aa9dec024b05d9da00f4e75acd188ff6e785

@nidnogg
Copy link
Contributor

nidnogg commented Sep 5, 2023

I can try and have a look at this

@davide-baldo davide-baldo changed the title Incorrect alias handling in outlet creation Improve alias handling in outlet creation Sep 6, 2023
@davide-baldo
Copy link
Member Author

davide-baldo commented Sep 6, 2023

@nidnogg

Sure! Please let me know if you have any doubt or need any extra information.

@nidnogg
Copy link
Contributor

nidnogg commented Sep 25, 2023

Hi all! So I tried replicating this issue and I believe it's been fixed sometime over the last weeks because creating the second outlet with the duplicate name reports an error as intended. See the transcript below:

OCK500

  × Ockam Error [origin: Node, kind: AlreadyExists] at implementations/rust/ockam/ockam_api/src/nodes/service/portals.rs:59:24
  │ --- Details ---
  │ - Caused by: A TCP outlet with alias 'my-alias' already exists
  │ - possible root cause `alloc::string::String`: A TCP outlet with alias 'my-alias' already exists
  │   debug output:
  │     "A TCP outlet with alias 'my-alias' already exists"
  │ --- Captured Spantrace ---
  │
  │ --------------------------
  │  (origin: Api, kind: Invalid, source location: /Users/nidnogg/localdev/ockam/implementations/rust/ockam/ockam_core/src/api.rs:144:44)
  help: Please report this issue, with a copy of your logs, to https://github.com/build-trust/ockam/issues

  Version 0.94.0, hash: de5b2f78e083d6a47330b7aab7b7f0413f50846d

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

No branches or pull requests

4 participants