Zymonic Toolkit Locking

From Zymonic

This page contains all of the options for:

sudo zymonic_toolkit.pl Locking

See the manual page for the locking toolkit for further details.


Quickly Fixing 'locked by ...' When the User Can't Find the Actual Block[edit]

First get the process zname and id using the debug icon:

  sudo /usr/local/bin/zymonic_toolkit.pl Locking process_required_locks --system [system]  --process [process zname] --process_id [process id]

to show if it is open in a block (near the top will be something like):

          'current_lock_details' => {
                                      'authenticated_user' => 'croberts',
                                      'block' => {
                                                   'block_id' => '44885',
                                                   'block_title' => 'Ticket',
                                                   'page_id' => 11,
                                                   'page_name' => 'Scat',
                                                   'page_zname' => 'svz_scat'
                                                 }
                                    },

If it is then it suffices to delete that block from the DB e.g.

  delete from zz_blocks where blockid =  44885;

If not then [TODO!!]

Introduction[edit]

Interpretting Results
Examples:



06-09-2017 13:58:51 - $VAR1 = {
          'current_lock' => '',
          'is_valid' => 'false',
          'key' => 'ZZLOCK.record.randomkey.6957',
          'record_id' => 'randomid=6957',
          'record_ident' => '6957',
          'records' => [
                         {
                           'amount' => '77080.00',
                           'autocreated' => 51187,
                           'catalogue_code' => '140',
                           'deleted' => undef,
                           'dept_id' => undef,
                           'has_field_permissions' => '',
                           'parent_process_id' => 51187,
                           'payment_type_id' => undef,
                           'posix_process_id' => 30238,
                           'reserved_amount' => '24710',
                           'rounding_difference' => undef,
                           'sec_id' => 'randomid',
                           'short_code' => 2,
                           'stock_holding_id' => 6957,
                           'sub_dept_id' => undef,
                           'tillsafe_id' => 180,
                           'zz_remote_keyfields' => undef,
                           'zz_source' => undef,
                           'zzlu' => '2017-09-05 09:09:19',
                           'zzluts' => '1504595983.89205'
                         }
                       ],
          'table_name' => 'randomname',
          'type' => 'record',
          'zname' => 'randomzname'
        };

06-09-2017 13:51:41 - $VAR1 = {
          'current_lock' => '',
          'is_valid' => 'false',
          'key' => 'ZZLOCK.process.12868',
          'process_id' => '12868',
          'type' => 'process',
          'zname' => 'randomzname'
        };

Lock Data

Label Type Example(s) Description
block_id Process Locks Only 124578 The block_id of the block containing the process being locked, if there is such a block.
current_lock All Lock Types user:::11584
ZZSESSION24s4zu1blg9z7yj2mjey2votwuo1l7::11478
ZZPIDserver.zymonic.com,1487::19283
ZZPIDserver.zymonic.com,1487::ZZPIDserver.zymonic.com,1487'
The current lock value, if present. Will show as empty if this lock is not in use. Format is one of the following:
  • For authenticated user: [username]:::[block_id] or [username]:::ZZPID[hostname],[pid]
  • For unauthenticated user: ZZSESSION[session cookie]:::[block_id] or ZZSESSION[session cookie]:::ZZPID[hostname],[pid]
  • For scripts: ZZPID[hostname],[pid]:::[block_id] or ZZPID[hostname],[pid]:::ZZPID[hostname],[pid]

See 'current_lock_details' for a more comprehensive breakdown of this data.
current_lock_details All Lock Types {
'authenticated_user' => 'user',
'block' => {
'block_id' => '11584',
'block_title' => 'Title',
'page_id' => 4,
'page_name' => 'random_page',
'page_zname' => 'random_zname'
}
},
Shows detailed information about the current lock value. Data can include:
  • authenticated_user - the user who has this lock
  • unauthenticated_user - contains details of the unauthenticated session which has this lock
  • block - contains details of the block that has this lock
  • script - the hostname and PId of the process that has this lock
