tornado-redis icon indicating copy to clipboard operation
tornado-redis copied to clipboard

Do not block when connecting socket

Open neg3ntropy opened this issue 10 years ago • 4 comments

Hi, I was running some tests in a Tornado web application that uses tornado-redis after a call to IOLoop.set_blocking_log_threshold() with a low value, to spot any blocking IO or slow sections.

This was the most recurring problem:

  File "build/bdist.linux-x86_64/egg/tornadoredis/client.py", line 405, in execute_command
    self.connection.connect()
  File "build/bdist.linux-x86_64/egg/tornadoredis/connection.py", line 73, in connect
    sock.connect((self.host, self.port))

The connection is in fact opened in blocking mode.

After this patch the problem goes away and my app seems to work. I did not run any unit test and I am aware that this probably needs some more work, for example on connection errors.

However I urge you to try and fix this and put out a new release as it quite critical to block the IOLoop even for a small time. Thank you

neg3ntropy avatar Apr 18 '14 17:04 neg3ntropy