mongodump crashing - _S_create_c_locale name not valid (2.4.1)

4,174 views
Skip to first unread message

Chris Kimpton

unread,
Apr 8, 2013, 12:48:53 PM4/8/13
to mongod...@googlegroups.com
Hi,

I am trying to dump my prod DB (has auth turned on, replicaset, but not sharded) and I am getting this error:

$ mongodump -u wowfeed -p
connected to: 127.0.0.1
Enter password:
Mon Apr  8 18:40:58.286 all dbs
Mon Apr  8 18:40:58.286 DATABASE: admin to dump/admin
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
[1]    988 abort      mongodump -u wowfeed -p

It works fine on my laptop with similar settings.

Any thoughts on what it might be?

Server runs on linux/OpenVZ... so that might be the issue - but it has worked before, at least pre-2.4.1

Thanks in advance,
Chris

William Zola

unread,
Apr 9, 2013, 5:25:22 PM4/9/13
to mongod...@googlegroups.com
Hi Chris!

This is a Boost error.  What values do you have in your environment for $LANG and $LC_ALL?


 -William

Chris Kimpton

unread,
Apr 10, 2013, 2:17:33 AM4/10/13
to mongod...@googlegroups.com
Hi William,

Ok - thanks for the reply:

$ echo $LANG
en_GB.UTF-8

$echo $LC_ALL

Nothing - not set.

I tried setting LC_ALL to the same as LANG, but still crashes.

Any tips on how to check my version of boost - dont see anything in /lib, /usr/lib nor an exe called boost.

Thanks,
Chris




--
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb
 
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/vJpJNzCareY/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

William Zola

unread,
Apr 10, 2013, 10:13:55 AM4/10/13
to mongod...@googlegroups.com
Hi Chris!

Try running your 'mongodump' as follows:

$ LANG=C mongodump -u wowfeed -p

What happens?  This should prevent the error.

Also, for diagnostic purposes, can you run 

$ ldd mongodump

And post the output, please.

Cheers!

 -William 

Chris Kimpton

unread,
Apr 10, 2013, 1:31:26 PM4/10/13
to mongod...@googlegroups.com
Hi William,

Here is what happened:

$ LANG=C mongodump -u wowfeed -p
connected to: 127.0.0.1
Enter password:
Wed Apr 10 18:28:30.440 all dbs
Wed Apr 10 18:28:30.440 DATABASE: admin to dump/admin
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
[1]    26987 abort      LANG=C mongodump -u wowfeed -p

$  export LANG=C; mongodump -u wowfeed -p
connected to: 127.0.0.1
Enter password:
Wed Apr 10 18:28:50.539 all dbs
Wed Apr 10 18:28:50.539 DATABASE: admin to dump/admin
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
[1]    26999 abort      mongodump -u wowfeed -p

$  ldd /usr/bin/mongodump
linux-vdso.so.1 =>  (0x00007ffff7fdb000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ffff7db6000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ffff7bae000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ffff78ad000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffff75b1000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ffff739b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff6fdb000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffff7fdd000)


On 10 April 2013 15:13, William Zola <willia...@10gen.com> wrote:
Hi Chris!

Chris Kimpton

unread,
May 6, 2013, 10:50:34 AM5/6/13
to mongod...@googlegroups.com
Thanks - that did the trick.

~kimptoc


On 26 April 2013 20:39, Ivan <ivan.gr...@mercadolibre.com> wrote:
Hi, try setting

export LC_ALL=C

Regards

--

Robert Reiz

unread,
Jul 17, 2013, 5:22:32 AM7/17/13
to mongod...@googlegroups.com
In my case this is set LC_ALL=C and it still doesn't work. 
I ma getting this error message: 

terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid



On Friday, April 26, 2013 9:39:19 PM UTC+2, Ivan wrote:
Hi, try setting

export LC_ALL=C

Regards

El lunes, 8 de abril de 2013 13:48:53 UTC-3, Chris Kimpton escribió:

Adam C

unread,
Jul 17, 2013, 5:55:18 AM7/17/13
to mongod...@googlegroups.com
Can you comment on what version and OS you are using and paste how you are actually starting mongod?

Don't forget that if an environment variable is the cause, you either have to be setting and starting the mongod with the same user (preferably the same line), or you have to export it as a global variable.

So, for example, if you set this as user "adam" and then start it as a service (or use sudo to start as another user), that is not going to help - you will need to add the setting to the init script (or upstart conf etc.) for it to be picked up by the service.

Also worth noting that this is sometimes resolved by logging out and back in (re-inits all the variables).

Adam

Robert Reiz

unread,
Jul 17, 2013, 6:20:44 AM7/17/13
to mongod...@googlegroups.com
Hi Adam, 

