Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection reset error #134

Open
hardiksondagar opened this issue May 25, 2022 · 3 comments
Open

Connection reset error #134

hardiksondagar opened this issue May 25, 2022 · 3 comments

Comments

@hardiksondagar
Copy link

hardiksondagar commented May 25, 2022

For some queries, it is resetting connection in read package method. Same query works in pymssql and pyodbc.

Traceback (most recent call last):
  File "/home/hardiksondagar/sqlserver-sh/tds.py", line 14, in <module>
    cur.execute(query)
  File "/home/hardiksondagar/sqlserver-sh/env/lib/python3.9/site-packages/pytds/__init__.py", line 732, in execute
    self._execute(operation, params)
  File "/home/hardiksondagar/sqlserver-sh/env/lib/python3.9/site-packages/pytds/__init__.py", line 721, in _execute
    self._session.find_result_or_done()
  File "/home/hardiksondagar/sqlserver-sh/env/lib/python3.9/site-packages/pytds/tds.py", line 1605, in find_result_or_done
    marker = self.get_token_id()
  File "/home/hardiksondagar/sqlserver-sh/env/lib/python3.9/site-packages/pytds/tds.py", line 1549, in get_token_id
    marker = self._reader.get_byte()
  File "/home/hardiksondagar/sqlserver-sh/env/lib/python3.9/site-packages/pytds/tds.py", line 170, in get_byte
    return self.unpack(_byte)[0]
  File "/home/hardiksondagar/sqlserver-sh/env/lib/python3.9/site-packages/pytds/tds.py", line 165, in unpack
    buf, offset = readall_fast(self, struc.size)
  File "/home/hardiksondagar/sqlserver-sh/env/lib/python3.9/site-packages/pytds/tds_base.py", line 577, in readall_fast
    buf, offset = stm.read_fast(size)
  File "/home/hardiksondagar/sqlserver-sh/env/lib/python3.9/site-packages/pytds/tds.py", line 145, in read_fast
    self._read_packet()
  File "/home/hardiksondagar/sqlserver-sh/env/lib/python3.9/site-packages/pytds/tds.py", line 232, in _read_packet
    received = self._transport.recv_into(self._bufview[pos:], _header.size - pos)
ConnectionResetError: [Errno 104] Connection reset by peer

server info

product_version - 201326633
tds_version - 1879048192 (7.0)
mars_enabled - False
@hardiksondagar
Copy link
Author

Reducing blocksize from 4096 to 1024 in pytds.connect, fixes the issue.

@hardiksondagar
Copy link
Author

One more interesting finding is, this issue comes only when query length is more than 600 characters. Weird

@denisenkom
Copy link
Owner

Is there a way to reproduce this issue reliably?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants