Technical article 104803

The policy manager daemon dies and is unable to restart,increase unix sockets

OpenServer 5.0.0

Written · Last revised

Problem

The policy manager fails during normal system use and
is unable to restart itself.  This will restrict or
prohibit the use of many system services.

Solution

The policy manager uses a system resource called unix
domain sockets.  During heavy system use, this resource
may become exhausted.  If that happens, the policy manager
will fail, prohibiting the use of many system services.
At that point it is advisable to shutdown the system if
a root user is logged on, or to power off the system and
restart it as soon as all users have exited their work.

There is no readily available kernel tunable parameter which allows for the addition of more unix domain sockets.

The following shell script may be added to the directory /usr/lib/mkdev and then run to configure more unix domain sockets into the kernel.

To use, save this information script into a file.  Then
delete the portion up to and including the line below
labeled, "Shell script to increase unix domain sockets".
Make a copy of the resulting file to the /usr/lib/mkdev
directory:
cp <filename> /usr/lib/mkdev/uds

Change the mode of the file to read and executable:

chmod 555 /usr/lib/mkdev/uds

The syntax of the mkdev uds command is:

mkdev uds [-q]  |  [-n num]

The command "mkdev uds -q" will display the current number of configured unix domain sockets.

mkdev uds -n num
The command "mkdev uds -n [num]"  will increase the number
of available unix domain sockets by the designated number
amount.

======== Shell script to increase unix domain sockets =======

# @(#) uds.mdkev 1.1 1/1/1
#
#       Copyright (C) 1995 The Santa Cruz Operation, Inc.
#               All Rights Reserved.
#       The information in this file is provided for the exclusive use of
#       the licensees of The Santa Cruz Operation, Inc.  Such users have the
#       right to use, modify, and incorporate this code into other products
#       for purposes authorized by the license agreement provided they include
#       this notice and the associated copyright notice with any such product.
#       The information in this file is provided "AS IS" without warranty.
#
#
USOCOTS="usocots"
USOCLTS="usoclts"
SOCKDRVR="socket"
#
# Prompt for yes or no answer with message passed as argument -
# returns non-zero for no
#
getyn() {
        if [ -n "$2" ]; then
                str="\n$1 [y/n/q: $2] \c"
        else
                str="\n$1 (y/n/q) \c"
        fi
        while   echo $str >&2
        do      read yn rest
                case $yn in
                        [yY]) return 0
                                ;;
                        [nN]) return 1
                                ;;
                        [qQ]) exit 1
                                ;;
                          "") if [ -n "$2" ]; then
                                        case "$2" in
                                                [yY]) return 0
                                                        ;;
                                                [nN]) return 1
                                                        ;;
                                        esac
                                fi
                                echo "Please answer y,n or q" >&2
                                ;;
                        *) echo "Please answer y,n or q" >&2
                                ;;
                esac
        done
}
changeparm () {
        _currdir=`pwd`
        _name=$1
        _value=`expr $2 : '+\(.*\)' \| $2`      # Remove leading + if present
cd /etc/conf/cf.d
curval=`./configure -y $_name | tail -1`
if [ -z "$curval" ]
then
        cd $_currdir
        return
fi
        newval=`expr $curval + $_value`
        #
        # Check the new value against the maximum specified
        # in mtune.
        #
        [ "$newval" -ge "0" ] && {
                set -- `grep $_name mtune`
                [ "$newval" -gt "$4" ] && newval=$4
                /etc/conf/bin/idtune -f $_name $newval
        }
        cd $_currdir
        return $OK
}
# last_mdev returns the number of entries in the mdevice file with first field
# equal to the string passed as first argument.
#
last_mdev () {
        cntd_entr=0
        [ "$_upgrade" -a -f ${CCS_PERSISTENT_STORAGE}/sco_tcp.misc ] && {
                . ${CCS_PERSISTENT_STORAGE}/sco_tcp.misc
        } || {
                cntd_entr=`awk -e 'BEGIN { entries = 0 } \
                        \$1 == "'"$1"'" { entries ++ } \
                        END { print entries }' \
                        /etc/conf/cf.d/mdevice`
                N_SOCKET=`expr 256 \* $cntd_entr`
        }
        return
}
# If extra entries are necessary to accommodate devices with
# extended minor device number then this functions creates them
# by calling sconfigxtr_mdev() for the three different devices required.
# Called as:    sconfigxtr <No of devices asked to be created>
#
sconfigxtr () {
        sconfigxtr_mdev $1 1
        sconfigxtr_mdev $1 2
        sconfigxtr_mdev $1 3
        change="Y"
}
#
# If extra entries are necessary to accommodate devices with
# extended minor device number then this functions creates them.
# This functions is doing this job by being called separately for
# the three different devices required.
# Called as:    sconfigxtr <No of devices asked to be created> <1,2,3>
#
sconfigxtr_mdev () {
        _cwd=`pwd`
        cd /etc/conf/cf.d
        case "$2" in
                1) name=$USOCOTS
                   name2="usco"
                   flg2="oc"
                   flg3="iScM"
                   maj=`/etc/conf/cf.d/configure -j $USOCOTS`
                   line="usocots\tY\t256\t0\t0\t0\t0\t0\t0\t0"
                   file=/etc/conf/sdevice.d/$USOCOTS
                   ;;
                2) name=$USOCLTS
                   name2="uscl"
                   flg2="oc"
                   flg3="iScM"
                   maj=`/etc/conf/cf.d/configure -j $USOCLTS`
                   line="usoclts\tY\t256\t0\t0\t0\t0\t0\t0\t0"
                   file=/etc/conf/sdevice.d/$USOCLTS
                   ;;
                3) name=$SOCKDRVR
                   name2="sock"
                   flg2="ocrwis"
                   flg3="icM"
                   maj=`/etc/conf/cf.d/configure -j $SOCKDRVR`
                   line="socket\tY\t256\t0\t0\t0\t0\t0\t0\t0"
                   file=/etc/conf/sdevice.d/$SOCKDRVR
                   ;;
        esac