I am using the current version of mongod which is available as debian package. Just installed it yesterday. 
This is the output from /proc/version: 

Linux version 3.5.0-23-generic (buildd@komainu) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013

I will play around with the env variables. 


--
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb
 
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.

Robert Reiz

unread,
Jul 17, 2013, 6:24:01 AM7/17/13
to mongod...@googlegroups.com
By the way. I am running MongoD as service. This is the output from ps -ef | less | grep mongo

/usr/bin/mongod --config /etc/mongodb.conf

Starting and stoping with /etc/init.d/mongod start|stop|restart

It's running under the mongodb user. 

Robert Reiz

unread,
Jul 17, 2013, 6:28:07 AM7/17/13
to mongod...@googlegroups.com
One more thing. With mongodump I try to dump a db from another server. That means the mongod process which is running on my server shouldn't be relevant for that. Right? 

Robert Reiz

unread,
Jul 17, 2013, 6:32:10 AM7/17/13
to mongod...@googlegroups.com
LC_ALL=C and LANG=C but that has no effect. Still getting the same error. 

Robert Reiz

unread,
Jul 17, 2013, 6:32:38 AM7/17/13
to mongod...@googlegroups.com
ldd /usr/bin/mongodump
linux-vdso.so.1 =>  (0x00007fff36dff000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4aae584000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f4aae37c000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f4aae07b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4aadd7f000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4aadb69000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4aad7a9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4aae7a9000)

Adam C

unread,
Jul 17, 2013, 6:45:19 AM7/17/13
to mongod...@googlegroups.com
This is what I was getting at - if you are starting the mongod as a service, but setting the LC_ALL variable on your local user, it will never make it to the mongodb user that the mongod is running as.  That user is the one with the locale issue.  You can modify the upstart script in Ubuntu, you can try setting it in  /etc/default/locale, or you can try regenerating your locale - for more information on that, take a look here

https://help.ubuntu.com/community/Locale

Just to note, this is essentially a problem with your environment/OS, so the true way to fix it lies there (and in figuring out what might have screwed up your locale settings to stop it happening again) - the setting of LC_ALL locally is really just a workaround.

Adam

Robert Reiz

unread,
Jul 17, 2013, 7:32:38 AM7/17/13
to mongod...@googlegroups.com
No I am setting the variable directly in the init script in "/etc/init.d/mongodb" like this: 

LC_ALL=C
LANG=C

It doesn't has any effect. 
If mongo needs this variables why will it not set by the installation process? What's why they offer a dep package. Right? 
I am googling now 24 hours for this problem but currently this is just not working for me! :-/ 


Adam C

unread,
Jul 17, 2013, 8:13:40 AM7/17/13
to mongod...@googlegroups.com
The dependency is actually not from MongoDB itself but rather the boost libraries that MongoDB uses for IO etc.  It's also not required to set these variables in 99.9% (or more) of cases because they are not screwed up in the first place and mongod and the rest of the binaries all just run without a problem.  This is very much an edge case, and usually stems from something screwing up the locale settings, or having something wrong on the system in terms of locale in general.

If setting the variables in your init script is not working, it's usually best to try to remove upstart from consideration entirely.  Can you try running mongod manually from the command line (preferably with a test or temporary dbpath, log file etc. so that you don't end up with permissions problems) from your own user account, see if running in that way lets mongod start successfully.  Something like this for example (sub in a valid path for mongod and for the temporary data path):

/path/to/mongod --smallfiles --port 30001 --noprealloc --dbpath /home/user/tempmongo

If this throws the error, then try setting the LC_ALL variable and try again.  

Adam.

Robert Reiz

unread,
Jul 17, 2013, 8:37:19 AM7/17/13
to mongod...@googlegroups.com
./mongod --smallfiles --port 30001 --noprealloc --dbpath /data/db/

That didn't worked either. Getting again a: 

exception in initAndListen std::exception: locale::facet::_S_create_c_locale name not valid, terminating

What is C the alias for? I checked my /etc/locale.alias and there is no C entry. An "echo $C" outputs nothing. It seems the C itself is empty. What should be the value of it? 

Michael Grundy

unread,
Jul 17, 2013, 8:40:01 AM7/17/13
to mongod...@googlegroups.com
When someone ran into locale issues before, I found this helps:

Run locale -a, make sure you have all the locales listed in /etc/default/locale (the output of just running locale). You can fix this by running sudo dpkg-reconfigure locales



You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.

Robert Reiz

unread,
Jul 17, 2013, 9:01:59 AM7/17/13
to mongod...@googlegroups.com
All right. I added this to "/etc/environment"

LC_ALL="en_US.UTF-8"

And rebooted the server. That solve my problems. 
Many Thanks for the help. 

Robert
Reply all
Reply to author
Forward
0 new messages