error All Lock Types Unknown lock type If a lock cannot be parsed for some reason, details of why will be shown here. Only shows if there was an error.
is_valid All Lock Types true/false Shows true when there is a current lock and it has been verified, i.e. the owner of the lock is still using the system. Will always show false if there is not a current lock.
key All Lock Types ZZLOCK.process.123
ZZLOCK.record.random_zname.6957
Shows the key that would be used for this lock.
For process level locks, format is: ZZLOCK.process.PROCESSID
For table record level locks, format is: ZZLOCK.record.TABLENAME.RECORDIDENT
process_id Process Locks Only 124578 The process_id of the process being locked.
record_id Table Record Locks Only stock_holding_id=6957
id=123
Will show the key field(s) and value(s) of the record being locked.
record_ident Table Record Locks Only 6957 A unique identifier for the record being lock, generally it will be the key field value(s).
records Table Record Locks Only {
'amount' => '77080.00',
'autocreated' => 51187,
'catalogue_code' => '140',
'deleted' => undef,
'dept_id' => undef,
'has_field_permissions' => undef,
'parent_process_id' => 51187,
'payment_type_id' => undef,
'posix_process_id' => 30238,
'reserved_amount' => '24710',
'rounding_difference' => undef,
'sec_id' => 'randome_zname',
'short_code' => 2,
'rand' => 6957,
'sub_rand' => undef,
'tillsafe_id' => 180,
'zz_remote_keyfields' => undef,
'zz_source' => undef,
'zzlu' => '2017-09-05 09:09:19',
'zzluts' => '1504595983.89205'
}
If using the option 'show_full_records' then this will show the full record data from the DB.
table_name Table Record Locks Only random_zname
name
The name of the table containing the record being locked.
type All Lock Types record
process
The type of lock this is. Either table record locks (record), or process lock (process).
zname All Lock Types random_zname
another_random_zname
For process level locks, this will be the zname of the process being locked.
For table record level locks, this will be the zname of the table containing the record being locked.

Managing Locks
Locks found using this toolkit module can also be managed by using the 'manage_locks' option.

Option Description
V Verify each lock found. This means to check that the user (or session or script) who currently has this lock is still action within the system.
R Remove each lock found. Force remote each active lock found, regardless of who it belongs to. The next attempt to access the lock will get it.
Y Prompt for each lock. For each lock output, user will be prompted to either verify or remove the lock. There are also options to take no action on the current lock, and to stop completely.
N No action for each lock. This is the same as not setting the manage_locks option, each lock will be shown but no action will be performed against it.

Action Required Locks[edit]

Returns list of locks which would be required to run the action.

sudo zymonic_toolkit.pl Locking action_required_locks
  • System[edit]

    The system to be inspected. This is required for the command to work.

    sudo zymonic_toolkit.pl Locking action_required_locks --system SYSTEM
    
  • Configuration Directory[edit]

    The name of the directory in which Zymonic definitions are stored; defaults to "/etc/zymonic".

    sudo zymonic_toolkit.pl Locking action_required_locks --configdir FOLDERPATH
    
  • Username[edit]

    The username of the person that the command is being run for.

    sudo zymonic_toolkit.pl Locking action_required_locks --username USERNAME
    
  • Password[edit]

    The password of the person that the command is being run for. Entering ! instead of the password will cause a password prompt to appear once the command has been started.

    sudo zymonic_toolkit.pl Locking action_required_locks --password PASSWORD
    
  • IP Address[edit]

    The IP address of the person that the command is being run for. This is only needed in the few cases when the permissions being checked rely on IP address. The majority of permissions do not use IP address, as such this field can generally be ignored.

    sudo zymonic_toolkit.pl Locking action_required_locks --ip_address IP
    
  • Process ZName[edit]

    The ZName of the Process. This is required for the command to work.

    sudo zymonic_toolkit.pl Locking action_required_locks --process ZNAME
    
  • Process ID[edit]

    Process ID to use for the command being run. This is required for the command to work.

    sudo zymonic_toolkit.pl Locking action_required_locks --process_id PROCESSID
    
  • Transition ZName[edit]

    The ZName of the Transition. This is required for the command to work.

    sudo zymonic_toolkit.pl Locking action_required_locks --transition ZNAME
    
  • Action ZName[edit]

    The ZName of the Action. This is required for the command to work.

    sudo zymonic_toolkit.pl Locking action_required_locks --action ZNAME
    
  • Current Only[edit]

    Only show locks currently in use.

    sudo zymonic_toolkit.pl Locking action_required_locks --current_only yes
    
  • Lock Values Only[edit]

    Only shows unique lock values.

    sudo zymonic_toolkit.pl Locking action_required_locks --lock_values_only yes
    
  • Manage Locks[edit]

    For each current lock encountered perform an action on it. Not applicable if using lock_values_only. Options are: V = Verify each lock found, R = Remove each lock found, Y = Prompt for each lock, N = No action for each lock.

    sudo zymonic_toolkit.pl Locking action_required_locks --manage_locks ARGUMENT
    
  • Show Full Records[edit]

    By default only record ids are shown for locks, set this flag to show the full record details. WARNING: No security checks are done in this lookup, all data within the DB records will be shown.

    sudo zymonic_toolkit.pl Locking action_required_locks --show_full_records yes
    

Example[edit]

$ zymonic_toolkit.pl Locking action_required_locks  --system SYSTEM --username USER --password PASSWORD --transition icedc_p_order_t_unpack --process rand_process --process_id 56583  --action rand_action
06-09-2017 13:52:53 - Process: Name (rand_process)
06-09-2017 13:52:53 - Current State: Name (rand_state)
06-09-2017 13:52:53 - Transition: Name (rand_transition)
06-09-2017 13:52:53 - Action: Name (rand_action)
06-09-2017 13:52:53 - Found 4 lock(s) needed to run this action
06-09-2017 13:52:54 - 4 Lock(s)
06-09-2017 13:52:54 - $VAR1 = {
          'current_lock' => '',
          'is_valid' => 'false',
          'key' => 'ZZLOCK.record.rand_zname.6868',
          'record_id' => 'stock_holding_id=6868',
          'record_ident' => '6868',
          'table_name' => 'rand_table',
          'type' => 'record',
          'zname' => 'rand_zname'
        };

06-09-2017 13:52:54 - $VAR1 = {
          'current_lock' => '',
          'is_valid' => 'false',
          'key' => 'ZZLOCK.record.rand_zname.6894',
          'record_id' => 'ID=6894',
          'record_ident' => '6894',
          'table_name' => 'rand_table',
          'type' => 'record',
          'zname' => 'rand_zname'
        };

06-09-2017 13:52:54 - $VAR1 = {
          'current_lock' => '',
          'is_valid' => 'false',
          'key' => 'ZZLOCK.record.rand_zname.6936',
          'record_id' => 'ID=6936',
          'record_ident' => '6936',
          'table_name' => 'rand_table',
          'type' => 'record',
          'zname' => 'rand_zname'
        };

06-09-2017 13:52:54 - $VAR1 = {
          'current_lock' => '',
          'is_valid' => 'false',
          'key' => 'ZZLOCK.record.rand_zname.6957',
          'record_id' => 'ID=6957',
          'record_ident' => '6957',
          'table_name' => 'rand_table',
          'type' => 'record',
          'zname' => 'rand_zname'
        };

Method action_required_locks completed.

Process Required Locks[edit]

Returns list of locks which would be required to change this process at its current state.

sudo zymonic_toolkit.pl Locking process_required_locks

Required Fields[edit]

These fields are always required for the command to succeed.

  • System
    The system to be inspected.
    sudo zymonic_toolkit.pl Locking process_required_locks --system SYSTEM
    
  • Username
    The username of the person that the command is being run for.
    sudo zymonic_toolkit.pl Locking process_required_locks --username USERNAME
    
  • Password
    The password of the person that the command is being run for. Entering ! instead of the password will cause a password prompt to appear once the command has been started.
    sudo zymonic_toolkit.pl Locking process_required_locks --password PASSWORD
    
  • Process ZName
    The ZName of the Process. This is required for the command to work.
    sudo zymonic_toolkit.pl Locking process_required_locks --process ZNAME
    
  • Process ID
    Process ID to use for the command being run. This is required for the command to work.
    sudo zymonic_toolkit.pl Locking process_required_locks --process_id PROCESSID
    

Optional Fields[edit]

