IBM Support

Increased Storage Usage For QTCP Profile Due To Issue with Cleaning Up SMTP Internal Mail Control Block Objects

News


Abstract

IBM APAR SE76906 was created to report an issue with the IBM i SMTP Server and Client where increased storage usage was found for the QTCP profile due to internal SMTP Mail Control Block (MCB) objects not being freed properly after use. This might lead to an MCH2804 message for the QTCP profile or an MCH6903 message to occur and cause SMTP or QMSF jobs to end suddenly or prevent the SMTP Server or Mail Server Framework (MSF) server from starting. Users can use the "PRTPRFINT SELECT(*USRPRF) USRPRF(QTCP)" CL command to verify the QTCP profile storage usage amount.

Apply the following PTF to prevent the issue and provide the QTCP/QTMSWRKMCB list/cleanup program.

IBM i 7.5 - 5770TC1-SI80016
IBM i 7.4 - 5770TC1-SI80087
IBM i 7.3 - 5770TC1-SI80088

Content

IBM advises all clients download and apply the following PTF to resolve APAR SE76906.  This APAR was created to document a known issue where internal SMTP Mail Control Blocks (MCBs) were not being freed properly after use by the SMTP Server and Client causing increased storage usage under the QTCP user profile.  In addition, APAR SE77994 was created to enhance the cleanup process for the email directory type *SDD.
IBM i 7.5 - 5770TC1-SI80016
IBM i 7.4 - 5770TC1-SI80087
IBM i 7.3 - 5770TC1-SI80088
The above PTFs were marked HIPER and are included in the following IBM i HIPER Group PTF levels.
IBM i 7.5 - SF99959 level 6
IBM i 7.4 - SF99739 level 83
IBM i 7.3 - SF99729 level 161
The PTF is an immediate apply and can be installed using the following instructions.
ENDMSF
ENDTCPSVR *SMTP
ENDTCPSVR *POP
LODPTF LICPGM(5770TC1) DEV(*SERVICE) SELECT(SI800XX)
APYPTF LICPGM(5770TC1) SELECT(SI800XX) APY(*TEMP) DELAYED(*NO) APYREQ(*YES)
STRTCPSVR *POP
STRTCPSVR *SMTP
STRMSF
After the PTF is applied, IBM advises you to execute the following CL command to list the total number of Mail Control Blocks (MCBs) that exist on your IBM i server.
CALL QTCP/QTMSWRKMCB 'LIST'
The output from this command will be logged to the current job log.  Execute the DSPJOBLOG CL command, F10, and then page up to display the output.  The output should look something like this if zero MCB objects currently exist on your IBM i server.
CALL QTCP/QTMSWRKMCB 'LIST'               
SMTP *SDD Objects *MCB  # 0000000000 : 000
SMTP *SDD Objects *BAD  # 0000000000 : 000
If the *MCB object count is a significant amount (in the thousands or millions), IBM recommends you review and complete one of the advised options to clean up your IBM i SMTP Mail Control Block (MCB) internal objects to avoid and resolve any email issues.
First, verify your IBM i SMTP Email Directory Type by prompting the CHGSMTPA CL command with a F4.
NOTE:  If you email directory type is *SMTP or *SMTPMSF, all of the options below are applicable.  If your email directory type is *SDD, Option 1 is NOT available to you.

Option 1 - Only applies to the *SMTP and *SMTPMSF email directory types:

You have the option of submitting the cleanup process to batch while the SMTP and MSF servers are still active.  Since the *SMTP and *SMTPMSF email directory types do not actively use Mail Control Blocks to process emails, it is safe to submit the cleanup while the SMTP and MSF servers are both active without the loss of any emails during the cleanup.
CALL QTCP/QTMSWRKMCB 'LIST'
SBMJOB CMD(CALL PGM(QTCP/QTMSWRKMCB) PARM('CLEAN')) JOB(CLEANMAIL) JOBQ(QSYSNOMAX) LOG(4 30 *SECLVL)
The cleanup process can be safely ended at any time using the CL command, ENDJOB JOB(jobnum/jobuser/CLEANMAIL) OPTION(*IMMED), if you choose not to run the cleanup to completion.  The program incrementally cleans up the MCB objects.  When ended in the middle of its processing, it will stop the cleanup and then when the cleanup is submitted next, it will pick up where it left off.  Running the cleanup process for a shorter period of time may allow the IBM i SMTP and MSF servers to start and resolve your immediate issue.  However, IBM recommends you run the cleanup process to completion at some point when a maintenance window can be scheduled.
The cleanup progress can be observed in the submitted job log (i.e. DSPJOBLOG JOB(CLEANMAIL)) or by executing the CL command, CALL QTCP/QTMSWRKMCB 'LIST'.

Options 2, 3, and 4 - Applies to ALL email directory types, specifically *SDD:

You have the following options to execute the cleanup of the IBM i SMTP MCB objects.
The cleanup process can be safely ended at any time using the CL command, ENDJOB JOB(jobnum/jobuser/CLEANMAIL) OPTION(*IMMED), if you choose not to run the cleanup to completion.  The program incrementally cleans up the MCB objects.  When ended in the middle of its processing, it will stop the cleanup and then when the cleanup is submitted next, it will pick up where it left off.  Running the cleanup process for a shorter period of time may allow the IBM i SMTP and MSF servers to start and resolve your immediate issue.  However, IBM recommends you run the cleanup process to completion at some point when a maintenance window can be scheduled.
Option 2:  End the IBM i SMTP and MSF servers and keep them ended while the cleanup process executes.
 
