nflocks

July 26, 2006

nflocks(5) - number of file locks

  • References
  • Check /var/adm/syslog/syslog.log
  • it is the application’s responsibility to write to syslog regarding inability to obtain a file lock
  • for example:
    Jun 24 17:13:11 usnbru25 smbd[5407]:
       nt_printing_init: Failed to open nt formsdatabase /var/opt/samba/locks/ntforms.tdb (No locks available)
Dec 4 10:06:15 frodo nmbd[1243]: tdb(/usr/local/samba/locks/unexpected.tdb): tdb_lock failed on list 3 ltype=2 (No locks available)
Dec 4 10:05:38 frodo qpopper[27188]: csmith at 192.168.0.152 (192.168.0.152): -ERR [SYS/TEMP] flock: ‘/var/mail/.csmith.pop’: No locks available (46)

  • Monitoring file lock usage - with Glance, with q4 script, or with lsof

  • Glance shows “File Locks (nflocks)” usage in the System Tables screen. (keyboard short cut is ‘t’). To monitor usage, here’s a glance adviser script below.  This script can be run periodically from cron to monitor nflocks usage over time.
  • nflocks.adviser script:
    print GBL_STATDATE,” “,GBL_STATTIME,” Total
    nflocks: “,TBL_FILE_LOCK_AVAIL,”  nflocks in-use: “,TBL_FILE_LOCK_USED
  • command line to run from
    cron
    :
    # glance -j 1 -iterations 1 -adviser_only
    -syntax \

    /home/erich/nflocks.adviser 2>/dev/null | head -1
    >>/var/adm/nflocks.log
  • q4 script -
    #!/usr/bin/sh

    /usr/contrib/bin/q4
    /stand/vmunix /dev/mem
      <<-EOF
    load struct
    locklist from &locklist max nflocks

    keep ll_count !=
    0

    EOF


    (note: You may need to run
    q4pxdb
    /stand/vmunix
    ” if you get complaints
    from q4)

  • For example:

    # ./nflocks.sh

    see help topic q4live regarding use of /dev/mem

    Reading kernel symbols …

    Reading data types …

    Initialized PA-RISC 1.1 (no buddies) address translator …

    Initializing stack tracer …

    Get the latest Q4 news by typing “news | more”.

    loaded 200 struct locklists as an array (stopped by max count)

    kept 7 of 200 struct locklist’s, discarded 193

    #

  • lsof - The unsupported tool called lsof can be used.
  • For example:
  • For a pure count of how many locks are in-use, use:
  • # ./lsof | awk ‘{print $4}’| sed -n ‘/^[0-9]/p’ |sed ’s/[0-9]*//’ | awk ‘{if (length($1) > 1) print $1}’ | wc -l
  • NOTE:this magic brought to you by carefull reading of the lsof(8) man pagethat explains the FD (4th field) as a file descriptor number followedby rwu, space, or “-”, and then followed by one of NrRwWuUx (see lsof(8) man page at “The HP-UX Porting and Archive Centre”:
    [Canada  UnitedKingdom  USA Utah] for full details).

  • NOTE: lsof is an unsupported utility available
  • Comments »

    The URI to TrackBack this entry is: http://ericherberholz.blogsome.com/2006/07/26/nflocks/trackback/

    No comments yet.

    RSS feed for comments on this post.

    Leave a comment

    Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



    Anti-spam measure: please retype the above text into the box provided.

    Get free blog up and running in minutes with Blogsome
    Theme designed by Viewfinder Design