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

OpenSSL.test.test_ssl.ConnectionTests.test_wantWriteError() fails with "AssertionError: Failed to fill socket buffer, cannot test BIO want write" #67

Closed
Arfrever opened this issue Mar 18, 2014 · 6 comments
Labels

Comments

@Arfrever
Copy link

OpenSSL.test.test_ssl.ConnectionTests.test_wantWriteError() fails in the same way with each version of Python (2.6, 2.7, 3.1, 3.2, 3.3, 3.4).
OpenSSL 1.0.1f, cryptography 0.2.2, Gentoo GNU/Linux.

======================================================================
FAIL: test_wantWriteError (OpenSSL.test.test_ssl.ConnectionTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/pyopenssl/OpenSSL/test/test_ssl.py", line 1925, in test_wantWriteError
    "Failed to fill socket buffer, cannot test BIO want write")
AssertionError: Failed to fill socket buffer, cannot test BIO want write

======================================================================

It is failure in earlier part of test function than in issue #37.

@exarkun
Copy link
Member

exarkun commented Mar 19, 2014

Can you shed any light on why this might be?

I don't presently have any Gentoo GNU/Linux installations for testing.

@exarkun exarkun added the bug label Mar 19, 2014
@Arfrever
Copy link
Author

This test seems to assume that writing 512 * 2048 (i.e. 1048576) bytes is sufficient fo fill socket buffer. On my system, the buffer is filled after increasing this number several times.
client_socket.send() is currently called at most 2048 times with 512-byte argument.
When client_socket.send() is called with 1-byte argument, then calling this function at least 3591944 times allows this test to pass.
When client_socket.send() is called with 512-byte argument, then calling this function at least 5417 times allows this test to pass.
I use Linux 3.13.6, glibc 2.18, x86_64 architecture. I do not know if socket buffer size is somewhere configurable.
I suggest to significantly increase the number of attempted writes in this test. Possible fix:

--- OpenSSL/test/test_ssl.py
+++ OpenSSL/test/test_ssl.py
@@ -1913,7 +1913,7 @@
         # Fill up the client's send buffer so Connection won't be able to write
         # anything.
         msg = b"x" * 512
-        for i in range(2048):
+        for i in range(2 ** 16):
             try:
                 client_socket.send(msg)
             except error as e:

@exarkun
Copy link
Member

exarkun commented Mar 22, 2014

Can you give the branch for #76 a try?

@Arfrever
Copy link
Author

It works for me.

@ihamburglar
Copy link
Contributor

Perhaps we should close this issue?

@exarkun
Copy link
Member

exarkun commented Apr 28, 2015

Original reporter commented that the issue is resolved. Yes, let's close it.

@exarkun exarkun closed this as completed Apr 28, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants