[GH-ISSUE #23] BUG - Connection lost #478

Closed
opened 2026-03-13 21:38:01 +03:00 by kerem · 4 comments
Owner

Originally created by @gvmturl on GitHub (Jun 15, 2020).
Original GitHub issue: https://github.com/alexal1/Insomniac/issues/23

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 1336, in getresponse
    response.begin()
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 267, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "insomniac.py", line 221, in <module>
    main()
  File "insomniac.py", line 49, in main
    _job_handle_bloggers(device, args.bloggers, int(args.likes_count), storage, on_interaction)
  File "insomniac.py", line 105, in _job_handle_bloggers
    raise e
  File "insomniac.py", line 89, in _job_handle_bloggers
    handle_blogger(device, blogger, likes_count, storage, _on_like, on_interaction)
  File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 18, in handle_blogger
    _iterate_over_followers(device, interaction, storage, on_interaction)
  File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 69, in _iterate_over_followers
    interaction_succeed = interaction(device)
  File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 109, in _interact_with_user
    if not _open_photo_and_like(device, row, column, on_like):
  File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 143, in _open_photo_and_like
    action_bar_bottom = action_bar.bounds['bottom']
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 934, in __getattr__
    info = self.info
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 945, in info
    return self.jsonrpc.objInfo(self.selector)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 443, in wrapper
    return _JsonRPCMethod(url, method, timeout, False)(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 438, in wrapper
    return _method_obj(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 119, in __call__
    timeout=self.timeout)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\poolmanager.py", line 330, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 400, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\packages\six.py", line 735, in reraise
    raise value
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 423, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 331, in _raise_timeout
    self, url, "Read timed out. (read timeout=%s)" % timeout_value
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=9008): Read timed out. (read timeout=90)

We need something to bypass connection lost message and try again.

Thank you.

Originally created by @gvmturl on GitHub (Jun 15, 2020). Original GitHub issue: https://github.com/alexal1/Insomniac/issues/23 ``` Traceback (most recent call last): File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 421, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 416, in _make_request httplib_response = conn.getresponse() File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 1336, in getresponse response.begin() File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 306, in begin version, status, reason = self._read_status() File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\http\client.py", line 267, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 589, in readinto return self._sock.recv_into(b) socket.timeout: timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "insomniac.py", line 221, in <module> main() File "insomniac.py", line 49, in main _job_handle_bloggers(device, args.bloggers, int(args.likes_count), storage, on_interaction) File "insomniac.py", line 105, in _job_handle_bloggers raise e File "insomniac.py", line 89, in _job_handle_bloggers handle_blogger(device, blogger, likes_count, storage, _on_like, on_interaction) File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 18, in handle_blogger _iterate_over_followers(device, interaction, storage, on_interaction) File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 69, in _iterate_over_followers interaction_succeed = interaction(device) File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 109, in _interact_with_user if not _open_photo_and_like(device, row, column, on_like): File "C:\Users\User\Downloads\Insomniac2\action_handle_blogger.py", line 143, in _open_photo_and_like action_bar_bottom = action_bar.bounds['bottom'] File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 934, in __getattr__ info = self.info File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 945, in info return self.jsonrpc.objInfo(self.selector) File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 443, in wrapper return _JsonRPCMethod(url, method, timeout, False)(*args, **kwargs) File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 438, in wrapper return _method_obj(*args, **kwargs) File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\uiautomator\__init__.py", line 119, in __call__ timeout=self.timeout) File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\poolmanager.py", line 330, in urlopen response = conn.urlopen(method, u.request_uri, **kw) File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 400, in increment raise six.reraise(type(error), error, _stacktrace) File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\packages\six.py", line 735, in reraise raise value File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 672, in urlopen chunked=chunked, File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 423, in _make_request self._raise_timeout(err=e, url=url, timeout_value=read_timeout) File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 331, in _raise_timeout self, url, "Read timed out. (read timeout=%s)" % timeout_value urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=9008): Read timed out. (read timeout=90) ``` We need something to bypass connection lost message and try again. Thank you.
kerem 2026-03-13 21:38:01 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@alexal1 commented on GitHub (Jun 15, 2020):

Why did disconnection actually happen? Are you connected via cable or wifi? Maybe you touched the cable before disconnection happened or maybe it's damaged?

<!-- gh-comment-id:643985052 --> @alexal1 commented on GitHub (Jun 15, 2020): Why did disconnection actually happen? Are you connected via cable or wifi? Maybe you touched the cable before disconnection happened or maybe it's damaged?
Author
Owner

@gvmturl commented on GitHub (Jun 15, 2020):

Intermittent Wi-Fi connection.

<!-- gh-comment-id:644024075 --> @gvmturl commented on GitHub (Jun 15, 2020): Intermittent Wi-Fi connection.
Author
Owner

@gvmturl commented on GitHub (Jun 17, 2020):

Have to catch it and retry after a delay. This is the general strategy for handling RequestTimeouts.

try: #something except (ConnectionError, ReadTimeout): print(INTERNET_DOWN_MSG)

Or something like that:

try: #something except requests.exceptions.Timeout: print “Timeout occurred”

<!-- gh-comment-id:645648722 --> @gvmturl commented on GitHub (Jun 17, 2020): Have to catch it and retry after a delay. This is the general strategy for handling RequestTimeouts. ` try: #something except (ConnectionError, ReadTimeout): print(INTERNET_DOWN_MSG)` Or something like that: `try: #something except requests.exceptions.Timeout: print “Timeout occurred”`
Author
Owner

@alexal1 commented on GitHub (Jun 19, 2020):

I catch timeout exception already. The script had to start current blogger from the beginning after this crash, did it?

<!-- gh-comment-id:646656189 --> @alexal1 commented on GitHub (Jun 19, 2020): I catch timeout exception already. The script had to start current blogger from the beginning after this crash, did it?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Insomniac#478
No description provided.