You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
close():
Explicitly close the connection.
Note that this is usually not necessary as the connection will be closed automatically upon object destruction. However, if the the object destruction is delayed by the garbage collection, problems may occur when too many connections are opened.
I think this is not true:
from pyrfc import Connection
import gc
def test():
connection_dict = ...
for i in range(1000):
ping(i, connection_dict)
gc.collect()
def ping(i, connection_dict):
conn = Connection(**connection_dict)
print(i, conn.call('RFC_PING'))
test()
Result after 200 times ping():
Traceback (most recent call last):
File "tmp/t.py", line 19, in ping
conn = Connection(**connection_dict)
File "src/pyrfc/_pyrfc.pyx", line 182, in pyrfc._pyrfc.Connection.__init__
File "src/pyrfc/_pyrfc.pyx", line 226, in pyrfc._pyrfc.Connection._open
File "src/pyrfc/_pyrfc.pyx", line 256, in pyrfc._pyrfc.Connection._error
pyrfc._exception.CommunicationError: RFC_COMMUNICATION_FAILURE (rc=1): key=RFC_COMMUNICATION_FAILURE, message=
LOCATION CPIC (TCP/IP) on local host with Unicode
ERROR max no of 200 conversations exceeded
TIME Thu Dec 5 12:59:57 2019
RELEASE 753
COMPONENT CPIC (TCP/IP) with Unicode
VERSION 3
RC 466
MODULE /bas/753_REL/src/krn/si/cpic/r3cpic.c
LINE 15830
COUNTER 201
[MSG: class=, type=, number=, v1-4:=;;;]
The connection object should get closed by the garbage collector which does explicitly closed in above script (gc.collect()).
The text was updated successfully, but these errors were encountered:
Thanks for spotting this. The garbage collection is more often than not delayed and even the explicit deletion of Connection instance is not necessarily triggering the del() method. The comment is therefore updated and free() method added, recommended to call after connection instance not any more needed.
From the docs: https://sap.github.io/PyRFC/pyrfc.html#pyrfc.Connection.close
I think this is not true:
Result after 200 times ping():
The connection object should get closed by the garbage collector which does explicitly closed in above script (
gc.collect()
).The text was updated successfully, but these errors were encountered: