[solved] litespeed files locking

Discussion in 'General' started by bobykus, Sep 4, 2013.

  1. bobykus

    bobykus Member

    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.

    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: Sep 6, 2013
  2. mistwang

    mistwang LiteSpeed Staff

    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:
    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")
  3. bobykus

    bobykus Member

    Perfect, thank you!
    BTW, do you think it can cause performance degradation?
  4. mistwang

    mistwang LiteSpeed Staff

    It depends, maybe a little bit.
  5. bobykus

    bobykus Member

    Well,

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

    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?
  6. mistwang

    mistwang LiteSpeed Staff

    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.
  7. bobykus

    bobykus Member

    Ah, OK - so it is all because of WP!

Share This Page