IBM Support

File Descriptor Limits In the Qshell and PASE Environments

Troubleshooting


Problem

This document provides the file descriptor limits and how to change them in the Qshell and PASE Environments.

Resolving The Problem

This document provides the file descriptor limits and how to change them in the Qshell and PASE Environments.

Both the Qshell and Portable Application Solutions Environments (PASE) adhere to a default and maximum number of file and socket descriptors per job or process. In this document, a file descriptor is defined, the limits for each environment is discussed, an explanation of how to change these limits is provided, and a warning regarding Perl scripting is also provided.

First, what is a File Descriptor?

A file descriptor is an abstract indicator for accessing a file. The term is generally used in the the POSIX environment. File descriptors are created when a process reads or writes to or from stream files in the Integrated File System (IFS). Typically, the processes involved are shell scripts or commands.

File Descriptor Limits for the Qshell and PASE environments

Qshell - default limit of 200; maximum of 2,500,000
PASE - default limit of 2000, maximum of 65,534

Note: The reason why the default and maximum limits differ between the Qshell and PASE environments is because the PASE environment is based on the AIX Runtime, which has its own limits. The maximum limit of 65,534 is a hardcoded limit in the PASE infrastructure and is inherited from AIX. It cannot be changed unless AIX changes its value. The Qshell environment adheres to the file system limit imposed by the IBM i operating system.

How to Display or Change the Default File Descriptor Limit

The ulimit command can be used to display or change the current resource limits for the environment.

Flags
-a Lists all of the current resource limits
-S Change and report the soft limit associated with a resource
-n Lists the default number of file descriptors a process can have
-n <integer> Changes the default number of file descriptors a process can have (PASE Only)
<integer> = 1 to 65534
Note: The -n <integer> flag is not supported in the Qshell environment. If executed, a ulimit: 001-0097 Error found setting resource limit 1. Operation not supported message is issued.

For the PASE environment, the ulimit -n <integer> command can be used to change the file descriptor limit; for example, ulimit -n 65534 (Sets the file descriptor to the maximum size of 65,534).

Because the file descriptor limits differ between the Qshell and PASE environment, the methods to change these limits also differ. For the Qshell environment, there are soft and hard limits. The soft limit is the value that the kernel enforces for the corresponding resource. The hard limit acts as a ceiling for the soft limit. The soft file descriptor limit can be changed with the ulimit -S -n <integer> command. For example, ulimit -S -n 10000. The command changes the soft file descriptor limit to 10000 for only the specific Qshell interpreter session. Note: It does not change the hard default, which gets reset in every new Qshell interpreter session.

The hard default file descriptor limit can be changed with the DosSetRelMaxFH() - Change the Maximum Number of File Descriptors API. The API would be called via a C program. You would then use the "system" Qshell command to call your C program at the beginning of a script or as the first command in the list to set up the Qshell environment. Please see the DosSetRelMaxFH() API documentation for a C program example that increases the maximum number of file descriptors by two.

Special Consideration for Perl scripts ran through Qshell

By default, Perl scripts run in the PASE environment even if executed in the Qshell environment. Because of this, Perl scripts adhere to the AIX/PASE file system default of 2000 file descriptors; however, it can be changed to a value between 1-65534. Again, the ulimit -n <integer> command would be used to change the file descriptor resource limit. If the Perl script is being ran from Qshell, the following command can be used to change the file descriptor limit and execute the Perl script or command inside of a PASE Korn shell.

"/QOpenSys/usr/bin/sh -c 'ulimit -n 65534;/home/ifstestPASE2.sh"

Note: The value of 10000 can be modified to any value between 1 - 65534. IBM does not recommend decreasing this limit past the default value of 2000.

How to determine the number of descriptors allocated within a job

You should open a service request with IBM Software Support by dialing 1-800-IBM-SERV for assistance on how to do this.

Environment variables used to set the maximum number of allowed open file descriptors:

QIBM_IFS_OPEN_MAX
(Default: "66000") Maximum number of Integrated File System open file descriptors wanted in the job. QP2SHELL and QP2SHELL call the DosSetRelMaxFH API to set the maximum number of file descriptors to the value in this ILE environment variable, and updates the environment variable to reflect the actual limit (in case the requested limit is not currently allowed). Any change to the maximum number of file descriptors persists after the API returns.

IBM PASE for i programs assume the ability to open 65 534 files and the system requires an open file for each IBM PASE for i executable it loads, so the default of 66,000 files accommodates a maximally large IBM PASE for i program with a fairly large number of loaded executables.

The difference in file descriptors between the default value in the environment variables (66,000) and the maximum limit allowed to be used by PASE applications (65,534) can be used internally by PASE for loading PASE executables, ILE code, etc. within the same PASE process. But the important thing to note is the maximum limit for PASE applications is 65,534.

PASE_QIBM_IFS_OPEN_MAX
An undocumented environment variable used internally by PASE. This environment variable is used in a similar fashion as QIBM_FS_OPEN_MAX. IBM does not recommend setting this environment variable manually. You should use the QIBM_IFS_OPEN_MAX environment variable instead if the maximum number of allowed open file descriptors needs to be changed for the PASE environment.

The QIBM_IFS_OPEN_MAX environment variable is documented at the following URL: https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/apis/qp2shell.htm

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CJRAA2","label":"PASE"},{"code":"a8m0z0000000CHQAA2","label":"Qshell"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.3.0;and future releases"}]

Historical Number

631474304

Document Information

Modified date:
25 November 2024

UID

nas8N1011024