SDP-804 #2

  • //
  • spec/
  • job/
  • SDP-804
  • View
  • Commits
  • Open Download .zip Download (5 KB)
# The form data below was edited by tom_tyler
# Perforce Workshop Jobs
#
#  Job:           The job name. 'new' generates a sequenced job number.
#
#  Status:        Job status; required field.  There is no enforced or
#                 promoted workflow for transition of jobs from one
#                 status to another, just a set of job status values
#                 for users to apply as they see fit.  Possible values:
#
#                 open - Issue is available to be worked on.
#
#                 inprogress - Active development is in progress.
#
#                 blocked - Issue cannot be implemented for some reason.
#
#                 fixed - Fixed, optional status to use before closed.
#                 
#                 closed - Issue has been dealt with definitively.
#
#                 punted - Decision made not to address the issue,
#                    possibly not ever.
#
#                 suspended - Decision made not to address the issue
#                    in the immediate future, but noting that it may
#                    have some merit and may be revisited later.
#
#                 duplicate - Duplicate of another issue that.
#
#                 obsolete - The need behind the request has become
#                    overcome by events.
#
#  Project:       The project this job is for. Required.
#
#  Severity:      [A/B/C] (A is highest)  Required.
#
#  ReportedBy     The user who created the job. Can be changed.
#
#  ReportedDate:  The date the job was created.  Automatic.
#
#  ModifiedBy:    The user who last modified this job. Automatic.
#
#  ModifiedDate:  The date this job was last modified. Automatic.
#
#  OwnedBy:       The owner, responsible for doing the job. Optional.
#
#  Description:   Description of the job.  Required.
#
#  DevNotes:      Developer's comments.  Optional.  Can be used to
#                 explain a status, e.g. for blocked, punted,
#                 obsolete or duplicate jobs.  May also provide
#                 additional information such as the earliest release
#                 in which a bug is known to exist.
#
# Component:      Projects may use this optional field to indicate
#                 which component of the project a given job is associated
#                 with.
#
#                 For the SDP, the list of components is defined in:
#                 //guest/perforce_software/sdp/tools/components.txt
#
#  Type:          Type of job [Bug/Feature/Problem].  Required.
#                 Feature and Bug are common terms.
#                 A Problem is suspected bug, or one without a clear
#                 understanding of exactly what is broken.
#
#  Release:       Release in which job is intended to be fixed.

Job:	SDP-804

Status:	open

Project:	perforce-software-sdp

Severity:	B

ReportedBy:	sgcommon

ReportedDate:	2022/06/15 14:20:38

ModifiedBy:	tom_tyler

ModifiedDate:	2022/09/01 20:48:26

OwnedBy:	sgcommon

Description:
	p4state.sh on case-insensitive servers doesn't find p4d processes to run strace/lsof on. 
	
	Reproduction steps:
	
	    Rev. SDP/MultiArch/2021.2/28649 (2022/03/03).
	
	The verify_sdp.sh doesn't seem to complain about any misconfiguration:
	
	    Verified: Target for P4D= in /p4/1/bin/p4d_1 is correct (/p4/common/bin/p4d_1_bin).
	
	and the running p4d processes show up in 'ps'  as /p4/common/bin/p4d_1_bin:
	
	    $ ps -ef | grep p4d_1
	    perforce 16396   1 0 Jun07 ?    00:00:00 /p4/common/bin/p4d_1_bin -C1 -p 1666
	    perforce 17238 16396 0 12:58 ?    00:00:00 /p4/common/bin/p4d_1_bin -C1 -p 1666
	    perforce 28203 19552 0 13:31 pts/0  00:00:00 grep --color=auto p4d_1
	
	which p4dstate.sh doesn't find because p4dstate.sh uses p4_vars to set up the environment to run p4dstate in:
	
	    /p4/common/bin/p4_vars $SDP_INSTANCE
	
	which sets P4DBIN incorrectly; p4dstate uses P4DBIN to find the p4d processes to lsof/strace:
	
	    getpids()
	    {
	        printf "ps -e | grep '%s$'" `echo $P4DBIN | sed 's/.*\/\([^\/]*\)$/\1/'` \
	            | sh \
	            | sed 's/^[^0-9]*\([0-9]*\)[^0-9]*.*/\1/'
	    }
	
	so you end up getting no strace/lsof data because the running p4d processes for a -C1 server in SDP use a different binary name, p4d_1_bin:
	and not what p4_vars sets for P4DBIN which is p4d_1 (P4DBIN=/p4/1/bin/p4d_1) and is subsequently used in getpids(). 
	
	I've worked around this locally by manually setting P4DBIN in p4dstate.sh after p4_vars runs:
	
	    P4DBIN=/p4/common/bin/p4d_1_bin
	
	which then results in subsequent p4dstate.sh runs finding the p4d processes and running strace/lsof on them,. 
	
	We seem to be the ones setting P4D to /p4/common/bin/p4d_1_bin when -C1 is in use:
	
	    $ cat /p4/1/bin/p4d_1
	    #!/bin/bash
	    P4D=/p4/common/bin/p4d_1_bin
	    exec $P4D -C1 "$@"

DevNotes:

Component:	core-unix

Type:	Bug
# Change User Description Committed
#2 default
#1 default