Skip to content

Commit

Permalink
Workaround for #190 and #207
Browse files Browse the repository at this point in the history
For some reason, when Package Control updates Anaconda in Windows, the
winsocks enter in an inconsistent state that produce several problems,
being the most critical one a total unresponsiveness of the ST3.

What Package Control do is just disable the package, install the update
and then re-enable de package, if you do that manually, it seems to work
just fine. I am being able to reproduce this behaviour after anaconda
automatic updates only.

The commit just detect when a socket enter in inconsistent state, then
show an error message to the user and stop the asynchronous poll (this
should not make ST3 unresponsive).
  • Loading branch information
DamnWidget committed Aug 24, 2014
1 parent fa36357 commit 000876d
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions anaconda_lib/ioloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,24 +274,39 @@ def loop():
"""Main event loop
"""

def restart_poll(error):
print('Unhandled exception in poll, restarting the poll request')
print(error)
for traceback_line in traceback.format_exc().splitlines():
print(traceback_line)

with IOHandlers()._lock:
for handler in IOHandlers()._handler_pool.values():
handler.close()
IOHandlers()._handler_pool = {}

def inner_loop():

while NOT_TERMINATE:
try:
poll()
time.sleep(0.01)
except OSError as error:
if os.name != 'posix' and error.errno == os.errno.WSAENOTSOCK:
msg = (
'Unfortunately, the Windows socket is in inconsistent'
' state, restart your sublime text 3. If the problem '
'persist, fill an issue report on:'
' https://github.com/DamnWidget/anaconda/issues'
)
print(msg)
import sublime
sublime.error_message(msg)
terminate()
else:
restart_poll(error)
except Exception as error:
print(
'Unhandled exception in poll, restarting the poll request'
)
print(error)
for traceback_line in traceback.format_exc().splitlines():
print(traceback_line)

with IOHandlers()._lock:
for handler in IOHandlers()._handler_pool.values():
handler.close()
IOHandlers()._handler_pool = {}
restart_poll(error)

# cleanup
for handler in IOHandlers()._handler_pool.values():
Expand Down

0 comments on commit 000876d

Please sign in to comment.