This will prevent the loss of any emails due to the cleanup process.  Since the *SDD email directory type leverages MCB objects to process emails, starting the SMTP and MSF servers while the cleanup process is running may result in the loss of emails.
CALL QTCP/QTMSWRKMCB 'LIST'
ENDMSF
ENDTCPSVR *SMTP
SBMJOB CMD(CALL PGM(QTCP/QTMSWRKMCB) PARM('CLEAN')) JOB(CLEANMAIL) JOBQ(QSYSNOMAX) LOG(4 30 *SECLVL)
The cleanup progress can be observed in the submitted job log (i.e. DSPJOBLOG JOB(CLEANMAIL)) or by executing the CL command, CALL QTCP/QTMSWRKMCB 'LIST'.
Once the CLEANMAIL job ends or is ended, you can restart the MSF and SMTP Servers.
STRTCPSVR *SMTP
STRMSF
 
Option 3:  Execute the cleanup at the next start of the IBM i SMTP Server.
 
This will delay the startup of the IBM i SMTP Server and Client until the cleanup process has completed.
CALL QTCP/QTMSWRKMCB 'LIST'
ENDMSF
ENDTCPSVR *SMTP
CHGSMTPA COLDSTART(*YES)
ADDENVVAR ENVVAR(QIBM_SMTP_COLLECT_MCB_LSTOBJ) LEVEL(*SYS)
STRTCPSVR *SMTP
Wait for the IBM i SMTP Server to fully start.
STRMSF
The cleanup progress can be observed in the QTSMTPSRVD job log (i.e. DSPJOBLOG JOB(QTSMTPSRVD)) or by executing the CL command, CALL QTCP/QTMSWRKMCB 'LIST'.
The IBM i SMTP Server will fully start once the cleanup process has completed.
 
Option 4: Run the cleanup process while the IBM i SMTP and MSF Servers are active.
 
WARNING!!!  This may result in the loss of emails when the IBM i SMTP Email Directory Type is set to the *SDD value.  This is because the *SDD email directory type architecture leverages internal MCB objects to process emails.  When the cleanup process is running, the internal MCB objects related to your normal emails may be deleted causing email delivery failures.  If you want to avoid this issue, IBM recommends you end the IBM i SMTP and MSF servers and keep them ended while the cleanup process executes.  The servers can be restarted after the cleanup process is ended or runs to completion.
CALL QTCP/QTMSWRKMCB 'LIST'
SBMJOB CMD(CALL PGM(QTCP/QTMSWRKMCB) PARM('CLEAN')) JOB(CLEANMAIL) JOBQ(QSYSNOMAX) LOG(4 30 *SECLVL)
The cleanup progress can be observed in the submitted job log (i.e. DSPJOBLOG JOB(CLEANMAIL)) or by executing the CL command, CALL QTCP/QTMSWRKMCB 'LIST'.

How to estimate the total runtime of the IBM i SMTP MCB cleanup process?


Step 1.  Execute the CL command, CALL QTCP/QTMSWRKMCB 'LIST', before you begin the cleanup process.  Write down the total number of MCB objects identified. 
Example:  SMTP *SDD Objects *MCB  # 0010000000 : 001
Step 2.  Start the IBM i SMTP MCB object cleanup process and identify the exact timestamp the cleanup process started from the QTSMTPSRVD or submitted (i.e. CLEANMAIL) job log.  This would be the timestamp of the first CPF9897 message stating, "Start to clean up QTMSMCB* MCB...".
Example:  Cleanup started at 10:00:00.
Step 3.  Wait for 10 minutes.
Step 4.  Execute the CL command, CALL QTCP/QTMSWRKMCB 'LIST'.  Display the job log and identify the current MCB object count as well as the exact timestamp the "SMTP *SDD Objects *MCB" CPF9897 message that was logged. 
Example:  Timestamp is 10:10:00 and SMTP *SDD Objects *MCB  # 0009800000 : 001
Step 5.  Subtract the current MCB object total identified in step 4 from the original MCB object total identified in step 1 to get the total number of objects cleaned up. Then, calculate the total number of minutes/seconds that have passed between the startup of the cleanup in step 2 and the timestamp of the LIST output in step 4.  Divide the number of MCB objects that have been cleaned by the total number of minutes/seconds that have passed to get the rate of cleanup (MCB objects per minute/second). 
Example:  10:10:00 - 10:00:00 = 10 minutes.  10,000,000 - 9,800,000 = 200,000 objects.  200000/10 = 20,000 objects per minute.
Step 6.  Finally, divide the original MCB object total from step 1 by the rate of cleanup calculated in step 4 to get the number of minutes/seconds it will take to complete the cleanup process.  NOTE: This is a rough estimation based on the calculated rate of cleanup.  IBM has found the cleanup process typically will complete sooner than calculated since the rate of cleanup increases as the cleanup progresses.
Example:  10,000,000/20,000 = 500 minutes or 8.33 hours - The estimated time to run the cleanup of 10,000,000 MCB objects to completion is 8 hours and 20 minutes.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHfAAM","label":"Email and SMTP"}],"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.3.0;7.4.0;7.5.0"}]

Document Information

Modified date:
02 November 2022

UID

ibm16604107