dbcli / dbcli/mssql-cli

Infinte loop on remote connection

Ouverte
#512 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
1.4k
Forks
191
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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:

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Reproduisez l’échec de la connexion distante et commencez dans mssqlcli/mssqlcliclient.py, au niveau de la boucle autour de la ligne 188, atteinte depuis connect_to_database. Comparez ce chemin avec la connexion locale fonctionnelle et le script pymssql autonome. La tâche est terminée lorsque la connexion distante aboutit ou signale une erreur limitée et utile, au lieu de consommer indéfiniment un thread CPU.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python, sql
Domaine
cli, databases
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.