These fields provide optional extras on the command.

  • Configuration Directory
    The name of the directory in which Zymonic definitions are stored; defaults to "/etc/zymonic".
    sudo zymonic_toolkit.pl Locking process_required_locks --configdir FOLDERPATH
    
  • IP Address
    The IP address of the person that the command is being run for. This is only needed in the few cases when the permissions being checked rely on IP address. The majority of permissions do not use IP address, as such this field can generally be ignored.
    sudo zymonic_toolkit.pl Locking process_required_locks --ip_address IP
    
  • Current Only
    Only show locks currently in use.
    sudo zymonic_toolkit.pl Locking process_required_locks --current_only yes
    
  • Lock Values Only
    Only shows unique lock values.
    sudo zymonic_toolkit.pl Locking process_required_locks --lock_values_only yes
    
  • Manage Locks
    For each current lock encountered perform an action on it. Not applicable if using lock_values_only. Options are: V = Verify each lock found, R = Remove each lock found, Y = Prompt for each lock, N = No action for each lock.
    sudo zymonic_toolkit.pl Locking process_required_locks --manage_locks ARGUMENT
    
  • Show Full Records
    By default only record ids are shown for locks, set this flag to show the full record details. WARNING: No security checks are done in this lookup, all data within the DB records will be shown.
    sudo zymonic_toolkit.pl Locking process_required_locks --show_full_records yes
    

Example[edit]

$ zymonic_toolkit.pl Locking process_required_locks --system SYSTEM --username USER --password PASSWORD --process icedc_p_order --process_id 12868
06-09-2017 13:51:41 - Process: Name (rand_process)
06-09-2017 13:51:41 - Current State: Name (rand_state)
06-09-2017 13:51:41 - Found 1 lock(s) needed on this process and its current state
06-09-2017 13:51:41 - 1 Lock(s)
06-09-2017 13:51:41 - $VAR1 = {
          'current_lock' => '',
          'is_valid' => 'false',
          'key' => 'ZZLOCK.process.12868',
          'process_id' => '12868',
          'type' => 'process',
          'zname' => 'rand_zname'
        };

Method process_required_locks completed.

Transition Required Locks[edit]

Returns list of locks which would be required to run the transition.

sudo zymonic_toolkit.pl Locking transition_required_locks
  • System[edit]

    The system to be inspected. This is required for the command to work.

    sudo zymonic_toolkit.pl Locking transition_required_locks --system SYSTEM
    
  • Configuration Directory[edit]

    The name of the directory in which Zymonic definitions are stored; defaults to "/etc/zymonic".

    sudo zymonic_toolkit.pl Locking transition_required_locks --configdir FOLDERPATH
    
  • Username[edit]

    The username of the person that the command is being run for.

    sudo zymonic_toolkit.pl Locking transition_required_locks --username USERNAME
    
  • Password[edit]

    The password of the person that the command is being run for. Entering ! instead of the password will cause a password prompt to appear once the command has been started.

    sudo zymonic_toolkit.pl Locking transition_required_locks --password PASSWORD
    
  • IP Address[edit]

    The IP address of the person that the command is being run for. This is only needed in the few cases when the permissions being checked rely on IP address. The majority of permissions do not use IP address, as such this field can generally be ignored.

    sudo zymonic_toolkit.pl Locking transition_required_locks --ip_address IP
    
  • Process ZName[edit]

    The ZName of the Process. This is required for the command to work.

    sudo zymonic_toolkit.pl Locking transition_required_locks --process ZNAME
    
  • Process ID[edit]

    Process ID to use for the command being run. This is required for the command to work.

    sudo zymonic_toolkit.pl Locking transition_required_locks --process_id PROCESSID
    
  • Transition ZName[edit]

    The ZName of the Transition. This is required for the command to work.

    sudo zymonic_toolkit.pl Locking transition_required_locks --transition ZNAME
    
  • Current Only[edit]

    Only show locks currently in use.

    sudo zymonic_toolkit.pl Locking transition_required_locks --current_only yes
    
  • Lock Values Only[edit]

    Only shows unique lock values.

    sudo zymonic_toolkit.pl Locking transition_required_locks --lock_values_only yes
    
  • Manage Locks[edit]

    For each current lock encountered perform an action on it. Not applicable if using lock_values_only. Options are: V = Verify each lock found, R = Remove each lock found, Y = Prompt for each lock, N = No action for each lock.

    sudo zymonic_toolkit.pl Locking transition_required_locks --manage_locks ARGUMENT
    
  • Show Full Records[edit]

    By default only record ids are shown for locks, set this flag to show the full record details. WARNING: No security checks are done in this lookup, all data within the DB records will be shown.

    sudo zymonic_toolkit.pl Locking transition_required_locks --show_full_records yes
    

Example[edit]

