On Sun, Oct 10, 2010 at 17:12, Erik Cederstrand <e...@cederstrand.dk> wrote:
>
> * Are you keeping a connection open to MySQL the whole time?
I do not know what is the default behaviour of django, but I did not specify
any custom option.

> * What are the values of your timeout settings in the MySQL server
configuration?
Here is the my.cnf without comments for brevity's sake:
[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]
user            = mysql
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
skip-external-locking

key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
myisam-recover         = BACKUP
query_cache_limit       = 1M
query_cache_size        = 16M
general_log_file        = /var/log/mysql/mysql.log
general_log             = 1
log_error                = /var/log/mysql/error.log
log_slow_queries        = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes
expire_logs_days        = 10
max_binlog_size         = 100M
binlog_do_db            = include_database_name
binlog_ignore_db        = include_database_name

[mysqldump]
quick
quote-names
max_allowed_packet      = 16M

[isamchk]
key_buffer              = 16M
!includedir /etc/mysql/conf.d/


> * Anything in the MySQL server error log?
nothing unusual in the error log, just the log coming from the two
/etc/init.d/mysql.d restart I issued today.

> * Anything in the MySQL slow query log, if you have that set up?
Yes I set it up.
Lots of query issued by my program are in the query log, with no errors
reported.
the last one is at 16:08:34 and the error was returned at 16:08:47.

> * Which process(es) on the server is using 100% CPU time?
directly from htop:
PID USER     PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
544 mader     20   0  969M  953M  1444 R 96.0 47.4 50:09.85 python
./manage.py celeryd -l warning

> I suspect that you're opening a connection to the server,
> doing something in Django for a long time, and then
> trying to use the connection. At this point MySQL has
> lost patience and closed the connection.
The db is queried by my code often: the maximum time between two successive
queries is no more than 10 seconds, the source of this info is
mysql-slow.log.
Again, I do not know how django handles connections...

The python function / task raising this error is part of a billing program.

The task elaborates a csv file with the calls made by the customers: each
call "searches" the db for info about the calling number owner and the cost
of the called number and other things.
Through empirical tests, I noticed that the error raises after about 165000
lines(=calls) are elaborated (the file usually contains about 245000), but
everything is fine with fewer.
One solution could be splitting the file in pieces and then unifying the
results but it's not understanding and solving the problem, but just
circumventing it...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to