Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Update pion/webrtc to 2.0.27 #30

Merged
merged 10 commits into from
Aug 5, 2019
Merged

Update pion/webrtc to 2.0.27 #30

merged 10 commits into from
Aug 5, 2019

Conversation

albrow
Copy link
Contributor

@albrow albrow commented Apr 30, 2019

The latest release might fix the performance problems we were experiencing. Waiting to see what happens in CI in order to confirm.

go.sum Outdated Show resolved Hide resolved
@albrow
Copy link
Contributor Author

albrow commented May 6, 2019

@albrow
Copy link
Contributor Author

albrow commented May 6, 2019

@backkem all the tests pass if we disable the race detector. I think the sheer amount of goroutines we are spinning up is just too much for the race detector to handle, especially on the TravisCI machines, which are not particularly powerful.

I vote that we disable the race detector for the stress tests and only use it for the other tests. What do you think?

https://github.com/libp2p/go-libp2p-transport/blob/045097a6a962aeccac5e06d672a9b2489cf4b68c/test/stream.go#L158 suggests the race detector only supports ~8k funcs (I think they mean goroutines) and the stress tests themselves spin up 5k. We probably run much much more than that with everything going on under the hood.

@backkem
Copy link
Contributor

backkem commented May 7, 2019

Ok, it would be nice if we could do this while also using the test suite directly again:

// utils.SubtestTransport(t, ta, tb, addr, "peerA")

@raulk
Copy link
Member

raulk commented May 7, 2019

Yes, indeed. The race detector gives up as soon as you spin up more than 8192 concurrent goroutines. It's easy to detect when we're running with the race checker via build tags, we tend to use https://github.com/ipfs/go-detect-race to avoid reinventing the wheel; the upcoming libp2p/go-libp2p-testing module will absorb this util.

The pattern is:

  1. skip stress tests if we're running with the race detector.
  2. run a CI build matrix with and without the race detector.

@backkem backkem changed the title Update pion/webrtc to 2.0.10 Update pion/webrtc to 2.0.16 Jun 2, 2019
@backkem
Copy link
Contributor

backkem commented Jun 2, 2019

The update to webrtc v2.0.16 and go-libp2p-core seems to cause a deadlock of some sort. I don't have the time to look into this ATM :(

@backkem backkem changed the title Update pion/webrtc to 2.0.16 Update pion/webrtc to 2.0.27 Jul 28, 2019
@backkem
Copy link
Contributor

backkem commented Jul 28, 2019

Figured out the problem currently being faced: a pion/datachannel.DataChannel is packet-based and go-mplex expects a stream based net.Conn which has slightly different characteristics (while having the same interface since they are both connection-oriented).

Overview of different types of connections as I see them:

Connection oriented
(net.Conn)
Connection-less
(net.PacketConn)
Stream based
(Read/write byte streams)
IP, all of libp2p for now ?
Packet based
(Read/write bounded packets)
ICE, DataChannel UDP

Side-note: Properties a connection may or may not have:

  • Connection oriented vs connection less
  • Stream vs Packet based
  • Encrypted vs plain text
  • Authenticated vs open
  • Reliable vs Unreliable
  • Ordered vs Un-ordered
  • ...

It feels like libp2p should model for that.

@backkem
Copy link
Contributor

backkem commented Jul 28, 2019

@albrow Last commit makes the entire test suite green. I opted to use a fixed buffer to overcome the stream vs packet based issue. This point definitely needs further investigation and/or discussion with the libp2p guys. However, I think it's mergable in the mean time. Do you mind reviewing?


if w.bufEnd == 0 {
n := 0
n, err = w.channel.Read(w.buf)
Copy link
Contributor Author

@albrow albrow Jul 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@backkem I must be missing something. We read from w.buf here but when do we ever write to it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line means we read from the datachannel into the packet buffer.

The idea is to allow an upper layer to read the packet in chunks. This is allowed when reading from a stream but it causes you to lose data when reading on a packet based connection. I'm not sure if there can be better solutions without the upper layer taking into account that it's using a packet based connection. This also ties into a discussion of support for packet based transports in libp2p, e.g. UDP.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I was thrown off by the method name Read. But that line is actually "reading into" w.buf aka writing to it.

@albrow
Copy link
Contributor Author

albrow commented Aug 5, 2019

@backkem LGTM I think we should go ahead and merge this PR since it passes all the tests. We can separately start a broader discussion about how to handle stream vs. packet based connections.

(I can't leave a review in GitHub because I'm the original author of the PR. If you hit the approve button I think GitHub will let us merge).

@backkem backkem merged commit 006488d into master Aug 5, 2019
@backkem backkem deleted the webrtc-2.0.10 branch August 5, 2019 19:29
@backkem backkem mentioned this pull request Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants