java_tls_test suite fails with test error then hangs indefinitely
JoshRosen opened this issue · comments
The src/py4j/tests/java_tls_test.py
test errors out and then hangs indefinitely, both in local tests and in GitHub Actions. This problem appears to be specific to that suite, since all other test suites run correctly.
I'm filing this ticket so that I can reference it in a PR porting the tests to GitHub Actions: for now, I'm adding a flag to skip this suite until we can fix it but I don't want the test port to block on that.
When running
python -m nose src/py4j/tests/java_tls_test.py
I don't see any streaming output. When I interrupt the hanging test with ctrl-C, I see error messages about being unable to connect to the Java server:
======================================================================
ERROR: testMethodConstructor (py4j.tests.java_tls_test.TestIntegration)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/joshrosen/py4j/py4j-python/src/py4j/tests/java_tls_test.py", line 90, in testMethodConstructor
oe1 = self.gateway.jvm.py4j.examples.OperatorExample()
File "/Users/joshrosen/py4j/py4j-python/src/py4j/java_gateway.py", line 1700, in __getattr__
"\n" + proto.END_COMMAND_PART)
File "/Users/joshrosen/py4j/py4j-python/src/py4j/java_gateway.py", line 1036, in send_command
connection = self._get_connection()
File "/Users/joshrosen/py4j/py4j-python/src/py4j/java_gateway.py", line 984, in _get_connection
connection = self._create_connection()
File "/Users/joshrosen/py4j/py4j-python/src/py4j/java_gateway.py", line 990, in _create_connection
connection.start()
File "/Users/joshrosen/py4j/py4j-python/src/py4j/java_gateway.py", line 1132, in start
raise Py4JNetworkError(msg, e)
Py4JNetworkError: An error occurred while trying to connect to the Java server (localhost:25333)
-------------------- >> begin captured logging << --------------------
py4j.java_gateway: DEBUG: set_default_callback_accept_timeout is deprecated and will be removed in version 1.0. Use CallbackServerParameters instead.
py4j.java_gateway: DEBUG: set_default_callback_accept_timeout is deprecated and will be removed in version 1.0. Use CallbackServerParameters instead.
py4j.java_gateway: INFO: Callback Server Starting
py4j.java_gateway: INFO: Socket listening on ('127.0.0.1', 25334)
py4j.java_gateway: ERROR: An error occurred while trying to connect to the Java server (localhost:25333)
Traceback (most recent call last):
File "/Users/joshrosen/py4j/py4j-python/src/py4j/java_gateway.py", line 1120, in start
self.socket.connect((self.address, self.port))
File "/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 864, in connect
self._real_connect(addr, False)
File "/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 851, in _real_connect
socket.connect(self, addr)
File "/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
error: [Errno 61] Connection refused
--------------------- >> end captured logging << ---------------------
Looking at the code, I suspect that ssl.PROTOCOL_TLSv1 may be the culprit. It is deprecated by many libraries and servers and either the JDK, the python version or a dependency such as openssl must have blocked TLS v1. I'll try to investigate this.