Infinte loop on remote connection
- 主要言語
- Python
- スター
- 1.4k
- フォーク
- 191
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Since I reinstalled my system to Debian 10 I can no longer connect to a remote `mssql` server.
When I try to connect to a remote server the process never ends (and utilizes 100% of one CPU thread). It produces following trace if killed by `^C`:
```
^CTraceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/dist-packages/mssqlcli/main.py", line 122, in
main()
File "/usr/local/lib/python3.7/dist-packages/mssqlcli/main.py", line 115, in main
run_cli_with(mssqlcli_options)
File "/usr/local/lib/python3.7/dist-packages/mssqlcli/main.py", line 52, in run_cli_with
mssqlcli.connect_to_database()
File "/usr/local/lib/python3.7/dist-packages/mssqlcli/mssql_cli.py", line 278, in connect_to_database
owner_uri, error_messages = self.mssqlcliclient_main.connect_to_database()
File "/usr/local/lib/python3.7/dist-packages/mssqlcli/mssqlcliclient.py", line 91, in connect_to_database
owner_uri, error_messages = self._execute_connection_request_with(connection_params)
File "/usr/local/lib/python3.7/dist-packages/mssqlcli/mssqlcliclient.py", line 188, in _execute_connection_request_with
time.sleep(time_wait_if_no_response)
KeyboardInterrupt
```
It seems infinite loop is in progress [here](https://github.com/dbcli/mssql-cli/blob/master/mssqlcli/mssqlcliclient.py#L188).
I tried mutliple versions of both `python3` and `python 2.7`, all with the same result.
Current versions:
* mssql-cli `1.0.0`
* Debian `10.9` (but the same occurred for `10.8` and `10.7` as well)
* Python `3.7.3` or `2.7.16` (again, the same occurred on all previously installed versions as well)
* Server version: `Microsoft SQL Server 2014 (SP2-GDR) (KB4019093) - 12.0.5207.0 (X64)`
I tried to install `mssql-cli` on the remote server and then I can connect normally. The same applies for local connections - these work OK as well.
The only specific I know of is that the remote server is only accessible via `PPTP` VPN. But this posed no problem before I reinstalled my system (it was Ubuntu 18.04).
Similarly I can connect to the remote database using all other means. For example, this simple script connects there OK as well:
```python
#!/usr/bin/python3
import pymssql
conn = pymssql.connect(
server='',
user='',
password='',
database='')
cursor = conn.cursor()
cursor.execute("""
SELECT id
FROM dbo.person
ORDER BY person.id DESC
;""")
row = cursor.fetchone()
i = 0
while row:
print(str(row[0]))
row = cursor.fetchone()
i += 1
if i > 50:
break
```
(This hints that neither the VPN nor particular OS or python versions are the cause of the problem IMHO)
I have searched the issues here (and using search engines) thoroughly but at no avail.
Please let me know if more debugging data have to be provided.
It is no april's fools joke :smiley:
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
リモート接続の失敗を再現し、connect_to_database から到達する mssqlcli/mssqlcliclient.py の188行目付近のループから調査を始めてください。その経路を、動作するローカル接続およびスタンドアロンの pymssql スクリプトと比較してください。リモート接続が完了するか、CPUスレッドを無期限に消費するのではなく、範囲が限定された有用なエラーを報告すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python, sql
- 領域
- cli, databases
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100