mtxr / SublimeText-SQLTools

SQLTools for Sublime Text 3
https://code.mteixeira.dev/SublimeText-SQLTools/
GNU General Public License v3.0
177 stars 40 forks source link

Bug: Thread timeout is always triggered when streaming results output (MacOS) #90

Closed tkopets closed 7 years ago

tkopets commented 7 years ago

Issue Type: Bugfix/Errors Version: v0.9.0 OS: MacOS RDBMS: MySQL, PostgreSQL (probably all)

Description

When any SQLTools command is run (Exec Query, Table Description, Show Records) you always get a thread_timeout related message, after thread_timeout seconds has passed.

Command execution time exceeded 'thread_timeout'.
Process killed!

Note: cannot reproduce on Windows (most probably issue is relevant only for MacOS and Linux).

Steps to Reproduce

  1. set "use_streams": true in settings, configure connections
  2. select connection
  3. run any command that involves DB CLI (Exec Query, Table Description, Show Records)

Expected behavior: Only the output from DB CLI is expected in SQLTools output

Actual behavior: Additional message

Command execution time exceeded 'thread_timeout'.
Process killed!

is displayed in the SQLTools output after thread_timeout seconds has passed.

tkopets commented 7 years ago

I will look into it.

tkopets commented 7 years ago

Additionally, this error shows up in the Sublime Text console:

Exception in thread Thread-23:
Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "C:\Users\T.Kopets\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLToolsAPI\Command.py", line 64, in run
    results, errors = self.process.communicate(input=self.query.encode())
  File "./python3.3/subprocess.py", line 920, in communicate
  File "./python3.3/subprocess.py", line 1194, in _communicate
ValueError: write to closed file
mtxr commented 7 years ago

I forgot to call proc.terminate(), but your pull request certainly fixes it. Thanks!