Tuesday, March 31, 2015

Intermittent "Can't initialize character set latin1 errors" after centos 6 install

Hello,
We have an application that doesn't have much user interaction, mostly list displays that has been stable for quite some time. We haven't changed it since moving to django 1.6.5
but centos was just upgraded from 5 to 6 on the server we need to work on.
After this we started noticing intermittent:
OperationalError: (2019, "Can't initialize character set latin1 (path: /usr/share/mysql/charsets/)")
errors. 

These errors will show up randomly for 7-18 minutes, perhaps twice a week, and I can't discern any pattern for when they're showing up.
When they stop happening, I can hit the same urls, with no content/data changed, and it's fine.

We are using mysql-python 1.2.5


When we check the db, it's:
| character_set_database | utf8            |
| collation_database     | utf8_general_ci |


Settings are:
DATABASES = {
     'default': {
        'ENGINE': 'django.db.backends.mysql', 
        'NAME': 'dbname',                    
        'USER': 'dbuser',                     
        'PASSWORD': 'dbpassword',                
        'HOST': 'host',                    
        'PORT': '',    
        "OPTIONS": { 
        'sql_mode': 'TRADITIONAL,STRICT_ALL_TABLES,ANSI', 
'connect_timeout': 10, 
'charset': 'utf8', 
'init_command': 'SET storage_engine=INNODB', 

       }
}

We just added the sql_mode to match settings from other applications on the server, but the error was happening without it. We haven't been able to reproduce it. The server shows:

SHOW variables LIKE '%character_set%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d5abca0b-105c-4f0f-8c22-b91a18fd6d3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment