Issue2486

classification
Title: SSL illegal-state exception in jsonrpc
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Milestone: Jython 2.7.0
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: pradeeppanayal, zyasoft
Priority: Keywords:

Created on 2016-03-17.13:15:23 by pradeeppanayal, last changed 2016-09-08.23:42:18 by zyasoft.

Messages
msg10822 (view) Author: pradeeppanayal (pradeeppanayal) Date: 2016-03-17.13:15:21
I am getting the ssl illegal state exception frequently but not always. 

I am using jsonrpc lib with an added wrapper to the method " _request" as follows

@trust_all_certificates
def _request(self, methodname, params, rpcid=None):
    request = dumps(params, methodname, encoding=self.__encoding,
                    rpcid=rpcid, version=self.__version)
    response = self._run_request(request)
    check_for_errors(response)
    return response['result']
and the wrapper is taken from : http://tech.pedersen-live.com/2010/10/trusting-all-certificates-in-jython/ as follows,

def trust_all_certificates(f):
'''Decorator function that will make it so the context of the    decorated method
will run with our TrustManager that accepts all certificates'''
def wrapped(*args, **kwargs):
    # Only do this if running under Jython
    if 'java' in sys.platform:
        from javax.net.ssl import SSLContext
        SSLContext.setDefault(TRUST_ALL_CONTEXT)
        try:
            res = f(*args, **kwargs)
            return res
        finally:
            SSLContext.setDefault(DEFAULT_CONTEXT)
    else:
        return f(*args, **kwargs)
return wrapped
msg10844 (view) Author: Jim Baker (zyasoft) Date: 2016-04-27.21:46:09
Possibly related to #2462
msg10947 (view) Author: Jim Baker (zyasoft) Date: 2016-09-08.23:42:18
Is this still a problem, given the fix in #2462?
History
Date User Action Args
2016-09-08 23:42:18zyasoftsetmessages: + msg10947
2016-04-27 21:46:10zyasoftsetnosy: + zyasoft
messages: + msg10844
2016-03-17 13:15:23pradeeppanayalcreate