IllegalStateException from LazyChannelPromise (Issue 2174) is back
"HADDLETON, Robert W (Bob)" <[email protected]>
| Newsgroups | gmane.comp.lang.jython.user |
|---|---|
| Message-ID | <[email protected]> |
I'm using Jython 2.7b4 and the requests module over an SSL connection,
and I'm seeing intermittent "Illegal state exception" errors that I
managed to trace back to the netty SslHandler, with the same signature
documented by issue 2174: http://bugs.jython.org/issue2174
The Java stack trace I'm seeing is similar:
java.lang.IllegalStateException
at
org.python.netty.handler.ssl.SslHandler$LazyChannelPromise.executor(SslHandler.java:1427)
at
org.python.netty.util.concurrent.DefaultPromise.checkDeadLock(DefaultPromise.java:388)
at
org.python.netty.util.concurrent.DefaultPromise.await(DefaultPromise.java:251)
at
org.python.netty.util.concurrent.DefaultPromise.sync(DefaultPromise.java:218)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
at
org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
at org.python.core.PyObject.__call__(PyObject.java:461)
at org.python.core.PyObject.__call__(PyObject.java:465)
at org.python.core.PyMethod.__call__(PyMethod.java:126)
at
_socket$py._handle_channel_future$70(/opt/jython/Lib/_socket.py:783)
at _socket$py.call_function(/opt/jython/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at
org.python.core.PyFunction.function___call__(PyFunction.java:471)
at org.python.core.PyFunction.__call__(PyFunction.java:466)
at org.python.core.PyFunction.__call__(PyFunction.java:461)
at org.python.core.PyObject._callextra(PyObject.java:601)
at _socket$py.handle_exception$30(/opt/jython/Lib/_socket.py:370)
at _socket$py.call_function(/opt/jython/Lib/_socket.py)
at org.python.core.PyTableCode.call(PyTableCode.java:167)
at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
at org.python.core.PyBaseCode.call(PyBaseCode.java:161)
at org.python.core.PyFunction.__call__(PyFunction.java:434)
at org.python.core.PyMethod.__call__(PyMethod.java:156)
at ssl$py.do_handshake$8(/opt/jython/Lib/ssl.py:154)
Sometimes it works fine 10 times in a row and sometimes it fails 10
times in a row. Usually it's intermittent with random failures. It
appears to be a timing window or race condition causing the problem.
I saw that a workaround for 2174 was provided by patch set
http://hg.python.org/jython/rev/f6c9712832d0 and resolved by
http://hg.python.org/jython/rev/2c45f75a5406
So I re-added the workaround sleep(0.1) call before the sync() call,
this time in _socket.py:
def _handle_channel_future(self, future, reason):
# All differences between nonblocking vs blocking with optional
timeouts
# is managed by this method.
#
# All sockets can be selected on, regardless of
blocking/nonblocking state.
future.addListener(self._notify_selectors)
if self.timeout is None:
log.debug("Syncing on future %s for %s", future, reason,
extra={"sock": self})
+ time.sleep(0.1) # FIXME do we need this sleep?
return future.sync()
elif self.timeout:
self._handle_timeout(future.await, reason)
if not future.isSuccess():
log.debug("Got this failure %s during %s",
future.cause(), reason, extra={"sock": self})
print "Got this failure %s during %s (%s)" %
(future.cause(), reason, self)
raise future.cause()
return future
else:
return future
and the problem went away.
I don't know much about SSL so I don't know what the real fix should be,
but I wanted to at least document the problem and the workaround in case
others run into it.
Please let me know if there is anything I can do to help debug it
further, and also if you want me to create an issue for it.
Thanks
Bob
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users
bob_haddleton.vcf
(text/x-vcard, 304 B)
begin:vcard fn:Bob Haddleton n:Haddleton;Bob org:Cloud Innovation Center adr:;;2000 Lucent Ln;Naperville;IL;60563;United States email;internet:[email protected] title:Application On-Boarding Architect tel;work:630-224-6934 tel;fax:630-224-6934 tel;cell:630-805-2990 version:2.1 end:vcard