Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 81378

Summary: memlock option not working
Product: [Retired] Red Hat Linux Reporter: Ion Badulescu <ionut>
Component: mysqlAssignee: Tom Lane <tgl>
Status: CLOSED UPSTREAM QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: hhorak
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-02-03 18:35:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
fix for memlock problem none

Description Ion Badulescu 2003-01-08 16:52:54 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003

Description of problem:
If the mysql daemon is runing as a non-root user, it calls mlockall() after
switching uid's and consequently it fails to lock itself into memory.

All mysql versions are affected, from rh72 through rawhide.

The patch I'm attaching is against 3.23.54a (rawhide). It may not be the ideal
fix, but it is obviously correct and works for me.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. add "memlock" to the [mysqld] section in /etc/my.cnf
2. start mysqld
3. check its memlocked status (the L flag in the "ps ax" output)

Actual Results:  11958 pts/0    S      0:01  \_ /usr/libexec/mysqld

Expected Results:  12228 pts/0    SL     0:02  \_ /usr/libexec/mysqld

Additional info:

Non-working memlock causes mysqld to get paged out occassionally, with the
expected negative effects on performance.

Comment 1 Ion Badulescu 2003-01-08 16:54:18 UTC
Created attachment 89216 [details]
fix for memlock problem

Comment 2 Tom Lane 2004-02-03 18:35:30 UTC
Since this is a fairly noncritical issue, I don't think we should
maintain a private fix for it.  The bug should be filed upstream, that
is with MySQL AB.  (A quick look suggests that the issue is still
present in MySQL 4.0.17.)