You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@lpinca What kind of machine do you have? I can't repro with your test.py invocation, or by running:
while ./out/Release/node test/parallel/test-tls-sni-option.js; do; done;
three times in parallel, on linux x64. That said, this test looks like it depends on the order of completion of the handshakes on client relative to server, I am prepping a PR.
Without injecting some tracing into the TLS code, I don't know exactly why that is happening, but its not surprising. TLS1.3 continues to exchange some packages after handshake, and handshake completes with different timings, so for some extra messages to arrive after the socket is closed, but for it to be racy, doesn't surprise me. With your change, the close goes from client, to server, then back to client, emits close, and then it's done, so the roundtrip occurs. I fixed bugs like this in other tests, but this one being only a bit racy I never noticed.
Systems are different. localhost TCP on Linux doesn't actually do a full TCP protocol, for example, it knows packet loss is impossible because its all in the local host's memory. Also, after a write() on TCP, which process gets scheduled depends on the OS. TLS connections that exchange no data and immediately do an ungraceful close before exchanging data are racy, and our unit tests do a lot of them, but real-world applications establish TLS connections to exchange data. The OpenSSL devs aren't happy that we are exchanging TLS data in the handshake complete callback, that's an issue, too, and perhaps related to this, because it causes a few more packets to be exchanged before the TLS close alert.
I could reintroduce my packet tracing to see exactly what packet is being sent, but that will take a bit to PR, and I'm not sure what the API should look like. I could wireshark, but since the link is encrypted and we lack the feature of dumping the master secret, I won't see the actual packet. I've been meaning to PR an improvement to that, too. Both are open feature requests.
Since I made a number of fixes like this, but with tests that failed more like 1/3 of the time, I'm OK with just doing a graceful TLS end. If we want to wait until TLS debugging features land, that's OK with me, too.
I'm fine with anything as long as the test is not changed from its original intent.
Another possible way to "fix" it without closing from the client is to add a listener for the 'error' event on socket assuming that the error is sometimes expected as per discussion.
Activity
MylesBorins commentedon Mar 28, 2019
I've been seeing this locally a bunch
lpinca commentedon Apr 1, 2019
The culprit seems to be this commit: 42dbaed.
Easily reproducible on my machine with:
If
--node-args=--tls-max-v1.2is used I can no longer reproduce.cc: @sam-github
sam-github commentedon Apr 18, 2019
@lpinca What kind of machine do you have? I can't repro with your test.py invocation, or by running:
three times in parallel, on linux x64. That said, this test looks like it depends on the order of completion of the handshakes on client relative to server, I am prepping a PR.
sam-github commentedon Apr 18, 2019
I read the top in more detail, it's on OS X, I''ll try on that.
lpinca commentedon Apr 19, 2019
Yes I can't reproduce on Linux, only on macOS.
lpinca commentedon Apr 19, 2019
The following patch fixes it but I'm not sure why.
test: mark some known flakes
sam-github commentedon Apr 23, 2019
Without injecting some tracing into the TLS code, I don't know exactly why that is happening, but its not surprising. TLS1.3 continues to exchange some packages after handshake, and handshake completes with different timings, so for some extra messages to arrive after the socket is closed, but for it to be racy, doesn't surprise me. With your change, the close goes from client, to server, then back to client, emits close, and then it's done, so the roundtrip occurs. I fixed bugs like this in other tests, but this one being only a bit racy I never noticed.
lpinca commentedon Apr 23, 2019
Yes but isn't it strange that the race only occurs (or is exacerbated) on macOS?
sam-github commentedon Apr 23, 2019
Systems are different. localhost TCP on Linux doesn't actually do a full TCP protocol, for example, it knows packet loss is impossible because its all in the local host's memory. Also, after a
write()on TCP, which process gets scheduled depends on the OS. TLS connections that exchange no data and immediately do an ungraceful close before exchanging data are racy, and our unit tests do a lot of them, but real-world applications establish TLS connections to exchange data. The OpenSSL devs aren't happy that we are exchanging TLS data in the handshake complete callback, that's an issue, too, and perhaps related to this, because it causes a few more packets to be exchanged before the TLS close alert.I could reintroduce my packet tracing to see exactly what packet is being sent, but that will take a bit to PR, and I'm not sure what the API should look like. I could wireshark, but since the link is encrypted and we lack the feature of dumping the master secret, I won't see the actual packet. I've been meaning to PR an improvement to that, too. Both are open feature requests.
Since I made a number of fixes like this, but with tests that failed more like 1/3 of the time, I'm OK with just doing a graceful TLS end. If we want to wait until TLS debugging features land, that's OK with me, too.
lpinca commentedon Apr 23, 2019
I'm fine with anything as long as the test is not changed from its original intent.
Another possible way to "fix" it without closing from the client is to add a listener for the
'error'event on socket assuming that the error is sometimes expected as per discussion.sam-github commentedon Apr 23, 2019
The purpose of the test was to check the assertions related to SNI, which isn't affected by how the connection is destroyed.
sam-github commentedon Apr 23, 2019
I reworked my refactor in #27300 so that it uses the same close sequence as original, and the test appears to be stable.
test: mark some known flakes
test: mark some known flakes