Skip to content

Packages are allowed to hang Sublime Text Indefinitely #1463

@evandrocoan

Description

@evandrocoan

Packages are allowed to hang Sublime Text Indefinitely

For example, a plugin command call may enter on while( true ) causing Sublime Text to became unresponsive indeterminately forcing the user to kill the process as the only way to fix it.

This behavior can be noticed on several applications as the Mozilla Firefox. But on other applications as Google's Chrome it is not true. The nature around Google's chrome is that everything dangerous is spammed on separate thread, and soon as the Chrome's Task Manager noticed hand/blocking threads, it prompts to the user's whether to kill them or wait.

The simple thing for this is not run unknown procedures on the main Sublime Text process, as any simple thing may hang. Only run certain deterministic procedures on the main Sublime Text process and a create watchdogs for trouble some routines.

Related issues:

  1. file indexer causes hanging on large directories #1296 _ file indexer causes hanging on large directories
  2. Closing network connection causes ST to permanently hang #763 _ Closing network connection causes ST to permanently hang
  3. #23760/3 _ Automatically set SQL keywords to upper case

Another example is the SQLExec package, if the start a connection to the SGBD and the SGBD prompt for the password. The package was not expecting it, then Sublime Text hands indefinitely doing absolutely nothing as it is waiting for the user to put the password, event which will never happen.

Expected behavior

Is expected that packages are not allowed to hang Sublime Text indefinitely.

Actual behavior

If some package enters on while true or takes too much to perform its actions, Sublime Text may hang indefinitely.

Steps to reproduce

  1. Create a package as this:
class DefaultSyntaxCommand(sublime_plugin.EventListener):

    def on_new(self, view):

        view.set_syntax_file("Packages/C++/C++.tmLanguage")

        while True :
            print( 'bitch\n' )
  1. Create a new file, and Sublime Text will hang for ever and ever.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions