Re: Strange Errors when Using MySQL DB

2021-08-21 Thread Jason
https://code.djangoproject.com/ticket/13906 might give some backgroud on 
this.  tl;dr its django setting the default transaction

the errors your seeing are mysql bugs, would it be possible to update to a 
newer version or at least the latest patch of 5.7?

On Friday, August 20, 2021 at 12:05:20 PM UTC-4 bikram...@homelane.com 
wrote:

> I have a Django (v2.2.23) application connected to a MySQL (v5.7) 
> database. Every now and then, for a few minutes at a time, all my DB 
> queries start to fail with one of the following errors: "Unknown MySQL 
> Error" (error code 2000), "InterfaceError", or "Malformed Packet" (error 
> code 2027). The errors resolve themselves on their own after a few minutes, 
> but then they pop up again a some time later (on average, every few hours). 
> These errors happen seemingly at random and I haven't found any reliable 
> way to reproduce them till now. There is nothing wrong with the code as far 
> as I can see because when the queries do execute, they work as expected and 
> give the correct results.
>
> I have already made several attempts to fix the issue to no avail, 
> including :-
>
>- Following all the steps given in this article 
>
>- Increasing the value of connect_timeout and wait_timeout 
>
> 
>- Changing the charset used in the table in my DB (tried latin1 and 
>utf8)
>- Upgrading the Python mysqlclient package 
> to the latest version (2.0.3)
>
> This error is occuring both on local and staging environments.
>
> In order to debug this further, I create a custom exception handler and 
> logged the error as well as the last 3 SQL queries 
> 
>  executed 
> (which I got using connection.queries[-3:]).
>
> The result is given below:
> 'EXCEPTION': InterfaceError(0, ''), 'LAST_QUERIES': [{'sql': 'SET SESSION 
> TRANSACTION ISOLATION LEVEL READ COMMITTED', 'time': '0.000'}, {'sql': 
> None, 'time': '0.000'}] 
>
> Notice that for the second query, the value of 'sql' is coming as None. Is 
> Django trying to execute a null query? Could this be the cause of the 
> strange, intermittent errors? Is this a bug inside Django or have I 
> configured something incorrectly?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eb26b775-eac6-4ea5-a2c2-35f240268f3fn%40googlegroups.com.


Strange Errors when Using MySQL DB

2021-08-20 Thread 'Bikramjeet Singh' via Django users
I have a Django (v2.2.23) application connected to a MySQL (v5.7) database. 
Every now and then, for a few minutes at a time, all my DB queries start to 
fail with one of the following errors: "Unknown MySQL Error" (error code 
2000), "InterfaceError", or "Malformed Packet" (error code 2027). The 
errors resolve themselves on their own after a few minutes, but then they 
pop up again a some time later (on average, every few hours). These errors 
happen seemingly at random and I haven't found any reliable way to 
reproduce them till now. There is nothing wrong with the code as far as I 
can see because when the queries do execute, they work as expected and give 
the correct results.

I have already made several attempts to fix the issue to no avail, 
including :-

   - Following all the steps given in this article 
   
   - Increasing the value of connect_timeout and wait_timeout 
   

   - Changing the charset used in the table in my DB (tried latin1 and utf8)
   - Upgrading the Python mysqlclient package 
    to the latest version (2.0.3)

This error is occuring both on local and staging environments.

In order to debug this further, I create a custom exception handler and 
logged the error as well as the last 3 SQL queries 

 executed 
(which I got using connection.queries[-3:]).

The result is given below:
'EXCEPTION': InterfaceError(0, ''), 'LAST_QUERIES': [{'sql': 'SET SESSION 
TRANSACTION ISOLATION LEVEL READ COMMITTED', 'time': '0.000'}, {'sql': 
None, 'time': '0.000'}] 

Notice that for the second query, the value of 'sql' is coming as None. Is 
Django trying to execute a null query? Could this be the cause of the 
strange, intermittent errors? Is this a bug inside Django or have I 
configured something incorrectly?

-- 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f81df377-2ddf-4b18-89e1-8991b028dea2n%40googlegroups.com.