-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Prevent x509_cert from hanging on UDP connection #9323
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
One note: if you look at the ci/circleci: test-go-1_15 check you'll see CircleCI is complaining about additional licenses needing to be added for the following:
+github.com/pion/logging
+github.com/pion/transport
+github.com/pion/udp
@akrantz01 Does udp:// mean DTLS(rfc6347) after this PR ? (udp:// only works with DTLS servers and not with some homegrown tls on top of udp socket). Maybe |
That'd probably be good to mention. However, there shouldn't be any additional problems with homegrown implementations over UDP since previously, it fails to send a packet if you configure it to pull from a UDP address as the standard library isn't equipped to handle it. |
m := &X509Cert{ | ||
Sources: []string{"udp://" + listener.Addr().String()}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to set the logging facility here or you will get segfaults (that are the failing CI tests you see):
m := &X509Cert{ | |
Sources: []string{"udp://" + listener.Addr().String()}, | |
} | |
m := &X509Cert{ | |
Sources: []string{"udp://" + listener.Addr().String()}, | |
Log: testutil.Logger{}, | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akrantz01 thanks for looking into this. The code looks quite good and I added a comment to fix the failing CI tests. Let me know if I can be of any further help.
|
||
go func() { | ||
_, err := listener.Accept() | ||
require.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shall not use any require
methods that terminate (i.e. call require.Fail
internally) in goroutines as this will only end the goroutine and not the test. See the go release notes for reference also describing a potential workaround.
In this specific instance I think just ignoring the error and quitting the goroutine might be sufficient as the test relying on the accept will probably fail anyway...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for the nice PR!
Looks like new artifacts were built from this PR. Get them here!Artifact URLs |
(cherry picked from commit 32d4234)
Required for all PRs:
resolves #9310
Fixes the bug where the
x509_cert
plugin would hang indefinitely when you try to gather certificate metrics from a UDP address. This was done by adding UDP support to the plugin using the pion/dtls library.Note: #9289 should be merged before this PR since all URLs are currently parsed as globs causing telegraf to fail to pull the certificate. Similarly, theRebased to master.TestGatherUDPCert
test will fail because of this.