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

tornado 5.x support #232

Merged
merged 4 commits into from
Apr 7, 2019
Merged

tornado 5.x support #232

merged 4 commits into from
Apr 7, 2019

Conversation

ploxiln
Copy link
Member

@ploxiln ploxiln commented Mar 18, 2019

addresses #185 and #203

still adapting tests ... they passed in a mocked io_loop so it's a pretty big change if they can't do that adapted

@ploxiln
Copy link
Member Author

ploxiln commented Mar 18, 2019

note that I removed nsq-0.3.8 and tornado-4.4 from the test matrix, figured it was time

@ploxiln
Copy link
Member Author

ploxiln commented Mar 18, 2019

half of test_backoff.py had one level of indent added ... diff best viewed by ignoring whitespace changes there

@jehiah
Copy link
Member

jehiah commented Mar 18, 2019

note that I removed nsq-0.3.8 and tornado-4.4 from the test matrix, figured it was time

For what it's worth, my last tornado upgrade effort only got me as far as 4.1.0-patched ;)

@ploxiln
Copy link
Member Author

ploxiln commented Mar 18, 2019

hah, so does that mean we should try for compatibility down to tornado-4.0.z ...

I just found tornado.iostream.IOStream.start_tls() for upgrading a plain IOStream to an SSLIOStream, and it was added in 4.0 so it's theoretically possible.

@jehiah
Copy link
Member

jehiah commented Mar 18, 2019

I mean if 4.1+ doesn't cause any specific complications i'd appreciate it.

@ploxiln
Copy link
Member Author

ploxiln commented Mar 27, 2019

I think this is feature-complete. Please take a look. If the direction looks good, I'll squash down to about 4 commits, and try to actually use it ...


self.stream = tornado.iostream.SSLIOStream(self.socket, io_loop=self.io_loop)
self.stream.set_close_callback(self._socket_close)
fut = self.stream.start_tls(False, ssl_options=opts, server_hostname=self.host)
Copy link
Member Author

@ploxiln ploxiln Mar 27, 2019

Choose a reason for hiding this comment

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

I don't think we were checking if the TLS server certificate was valid for the hostname connected to. Now, if not ssl.CERT_NONE, this will (I think) check hostname ...

@ploxiln
Copy link
Member Author

ploxiln commented Mar 29, 2019

mostly squashed

@ploxiln
Copy link
Member Author

ploxiln commented Apr 1, 2019

I threw up a version bump to 0.8.4b1 because it makes testing with my systems a bit easier.
(Maybe 0.9.0b1 would be more appropriate.)

Copy link
Member

@jehiah jehiah left a comment

Choose a reason for hiding this comment

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

👍 this LGTM

setup.py Outdated Show resolved Hide resolved
@ploxiln
Copy link
Member Author

ploxiln commented Apr 7, 2019

I'm finally running this for my staging services ... it seems to be working just fine. But note that I don't really use compression or tls features.

Copy link
Member

@mreiferson mreiferson left a comment

Choose a reason for hiding this comment

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

LGTM, minor comments

.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
@@ -24,6 +24,17 @@ def recv(self, size):
def read(self, size):
return self._recv(size, self._socket.read)

def recv_into(self, buf, nbytes=0):
Copy link
Member

Choose a reason for hiding this comment

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

why is this method necessary?

Copy link
Member Author

@ploxiln ploxiln Apr 7, 2019

Choose a reason for hiding this comment

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

it's the socket method which tornado-5.x uses instead of recv(), for potential efficiency improvement: tornadoweb/tornado@1215cd2

@ploxiln
Copy link
Member Author

ploxiln commented Apr 7, 2019

(I'll re-squash down to 3 or 4 commits, when ready)

@mreiferson
Copy link
Member

cool, error handling improvements look good 👍🏻

🔨

tornado 5.x compatibility to be corrected in the following commits

also test with tornado 4.1 for bitly (it's not yet a real burden)
no longer pass io_loop to tornado object contructors
no longer accept io_loop in nsq.Client subclasses
adapt tests for removed io_loop kwarg

no longer get "default certs" from tornado, no longer need certifi,
instead use IOStream.start_tls()
(which uses python SSLContext stuff to get default CA root bundle)
start passing hostname for checking in tls certificate
also test Deflate without SSL so we have some reader tests without SSL

the bootstrap thing has a minor possible issue with fd-readyness
but let's not fix that now (seems to have worked for a while anyway)
@ploxiln
Copy link
Member Author

ploxiln commented Apr 7, 2019

mostly squashed

Copy link
Member

@mreiferson mreiferson left a comment

Choose a reason for hiding this comment

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

💯

@mreiferson mreiferson merged commit 48bf62d into nsqio:master Apr 7, 2019
@ploxiln ploxiln deleted the tornado5 branch April 25, 2020 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants