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

Fix dmsg tracker #1238

Merged
merged 19 commits into from
Jun 7, 2022
Merged

Fix dmsg tracker #1238

merged 19 commits into from
Jun 7, 2022

Conversation

ersonp
Copy link
Contributor

@ersonp ersonp commented May 30, 2022

Did you run make format && make check?
yes

Fixes #1231
Fixes #1233

Changes:

  • Removed dmsgtracker from hypervisor
  • Added dmsgtracker as a module
  • Updated msgTrackerManager

How to test this PR:

  1. Checkout #dmsg-175
  2. In skywire uncomment // replace github.com/skycoin/dmsg => ../dmsg in go.mod
  3. Run make dep
  4. In skywire-services start a integration env
  5. Let everything run for a few seconds and close the dmsg-server with Ctrl+Z
  6. Check logs of visor B and UI
  7. Stop the dmsg-server by getting it's PID from htop and killing it with sudo kill -9 <pid>
  8. Check logs of visor B and UI
  9. Re-start the dmsg-server with source integration/dmsg-server-env.sh; ./bin/dmsg-server ./integration/dmsg-server.json --syslog localhost:514 --tag MSG_SRV
  10. Check the visor B
  11. It should reconnect to the server

ersonp added 17 commits May 30, 2022 08:42
This commit removes the dmsgtracker from Hypervisor and instead uses it from the struct Visor.

Previsoly we were creating a new dmsgtracker for Visor and Hypervisor which isn't necessarry as we can access the struct Visor from the struct Hypervisor.
This commit moves the initilization of the dmsgtrackers to its own module.
This commit adds ready chan to Manager as well as the method Ready.
This commit changes the dtm method from MustGet to Get.

The method MustGet blocks until it gets back the data so we use Get instead.
This commit reverts back to using MustGet in Summary as well as reverts back the changes made to GetBulk.
This commit updates the method mustEstablishTracker to not return anything but instead save the tracker directly.

New ticker is also added in order to stop the goroutine containing newDmsgTracker after updateTimeout incase context.WithDeadline doesn't work.
This commit updates the method GetBulk by using the method MustGet to get the DmsgClientSummary of all the pks.

Hence the method GetBulk now also returns error like MustGet and takes in ctx.
This commit updates the mustEstablishTracker method by using doneCh to aleart the select statement that it is done and prevent the warn log of timeout.
This commit uses the ctx with timeout as the timeout case instead of a ticker.
This commit fixes the dmsg-tracker test by creating a new method establishTracker that is used in method Get to run as a goroutine.

The method mustEstablishTracker now returns *DmsgTracker on success or an error on failure and is used in the method MustGet.
@ersonp ersonp marked this pull request as ready for review June 6, 2022 07:46
@ersonp
Copy link
Contributor Author

ersonp commented Jun 6, 2022

@mrpalide @jdknives I would like to have your opinion on the method MustGet of DmsgTrackerManager and it's usage. It is a blocking method that blocks until it gets back a dmsgtracker. Do we really need it or we can simply run the mustEstablishTracker as a goroutine. The current iteration works fine except rarely during startup the hypervisor is unresponsive for around 15-20s likely due to the usage of MustGet in ServeRPC.

In my opinion, MustGet should be switched to nonblocking with mustEstablishTracker used as a goroutine. We will also have to rename it.

Edit: Now the method MustGet is renamed to ShouldGet and is non blocking.

This commit changes the method MustGet to be non-blocking and renames it to ShouldGet.
@mrpalide mrpalide merged commit 6418d81 into skycoin:develop Jun 7, 2022
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

Successfully merging this pull request may close these issues.

2 participants