last_mdev $name
dev_num=$N_SOCKET
        # number of devices configured
entr_exs=`expr $dev_num / 256`
entr_req=`expr \( $dev_num + $1 \) / 256`
        # mdevice entries to exist after the creation of the extra nodes
entr_xtr=`expr $entr_req - $entr_exs`
        # mdevice entries to be added in mdevice after
        # the creation of the extra nodes
if [ "$entr_xtr" -gt 0 ]
then
        i=0
        while [ "$i" -lt "$entr_xtr" ]
        do
                next_maj=`/etc/conf/cf.d/configure -j NEXTMAJOR`
                off_set=`expr \( $entr_exs + $i \) \* 256`
entry="$name\t$flg2\t$flg3\t$name2\t0\t$next_maj\t$maj\t$off_set\t-1"
                        echo $entry >> /etc/conf/cf.d/mdevice
                        echo $line >> $file
                        i=`expr $i + 1`
                done
        fi
        cd $_cwd
}
do_relink() {
    cd /etc/conf/cf.d
    echo "\nRe-linking the kernel ... " >&2
    ./link_unix -y || {
            echo "Error:  Kernel link failed." >&2
            exit 1
    }
    return
}
ask_and_relink () {
    if getyn "Do you wish to relink the kernel now?"
    then
        do_relink
    else
        echo "\nThe kernel must be re-linked before proceeding."
    fi
}
USAGE="Usage: /usr/lib/mkdev/uds [-q] | [-n num]\n\
\t-q\t\tquery the number of unix domain sockets\n\
\t-n num\t\tadd \"num\" unix domain sockets"
if [ $# = 0 ]
then
        echo $USAGE
        exit 1
fi
nuds=0
while getopts qn: c
do
        case $c in
        q)      # tell them how many
                nlines=`grep $USOCOTS /etc/conf/cf.d/mdevice | wc -l`
                nsock=`expr $nlines \* 256`
                echo $nsock
                exit 0
                ;;
        n)      # add some
                nuds=$OPTARG
                [ "$nuds" -gt 0 ] || {
                        echo $USAGE
                        exit 1
                }
                sconfigxtr $nuds
                changeparm NSTREAM +$nuds
                ask_and_relink
                exit 0
                ;;
        esac
done
echo $USAGE
exit 1

From the Xinuos technical article database, record 104803. Reproduced with permission. The original is at www.sco.com/ta/104803, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.