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

Bad write retry error with python 2.7.10 #30

Closed
Nagriar opened this Issue Oct 13, 2015 · 15 comments

Comments

Projects
None yet
4 participants
@Nagriar
Copy link
Member

commented Oct 13, 2015

When I try to execute

def test_network(self):
        batch = []
        for i in range(1, 3000):
            batch.append({'action': 'addObject', 'body': {
                'test1': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
            }})
        self.index.batch(batch)

I receive the error: AlgoliaException: Unreachable hosts: {'YLGNV73XLW-2.algolianet.com': "[('SSL routines', 'ssl3_write_pending', 'bad write retry')]", 'YLGNV73XLW.algolia.net': "[('SSL routines', 'ssl3_write_pending', 'bad write retry')]", 'YLGNV73XLW-3.algolianet.com': "[('SSL routines', 'ssl3_write_pending', 'bad write retry')]", 'YLGNV73XLW-1.algolianet.com': "[('SSL routines', 'ssl3_write_pending', 'bad write retry')]"}

If I use python 3.4, the issue is fixed, it's maybe related to https://hg.python.org/cpython/rev/60310223d075/

@dethi

This comment has been minimized.

Copy link
Contributor

commented Oct 13, 2015

Interesting issue 😮

@dethi

This comment has been minimized.

Copy link
Contributor

commented Oct 13, 2015

The issue comes from PyOpenSSL and Python 2.7
It works well on python 2.7.10 without PyOpenSSL installed.

@redox

This comment has been minimized.

Copy link
Member

commented Oct 13, 2015

The issue comes from PyOpenSSL and Python 2.7

💃

@dethi

This comment has been minimized.

Copy link
Contributor

commented Oct 13, 2015

We use PyOpenSSL on Python 2.X for the SNI Support... :(

@Nagriar

This comment has been minimized.

Copy link
Member Author

commented Oct 13, 2015

Why 2.6 is working on travis? it's a regression?

@dethi

This comment has been minimized.

Copy link
Contributor

commented Oct 13, 2015

https://docs.python.org/2/library/ssl.html#ssl.HAS_SNI
So PyOpenSSL is only needed for Python 2.6 because Python 2.7.9+ comes with SNI Support :)

@redox

This comment has been minimized.

Copy link
Member

commented Oct 13, 2015

So PyOpenSSL is only needed for Python 2.6 because Python 2.7.9+ comes with SNI Support :)

Interesting :) So do you think we could depend on it based on the version of python?

@dethi

This comment has been minimized.

Copy link
Contributor

commented Oct 13, 2015

@redox Well, I tried last month to use "package_name;python_version >= 'X.X' but without success. pip has some issue with this syntax and many OS are shipped with old version of pip, which is bad...

@Nagriar yes I think, but I can't find any opened issue about it.

@Nagriar

This comment has been minimized.

Copy link
Member Author

commented Oct 28, 2015

The fix is on the master branch of urllib3 (https://github.com/shazow/urllib3/blob/master/CHANGES.rst#dev-master). We just need to wait the release to fix this issue.

@dethi

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2015

Cool :)

@Nagriar

This comment has been minimized.

Copy link
Member Author

commented Dec 17, 2015

💥 Version 1.13 released

@Nagriar Nagriar closed this Dec 17, 2015

@dustincoates

This comment has been minimized.

Copy link
Member

commented Dec 28, 2015

@Nagriar @dethi Is there a workaround for those who can't upgrade urllib3 because of dependency issues elsewhere?

@dethi

This comment has been minimized.

Copy link
Contributor

commented Dec 28, 2015

@dustincoates if you can uninstall PyOpenSSL, it should work.

@dustincoates

This comment has been minimized.

Copy link
Member

commented Dec 28, 2015

Thanks @dethi. I'll see if that's an option for them.

@redox

This comment has been minimized.

Copy link
Member

commented Jan 18, 2016

Just to make it clear for people reading that issue later on:

  • the issue is indeed in urllib3 and has been fixed with urllib3/urllib3#719
  • BUT upgrading urllib3 won't solve the issue because requests embed it's own version of urllib3; so the API client won't use that updated version
  • the good thing is that requests upgraded to urllib3 1.13 in their 2.9.x release

tldr;

pip install requests[security]==2.9.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.