[Resolved] litespeed files locking

Status
Not open for further replies.

bobykus

Well-Known Member
#1
We are using NFS for users data and now faced with issue. litespeed keeps files locked for a longer period, even correspondent php process is ended. It means, f.ex., you can not update Wordpress correctly. During update process WP deleting some files in folders. But it fails because of .nfs files present and locked. It is well known NFS feature called silly rename -http://nfs.sourceforge.net/ . So it looks like

wp-content/themes/twentytwelve/js/.nfs0000000090a508c80000020f

can not be removed. And yes, file is locked by web server process for some time.
Code:
lsof | grep .nfs0000000090a508c80000020f
litespeed 29471 httpd mem REG 0,23 863 2426734792 ..../wp-content/themes/twentytwelve/js/.nfs0000000090a508c80000020f (...:/mnt/data/.../home)
even lsphp process is done and nobody else access web site. from WP point of view you have a broken site, because update process fails in theme deleting stage and you have no default theme at all!
Is it possible to avoid web sites files locking by litespeed process?
 
Last edited by a moderator:

mistwang

LiteSpeed Staff
#2
LiteSpeed uses MMAP to optimize static file delivery. but in this case, MMAP has to be avoided. You need to change server configuration under tuning tab:
Code:
Max MMAP File Size (bytes): 0
Total MMAP Cache Size (bytes): 0
Use Asynchronized disk I/O (AIO): Yes    (Do not use "Keep file mapped")
 
Last edited by a moderator:

bobykus

Well-Known Member
#5
Well,

The issue still exists - tried to update WP plugins and get

Code:
The update process is starting. This process may take a while on some hosts, so please be patient.

Enabling Maintenance mode…

Updating Plugin Updater (1/2)
Downloading update from http://downloads.wordpress.org/plugin/updater.1.10.zip…
Unpacking the update…
Installing the latest version…
Removing the old version of the plugin…
Plugin update failed.
An error occurred while updating Updater: Could not remove the old plugin.

lsof  | grep  wp-content/plugins/updater/css/.nfs00000000744e488700000001
litespeed 11226        httpd   38r      REG       0,23     3669 1951287431 ...wordpress361/wp-content/plugins/updater/css/.nfs00000000744e488700000001 (...)

grep -i mmap /usr/local/lsws/conf/httpd_config.xml
    <maxMMapFileSize>0</maxMMapFileSize>
    <totalMMapCacheSize>0</totalMMapCacheSize>

grep useAIO  /usr/local/lsws/conf/httpd_config.xml
    <useAIO>1</useAIO>

What else to adjust to avoid litespeed of locking files on NFS?
 
Last edited by a moderator:

mistwang

LiteSpeed Staff
#6
litespeed 11226 httpd 38r REG 0,23 3669 1951287431 ...wordpress361/wp-content/plugins/updater/css/.nfs00000000744e488700000001 (...)
It means that the file is opened with file handle #38, still being accessed by clients.
It is not MMAPed. web server need to keep the file open in order to send the file back to clients. The css is a file used during performing the update. web server keep the file open when a file is accessed, and wait for a little while to close it up when nobody accessing the file to avoid repeatedly open/close the same file.

And it is not possible to completely avoid this kind situation not matter we do in the web server, even we close the file more frequently, what if the file being accessed while update script trying to remove the directory?
it should be addressed in the updater script to take that into account.
 

bobykus

Well-Known Member
#8
Well,

Looks like the issue still exists. It is reproducible when I' trying to update or deinstall w3 total cache plugin in WP. Files in js folder remains, .nfsxxx fines are locked by litespeed process. The settings are exactly as you recommend.
 

mistwang

LiteSpeed Staff
#9
Open a file is expensive as we have to go through all the security checks, so LiteSpeed will keep the file open when it was serving to someone, we already added logic to close the file as soon as LiteSpeed done serving that file.

We will revisit it in our 5.0 release see if anything more we can do about it.

So, when PHP script try to remove a folder under NFS, "rm -r folder_name" will fail if someone is till accessing a file under that folder even the file will be closed in timely manner. I do not think there is a perfect solution for it.
 

mistwang

LiteSpeed Staff
#11
You are asking if possible to serve content of a file without opening it. :)
We will do more testing to make sure that server does not keep the file open for reuse.
You can check if new NFS client implementation see if have implementation that does not rely on silly rename.
 

mistwang

LiteSpeed Staff
#12
Please try 4.2.12, it is more aggressive with closing open file descriptors.
For user experiencing NFS silly rename trouble, can configure LSWS to cache small files in memory when possible to minimize open files by tuning
"Max Cached Small File Size", "Total Small File Cache Size", can start from

"Max Cached Small File Size" = 100K
"Total Small File Cache Size" = 100M

http://www.litespeedtech.com/docs/webserver/config/tuning#maxCachedFileSize
 
Status
Not open for further replies.
Top