You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When we run the command python manage.py populate_history --auto --batchsize 500, we get an error:
django.db.utils.ProgrammingError: ('42000', '[42000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]New transaction is not allowed because there are other threads running in the session. (3988) (SQLSetConnectAttr)')
We are using the docker image mcr.microsoft.com/mssql/server:2017-latest
In django's DATABASES settings, under OPTIONS, we pass TrustServerCertificate=yes;MARS Connection=True for extra_params [^1]
Have a model with instances that exceeds the batch_size you will pass in step 5 [*]
Follow setup instructions of django-simple-history (install package, setup middleware, etc.) up to running the populate_history command
Run the populate_history command.
[*] The point is to reproduce the scenario where the iterator (server-side db cursor) is not done returning rows to Django. If you set --batch_size to 1 and you have a model that has more than 1 instance, you should also experience the same error.
[^1] Our django databases settings would look something like,
We get an error message: django.db.utils.ProgrammingError: ('42000', '[42000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]New transaction is not allowed because there are other threads running in the session. (3988) (SQLSetConnectAttr)')
In every run of populate_history, the logs just before the error is raised shows:
The last model the command worked on is different in every run
The number of models the command worked on is different in every run
Expected behavior
Running populate_history is successful.
Screenshots
This is the stack trace,
Environment (please complete the following information):
Describe the bug
When we run the command
python manage.py populate_history --auto --batchsize 500
, we get an error:django.db.utils.ProgrammingError: ('42000', '[42000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]New transaction is not allowed because there are other threads running in the session. (3988) (SQLSetConnectAttr)')
Related:
To Reproduce
Steps to reproduce the behavior:
mcr.microsoft.com/mssql/server:2017-latest
DATABASES
settings, underOPTIONS
, we passTrustServerCertificate=yes;MARS Connection=True
forextra_params
[^1]batch_size
you will pass in step 5 [*]populate_history
commandpopulate_history
command.[*] The point is to reproduce the scenario where the iterator (server-side db cursor) is not done returning rows to Django. If you set
--batch_size
to 1 and you have a model that has more than 1 instance, you should also experience the same error.[^1] Our django databases settings would look something like,
Actual behavior
We get an error message:
django.db.utils.ProgrammingError: ('42000', '[42000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]New transaction is not allowed because there are other threads running in the session. (3988) (SQLSetConnectAttr)')
In every run of
populate_history
, the logs just before the error is raised shows:Expected behavior
Running
populate_history
is successful.Screenshots
This is the stack trace,
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: