SAP / PyRFC

Asynchronous, non-blocking SAP NW RFC SDK bindings for Python
http://sap.github.io/PyRFC
Apache License 2.0
512 stars 141 forks source link

pyrfc hangs afer execution of connection #333

Closed murmelbahn closed 1 year ago

murmelbahn commented 1 year ago

Hi,

its the first time I'm working with pyrfc and I struggle in the beginning. It seems like my script is connecting to the target server but in the moment when result = conn.call('STFC_CONNECTION', REQUTEXT=u'Hello SAP!') is executed the script hangs and I don't get an answer.

At first this here is my basic code:

from pyrfc import Connection
conn = Connection(ashost='dns.name', sysnr='00', client='100', user='username', passwd='password')
result = conn.call('STFC_CONNECTION', REQUTEXT=u'Hello SAP!')
print (result)

As you see I just want to try to test if everything is working. After browsing the web I find the trace parameter and included it to my script: conn = Connection(ashost='dns.name', sysnr='00', client='100', user='username', passwd='password', trace='3')

This is the content of my dev_rfc.log:

**** Log file opened at 2023-08-07 15:40:02.260743 UTC+02:00 (Mitteleuropäische Zeit), Encoding UTF-8
NW RFC Library: SDK variant, Release 750 Patch Level 12
Compilation date          : Jul  7 2023 22:54:54
CPIC library              : 753.2023.07.06 version 3
NI library                : 40
Kernel Release            : 753 Patch Level 1216
Current working directory : D:\rfc
Program                   : python
Process ID                : 02796
User                      : Administrator
Hardware                  : PC with Windows NT 4x AMD64 Level 6 (Mod 79 Step 1)
Operating_system          : Windows NT 10.0
Hostname                  : my.dns.name
IP address                : 1.2.3.4
IPv6 address              : something
Global trace level        : 0

2023-08-07 15:40:02.256337 [05704] >> Info entry
    Did not find config file D:\rfc\sapnwrfc.ini.

As you can see I'm using Windows with SDK 750 and Python 3.11.4.

The content of my trace file is here

Maybe someone can give me a hint to what to look for.

Thanks

bsrdjan commented 1 year ago

The python script is running on Windows notebook, connecting to ABAP system in the same on-premise network, correct?

When the script hangs for more than 60 sec, is there any error message?

To get more detailed trace file, could you please create the sapnwrfc.ini file in script active directory, activate the global trace there and repeat the test?

Step1

Create sapnwrfc.ini

sapnwrfc.ini

DEFAULT
RFC_TRACE=3

# set any name you want for destination and 
# add your connection parameters here
DEST=my_system
ASHOST=dns.name
CLIENT=100
PASSWD=(- secret -)
SYSNR=00
USER=username

Step 2

Replace:

Connection(ashost='dns.name', sysnr='00', client='100', user='username', passwd='password')

with

Connection(dest="my_system")

Step 3

Run the script again, wait for more than 60 sec and share the trace file. Also the error message, if any.

murmelbahn commented 1 year ago

Hello bsrdjan,

thank you for you answer an help in this matter. The connection from my windows client to the ABAP system is via a IPv4 VPN. Some features like broadcasts are maybe not working but normal tcp/udp connections will work flawless.

When the script hangs for more than 60 seconds nothing is happen. It still "hangs".

The behaviour don't change after using your suggested changes.

I have uploaded the new tracefile here

There are some "Received" entries in the log. Does this mean that both system are speaking to each other?

Best regards and thanks for your help!

bsrdjan commented 1 year ago

Hello @murmelbahn,

for further analysis by SAP NW RFC SDK experts, more info and eventually access to ABAP system are needed.

Could you please create customer ticket for component BC-MID-RFC-SDK, with reference to this issue and with trace file attached?

Thanks, Srdjan

bsrdjan commented 1 year ago

Please re-open if further support with customer ticket needec