Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SXPG_COMMAND_EXECUTE - Recv failed:Connection reset by peer

Former Member
0 Likes
897

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
786

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

4 REPLIES 4
Read only

Former Member
0 Likes
787

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

Read only

0 Likes
786

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

Read only

0 Likes
786

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

Read only

Former Member
0 Likes
786

 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.