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

Incorrect number of connections shown on internet nodes #1495

Closed
tomwilkie opened this issue May 12, 2016 · 5 comments
Closed

Incorrect number of connections shown on internet nodes #1495

tomwilkie opened this issue May 12, 2016 · 5 comments
Assignees
Labels
bug Broken end user or developer functionality; not working as the developers intended it

Comments

@tomwilkie
Copy link
Contributor

The +17 is wrong:

screen shot 2016-05-12 at 16 55 36

@tomwilkie tomwilkie added the bug Broken end user or developer functionality; not working as the developers intended it label May 12, 2016
@tomwilkie tomwilkie added this to the 0.17.0 milestone Jun 24, 2016
@tomwilkie
Copy link
Contributor Author

This will be the table ids not being unique again...

@rade rade modified the milestones: 0.17.0, July2016 Jul 4, 2016
@rade rade modified the milestones: July2016, August2016 Aug 4, 2016
@rade
Copy link
Member

rade commented Aug 28, 2016

This will be the table ids not being unique again...

@tomwilkie please elaborate. Is this a f/e or b/e issue?

What I am seeing in e.g. "Weave Cloud (Prod)" is that the 'show more' count is something like "+1126", but expanding the list only adds about 120 items. The other thing that is odd here is that only 2 items are shown by default - looking at the code, the default should be 5.

All that makes me think that it is a f/e issue. @davkal @foot

@davkal
Copy link
Contributor

davkal commented Aug 29, 2016

This will be the table ids not being unique again...

@tomwilkie Correct. This effect can be seen by the first 5 shown (only 2 are rendered because the other 3 are duplicates) and the collapsed ones (there seemed to be 120 unique rows among the 1126 entries). We're using a row's id field for that, so a solution would be to make that unique.

@rade
Copy link
Member

rade commented Aug 29, 2016

I find it hard to believe that we actually have 1126 connections to AWS services / the internet in prod. 120 is a more plausible figure. perhaps the data contains genuine duplicates?

@rade rade self-assigned this Sep 1, 2016
rade added a commit that referenced this issue Sep 1, 2016
For counting we were using a table keyed on a struct containing Node
pointers. For connections between ordinary nodes this works just
fine. But for connections to/from the Internet node we want to track
individual address/port combinations, which involves an extra
lookup. Since our data structures generally contain values, not
pointers, this produces aliases. As a result n connections from/to a
node to/from a specific Internet IP+port would result in n rows in the
count table, each with a count of 1, instead of one row with a count of
n.

Things wouldn't be so bad if it was actually rendered like that -
annoying, but at least accurate - but...

Each row has an ID which is computed from the node IDs and ports. Not
Node references. The ID must be unique - the frontend will only
render *one* thing per ID. Since the row IDs of our n rows are all the
same, we see one row with a count of 1 instead of n rows with a count of
1.

Furthermore, since the frontend's table row limiting is counting rows,
not unique row IDs, a) fewer rows would be rendered than expected, and
b) the displayed count of the number of extra rows would be too high.

The fix is to replace the Node pointers in the key with Node IDs. This
does require an extra table lookup when we come to produce the rows, but
that is just a fairly cheap map lookup.

Fixes #1495.
@rade
Copy link
Member

rade commented Sep 1, 2016

To reproduce:

$ scope launch
1c41ae18a677d54463e23e3adc5e63516b7409688634db79a9d8df5dcc9d635e
Weave Scope is reachable at the following URL(s):
  [...]
$ google-chrome http://localhost:4040
$ docker run --rm --name=foo -ti alpine /bin/sh
/ # IP=$(getent hosts cloud.weave.works | cut -d ' ' -f 1)
/ # echo $IP
52.3.116.14
/ # nc $IP 80 &
/ # 
[1]+  Stopped (tty input)        nc ${IP} 80
/ # nc $IP 80 &
/ # 
[2]+  Stopped (tty input)        nc ${IP} 80
/ # 

(the 'Stopped' lines appear after hitting return)

Wait for the 'foo' container and connection to the Internet node to show up in scope and then bring up the details panel on the Internet node. You should see something like
screenshot_2016-09-01_22-30-09

Notice that

  • the count for the connections from 'foo' says '1' instead of '2'
  • only 3 rows are shown when the renderer is supposed to render 5 by default
  • expanding the table adds far fewer rows than the shown count

@rade rade closed this as completed in #1843 Sep 2, 2016
rade added a commit that referenced this issue Sep 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken end user or developer functionality; not working as the developers intended it
Projects
None yet
Development

No branches or pull requests

3 participants