$ zymonic_toolkit.pl Locking transition_required_locks --system SYSTEM --username USER --password PASSWORD --transition rand_transition --process rand_process --process_id 12868
06-09-2017 13:48:22 - Process: Name (rand_process)
06-09-2017 13:48:22 - Current State: Name (rand_state)
06-09-2017 13:48:23 - Transition: Name (rand_transition)
06-09-2017 13:48:29 - Found 12 lock(s) needed to run this transition
06-09-2017 13:48:31 - 12 Lock(s)
06-09-2017 13:48:31 - $VAR1 = {
          'current_lock' => '',
          'is_valid' => 'false',
          'key' => 'ZZLOCK.record.rand_zname.1008',
          'record_id' => 'stock_holding_id=1008',
          'record_ident' => '1008',
          'table_name' => 'rand_table',
          'type' => 'record',
          'zname' => 'rand_zname'
        };
...

Method transition_required_locks completed.

User Locks[edit]

Returns list of locks which would be required to run the action.

sudo zymonic_toolkit.pl Locking user_locks
  • System[edit]

    The system to be inspected. This is required for the command to work.

    sudo zymonic_toolkit.pl Locking user_locks --system SYSTEM
    
  • Configuration Directory[edit]

    The name of the directory in which Zymonic definitions are stored; defaults to "/etc/zymonic".

    sudo zymonic_toolkit.pl Locking user_locks --configdir FOLDERPATH
    
  • Username[edit]

    The username of the person that the command is being run for.

    sudo zymonic_toolkit.pl Locking user_locks --username USERNAME
    
  • Password[edit]

    The password of the person that the command is being run for. Entering ! instead of the password will cause a password prompt to appear once the command has been started.

    sudo zymonic_toolkit.pl Locking user_locks --password PASSWORD
    
  • IP Address[edit]

    The IP address of the person that the command is being run for. This is only needed in the few cases when the permissions being checked rely on IP address. The majority of permissions do not use IP address, as such this field can generally be ignored.

    sudo zymonic_toolkit.pl Locking user_locks --ip_address IP
    
  • Lock Values Only[edit]

    Only shows unique lock values.

    sudo zymonic_toolkit.pl Locking user_locks --lock_values_only yes
    
  • Manage Locks[edit]

    For each current lock encountered perform an action on it. Not applicable if using lock_values_only. Options are: V = Verify each lock found, R = Remove each lock found, Y = Prompt for each lock, N = No action for each lock.

    sudo zymonic_toolkit.pl Locking user_locks --manage_locks ARGUMENT
    
  • Show Full Records[edit]

    By default only record ids are shown for locks, set this flag to show the full record details. WARNING: No security checks are done in this lookup, all data within the DB records will be shown.

    sudo zymonic_toolkit.pl Locking user_locks --show_full_records yes
    

Example[edit]

$ zymonic_toolkit.pl Locking user_locks --system SYSTEM --username USERNAME --password PASSWORD
07-09-2017 07:45:14 - Found 18 lock(s) this user currently holds
07-09-2017 07:45:14 - 18 Lock(s)
07-09-2017 07:45:14 - $VAR1 = {
          'current_lock' => 'user:::11584',
          'current_lock_details' => {
                                      'authenticated_user' => 'user',
                                      'block' => {
                                                   'block_id' => '11584',
                                                   'block_title' => 'rand_block',
                                                   'page_id' => 4,
                                                   'page_name' => 'Name',
                                                   'page_zname' => 'rand_zname'
                                                 }
                                    },
          'is_valid' => 'true',
          'key' => 'ZZLOCK.process.120717',
          'process_id' => '120717',
          'type' => 'process'
        };

07-09-2017 07:45:14 - $VAR1 = {
          'current_lock' => 'user:::11584',
          'current_lock_details' => {
                                      'authenticated_user' => 'user',
                                      'block' => {
                                                   'block_id' => '11584',
                                                   'block_title' => 'rand_block',
                                                   'page_id' => 4,
                                                   'page_name' => 'Name',
                                                   'page_zname' => 'rand_zname'
                                                 }
                                    },
          'is_valid' => 'true',
          'key' => 'ZZLOCK.record.rand_zname.3051',
          'record_ident' => '3051',
          'table_name' => 'rand_table',
          'type' => 'record'
        };

...

Method user_locks completed.

Help[edit]

When using a terminal to run zymonic_toolkit.pl the user will see prompts that contain the same information that is found within this manual.

sudo zymonic_toolkit.pl Locking help
  • Command[edit]

    The specific command to show help for. If not set then shows help for all commands.

    sudo zymonic_toolkit.pl Locking help --command COMMAND