question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Windows development - connection fails sometimes with `urllib3` error on page load

See original GitHub issue

Describe the bug In Windows development, pages sometimes randomly fail to load in the frontend and produce urllib3 errors in the backend.

To Reproduce Steps to reproduce the behavior (if you get lucky, you’ll run into the bug):

  1. Run the start script
  2. Navigate to localhost:8181
  3. Click “LIBRARY”
  4. See error (if you’re lucky)

Observed behavior Orange error is raised in the frontend. Various urllib3 errors are raised in console. Logs added below.

Expected behavior All pages should load completely without errors in Windows devservers.

Desktop:

  • OS: Windows WSL1 and WSL2

Additional context Issue encountered in #12190.

Console logs On WSL1 (cc @MohdImran001):

WARNING  2021-03-22 11:43:20,920 base.py:281] PUT http://localhost:9200/collections [status:N/A request:10.007s]
Traceback (most recent call last):
  File "/home/skull/opensource/oppia/third_party/python_libs/elasticsearch/connection/http_urllib3.py", line 246, in perform_request
    method, url, body, retries=Retry(False), headers=request_headers, **kw
  File "/home/skull/opensource/oppia/third_party/python_libs/urllib3/connectionpool.py", line 727, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/home/skull/opensource/oppia/third_party/python_libs/urllib3/util/retry.py", line 386, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/skull/opensource/oppia/third_party/python_libs/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/home/skull/opensource/oppia/third_party/python_libs/urllib3/connectionpool.py", line 428, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/home/skull/opensource/oppia/third_party/python_libs/urllib3/connectionpool.py", line 336, in _raise_timeout
    self, url, "Read timed out. (read timeout=%s)" % timeout_value
ReadTimeoutError: HTTPConnectionPool(host='localhost', port=9200): Read timed out. (read timeout=10)
ERROR    2021-03-22 11:43:21,079 base.py:464] Traceback (most recent call last):
  File "/home/skull/opensource/oppia/third_party/python_libs/webapp2.py", line 604, in dispatch
    return method(*args, **kwargs)
  File "/home/skull/opensource/oppia/core/controllers/acl_decorators.py", line 86, in test_can_access
    return handler(self, *args, **kwargs)
  File "/home/skull/opensource/oppia/core/controllers/library.py", line 121, in get
    constants.DEFAULT_LANGUAGE_CODE])
INFO     2021-03-22 11:43:21,177 module.py:865] default: "GET /libraryindexhandler HTTP/1.1" 500 168
  File "/home/skull/opensource/oppia/core/domain/summary_services.py", line 494, in get_library_groups
    '', group['search_categories'], language_codes, 8)[0]
  File "/home/skull/opensource/oppia/core/domain/search_services.py", line 247, in search_collections
    offset=offset, size=size, ids_only=True)
  File "/home/skull/opensource/oppia/core/platform/search/elastic_search_services.py", line 222, in search
    _create_index(index_name)
  File "/home/skull/opensource/oppia/core/platform/search/elastic_search_services.py", line 48, in _create_index
    ES.indices.create(index_name)
  File "/home/skull/opensource/oppia/third_party/python_libs/elasticsearch/client/utils.py", line 152, in _wrapped
    return func(*args, params=params, headers=headers, **kwargs)
  File "/home/skull/opensource/oppia/third_party/python_libs/elasticsearch/client/indices.py", line 124, in create
    "PUT", _make_path(index), params=params, headers=headers, body=body
  File "/home/skull/opensource/oppia/third_party/python_libs/elasticsearch/transport.py", line 392, in perform_request
    raise e
ConnectionTimeout: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host='localhost', port=9200): Read timed out. (read timeout=10))

ERROR    2021-03-22 11:43:21,080 base.py:474] Exception raised: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host='localhost', port=9200): Read timed out. (read timeout=10))

On WSL2:

WARNING  2021-03-23 03:28:07,371 base.py:281] POST http://localhost:9200/collections/_search?from=0&size=9 [status:N/A request:0.001s]
Traceback (most recent call last):
  File "/home/eric/opensource/oppia/third_party/python_libs/elasticsearch/connection/http_urllib3.py", line 246, in perform_request
    method, url, body, retries=Retry(False), headers=request_headers, **kw
  File "/home/eric/opensource/oppia/third_party/python_libs/urllib3/connectionpool.py", line 727, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/home/eric/opensource/oppia/third_party/python_libs/urllib3/util/retry.py", line 386, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/eric/opensource/oppia/third_party/python_libs/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/home/eric/opensource/oppia/third_party/python_libs/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/home/eric/opensource/oppia_tools/google-cloud-sdk-304.0.0/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/python_std_lib/httplib.py", line 1055, in request
    self._send_request(method, url, body, headers)
  File "/home/eric/opensource/oppia_tools/google-cloud-sdk-304.0.0/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/python_std_lib/httplib.py", line 1095, in _send_request
    self.endheaders(body)
  File "/home/eric/opensource/oppia_tools/google-cloud-sdk-304.0.0/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/python_std_lib/httplib.py", line 1051, in endheaders
    self._send_output(message_body)
  File "/home/eric/opensource/oppia_tools/google-cloud-sdk-304.0.0/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/python_std_lib/httplib.py", line 895, in _send_output
    self.send(msg)
  File "/home/eric/opensource/oppia_tools/google-cloud-sdk-304.0.0/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/python_std_lib/httplib.py", line 857, in send
    self.connect()
  File "/home/eric/opensource/oppia/third_party/python_libs/urllib3/connection.py", line 187, in connect
    conn = self._new_conn()
  File "/home/eric/opensource/oppia/third_party/python_libs/urllib3/connection.py", line 172, in _new_conn
    self, "Failed to establish a new connection: %s" % e
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f4311f11d90>: Failed to establish a new connection: [Errno 111] Connection refused

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SAEb-aicommented, Mar 23, 2021

@MohdImran001 No, not till now.

1reaction
SAEb-aicommented, Mar 23, 2021

@EricZLou PTAL (#12108) . I think this error has also been reproduced on CircleCI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting exception in _update_chunk_length · Issue #1516
This exception is raised when urllib3 is expecting a next chunk from the server but the server doesn't provide a validly encoded chunk...
Read more >
Python request.get fails on specific site
Your code is fine. It is returning 200 and printing both 1 and 2. It could be some network issue. bugs.python.org/issue31122 This error...
Read more >
urllib3 Documentation
would expect the connection to fail. However, if that server presents a certificate that is in the system keychain then.
Read more >
Debugging 5 Common Networking Problems With Full ...
Centralizing log management across the whole infrastructure and application stack simplifies troubleshooting application issues.
Read more >
Troubleshooting
Using conda in Windows Batch script exits early · NumPy MKL library load failed · SSL connection errors · Permission denied errors during...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found