I got an issue with the worker when updating redash.

It is not related with our code. It is actually something related with a dependency from another package we use.

The logs was showing this:

[2016-09-06 21:24:04,395: ERROR/MainProcess] Task redash.tasks.execute_query[8d1ad77a-b9cf-4cf5-acc9-eef1215e8302] raised unexpected: TypeError("cannot instantiate ctype 'EVP_MD_CTX' of unknown size",)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/opt/redash/current/redash/tasks/base.py", line 13, in __call__
    return super(BaseTask, self).__call__(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 437, in __protected_call__
    return self.run(*args, **kwargs)
  File "/opt/redash/current/redash/tasks/queries.py", line 440, in execute_query
    return QueryExecutor(self, query, data_source_id, metadata).run()
  File "/opt/redash/current/redash/tasks/queries.py", line 390, in run
    data, error = query_runner.run_query(annotated_query)
  File "/opt/redash/current/redash/query_runner/big_query.py", line 191, in run_query
    bigquery_service = self._get_bigquery_service()
  File "/opt/redash/current/redash/query_runner/big_query.py", line 130, in _get_bigquery_service
    return build("bigquery", "v2", http=http)
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 132, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/apiclient/discovery.py", line 192, in build
    resp, content = http.request(requested_url)
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 132, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 475, in new_request
    self._refresh(request_orig)
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 653, in _refresh
    self._do_refresh_request(http_request)
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 677, in _do_refresh_request
    body = self._generate_refresh_request_body()
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 861, in _generate_refresh_request_body
    assertion = self._generate_assertion()
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 977, in _generate_assertion
    private_key, self.private_key_password), payload)
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/crypt.py", line 294, in make_signed_jwt
    signature = signer.sign(signing_input)
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/crypt.py", line 112, in sign
    return crypto.sign(self._key, message, 'sha256')
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 2088, in sign
    md_ctx = _ffi.new("EVP_MD_CTX*")
TypeError: cannot instantiate ctype 'EVP_MD_CTX' of unknown size

It happens when executing queries.

My fix was to install manually on the redash container the packaged cryptography==1.4:
pip install cryptography==1.4

I think we should update our requirements.txt to have this package.

Got the fix here: https://github.com/burnash/gspread/issues/407#issuecomment-243234344

Stumbled at the same issue yesterday and found the same comment :slight_smile: I guess the long term fix will be to upgrade the other libraries, but until then… https://github.com/getredash/redash/pull/1277