‎2011 Mar 23 12:47 PM
We are calling external commands in a batch job using the SAP supplied function module SXPG_COMMAND_EXECUTE. However, if the external command takes longer than 2 minutes (120 seconds) to execute the call to the external command is terminated (from the SAP perspective) with the message Recv failed:Connection reset by peer. The termination is precisely at 120 seconds. The external command, however, continues to run as an u201Corphanu201D task and finishes normally. However, due to the connection termination, SAP is no longer aware of it.
Do you have any ideas where the termination is occurring and/or where the wait limit of 120 seconds is set?
‎2011 Mar 23 1:08 PM
Hi,
do you call it with import parameter "TERMINATIONWAIT' = 'X'?
Without that the command is started asynchronously.
The 120 second time limit might be a system profile parameter! Do you call the fm via RFC or without RFC?
Regards,
Klaus
Edited by: Klaus Babl on Mar 23, 2011 2:12 PM
‎2011 Mar 23 1:08 PM
Hi,
do you call it with import parameter "TERMINATIONWAIT' = 'X'?
Without that the command is started asynchronously.
The 120 second time limit might be a system profile parameter! Do you call the fm via RFC or without RFC?
Regards,
Klaus
Edited by: Klaus Babl on Mar 23, 2011 2:12 PM
‎2011 Mar 24 5:20 PM
Latest update on this issue that we continue to have...
First to answer question from Klaus....Yes, we are calling the SXPG_COMMAND_EXECUTE with the parameter "TERMINATIONWAIT' = 'X'...we have duplicated the issue by simply testing the SXPG_COMMAND_EXECUTE in transaction SE37 and calling a command that sleeps for x seconds. Sleeping for 120 seconds...the command runs successfully...Sleeping for 121 seconds the command failes with the "Recv failed:Connection reset by peer" error.
New information on this issue: The issue only occurs when we use RSH (remote shell). So if I call the SLEEP command via the RSH...it fails after 120 seconds, however if I call the SLEEP command locally (without RSH) the Function Module runs successfully without error. Also, running the RSH directly from the Windows command prompt is successful. So the issue is specific to calling the RSH command from SAP.
Darryl
‎2011 Mar 25 5:57 AM
Hi Darryl,
you can start report RSPARAM.
If you have a new basis release 700 or newer you can filter the parameter name for "*timeout", in older releases you can search for "timeout". Maybe one parameter is matching your problems.
But it can also be a parameter "disconnect" or another starting with "gw" like "gw/close_routes". Please have a look at them!
Regards,
Klaus
‎2011 Mar 23 1:18 PM
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZTEST_BATCH'
additional_parameters = param1
operatingsystem = castserveropsys
targetsystem = target
stdout = 'X'
stderr = 'X'
terminationwait = 'X'
IMPORTING
status = funcstatus
TABLES
exec_protocol = iserveroutput[]
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.