# Unknown mlockall error 0

**URL:** <https://discuss.elastic.co/t/unknown-mlockall-error-0/7811>\
**Category:** Elasticsearch\
**Created:** [May 22, 2012, 7:33pm UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811 "2012-05-22T19:33:47Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [May 22, 2012, 7:33pm UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/1 "2012-05-22T19:33:47Z")

</div>

In my elasticsearch.yml I set:

bootstrap.mlockall: true

But on startup (elasticsearch 0.19.4) I see this message:

[WARN][common.jna] Unknown mlockall error 0

My /etc/security/limits.conf (Ubuntu 10.04 LTS) has this:

elasticsearch - nofile 64000  
elasticsearch - memlock unlimited

Also I can see that:

$ sudo -u elasticsearch /bin/sh -c ulimit -l  
unlimited

Any ideas what else could preventing mlockall from working?

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [May 23, 2012, 8:58am UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/2 "2012-05-23T08:58:03Z")

</div>

> My /etc/security/limits.conf (Ubuntu 10.04 LTS) has this:
> 
> elasticsearch - nofile 64000  
> elasticsearch - memlock unlimited

Try adding this line to /etc/pam.id/common-session:

```
session required pam_limits.so

```

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [May 23, 2012, 6:36pm UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/3 "2012-05-23T18:36:42Z")

</div>

On May 23, 1:58 am, Clinton Gormley [cl...@traveljury.com](mailto:cl...@traveljury.com) wrote:

> > My /etc/security/limits.conf (Ubuntu 10.04 LTS) has this:
> 
> > elasticsearch - nofile 64000  
> > elasticsearch - memlock unlimited
> 
> Try adding this line to /etc/pam.id/common-session:
> 
> ```
> session required pam_limits.so
> 
> ```

Thanks; I added that line to /etc/pam.d/common-session, but still get  
the same warning when starting elasticsearch with "bootstrap.mlockall:  
true".

I'm using OpenJDK (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3), could that  
be an issue?

---

<div class="post-metadata">

**Author:** ![James\_Carr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james_carr/32/956_2.png) [@James\_Carr](https://discuss.elastic.co/u/James_Carr)\
**Post date:** [November 15, 2013, 12:49pm UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/4 "2013-11-15T12:49:27Z")

</div>

Eric did you ever get a solution to this? I'm having the same problem on  
ubuntu 13.04 with java 1.7.0\_25. :S

On Wednesday, May 23, 2012 1:36:42 PM UTC-5, Eric Jain wrote:

> On May 23, 1:58 am, Clinton Gormley [cl...@traveljury.com](mailto:cl...@traveljury.com) wrote:
> 
> > > My /etc/security/limits.conf (Ubuntu 10.04 LTS) has this:
> > 
> > > elasticsearch - nofile 64000  
> > > elasticsearch - memlock unlimited
> > 
> > Try adding this line to /etc/pam.id/common-session:
> > 
> > ```
> > session required pam_limits.so 
> > 
> > ```
> 
> Thanks; I added that line to /etc/pam.d/common-session, but still get  
> the same warning when starting elasticsearch with "bootstrap.mlockall:  
> true".
> 
> I'm using OpenJDK (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3), could that  
> be an issue?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [November 15, 2013, 5:06pm UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/5 "2013-11-15T17:06:38Z")

</div>

On Fri, Nov 15, 2013 at 4:49 AM, James Carr [james.r.carr@gmail.com](mailto:james.r.carr@gmail.com) wrote:

> Eric did you ever get a solution to this? I'm having the same problem on  
> ubuntu 13.04 with java 1.7.0\_25. :S

No, still haven't got this to work.

OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [November 15, 2013, 9:02pm UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/6 "2013-11-15T21:02:54Z")

</div>

That is not a JVM related problem.

If there is enough free RAM on a 64-bit Linux/JVM environment, a setting of

soft memlock unlimited  
 hard memlock unlimited

in /etc/security/limits.conf should work ( must logout and login of  
course).

Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [November 16, 2013, 3:08am UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/7 "2013-11-16T03:08:18Z")

</div>

On Fri, Nov 15, 2013 at 1:02 PM, [joergprante@gmail.com](mailto:joergprante@gmail.com)  
[joergprante@gmail.com](mailto:joergprante@gmail.com) wrote:

> That is not a JVM related problem.
> 
> If there is enough free RAM on a 64-bit Linux/JVM environment, a setting of
> 
> soft memlock unlimited  
> hard memlock unlimited
> 
> in /etc/security/limits.conf should work ( must logout and login of  
> course).

That does not appear to be sufficient, at least not on Ubuntu (when  
running elasticsearch as a non-interactive user).

Found a possible solution at  
[http://www.dctrwatson.com/2012/03/limits-conf-and-daemons-on-ubuntu/](http://www.dctrwatson.com/2012/03/limits-conf-and-daemons-on-ubuntu/),  
but am still getting the "unknown mlockall error 0" after updating the  
/etc/pam.d/common-session\* files...

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [November 16, 2013, 6:23pm UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/8 "2013-11-16T18:23:15Z")

</div>

Is the OS running in a virtual machine?

Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [November 16, 2013, 6:33pm UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/9 "2013-11-16T18:33:04Z")

</div>

On Sat, Nov 16, 2013 at 10:23 AM, [joergprante@gmail.com](mailto:joergprante@gmail.com)  
[joergprante@gmail.com](mailto:joergprante@gmail.com) wrote:

> Is the OS running in a virtual machine?

Yes (ec2); but that shouldn't matter?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [November 16, 2013, 7:25pm UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/10 "2013-11-16T19:25:03Z")

</div>

I'm not familiar with EC2 to be honest, but afaik EC2 is equivalent to Xen  
virtualization.

EC2 comes in two flavors: PVM or HVM (paravirtualized and  
hardware-virtualized VM).

Only in HVM the hugepage feature can be enabled (which is what  
memlock=unlimited effectively activates). The hugepage Linux kernel feature  
is important for the mlockall() call since only these pages of 2M size can  
be pinned down to RAM.

In PVM I am quite sure that hugepages kernel feature and mlockall() will  
not work at all, the host OS will steal pages whenever it likes.

Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [November 16, 2013, 7:40pm UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/11 "2013-11-16T19:40:02Z")

</div>

On Sat, Nov 16, 2013 at 11:25 AM, [joergprante@gmail.com](mailto:joergprante@gmail.com)  
[joergprante@gmail.com](mailto:joergprante@gmail.com) wrote:

> In PVM I am quite sure that hugepages kernel feature and mlockall() will not  
> work at all, the host OS will steal pages whenever it likes.

My instances are indeed paravirtualized, no need chasing this goose then.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:06am UTC](https://discuss.elastic.co/t/unknown-mlockall-error-0/7811/12 "2017-07-06T02:06:37Z")

</div>


