Closed luckkas closed 5 months ago
This problem was driving me nuts. Thank you!!!
The use_function_desc_cache
is the way to go for now. I plan to have another look at this to see where it comes from.
We have the same issue here. We need to set 'use_function_desc_cache' => false; otherwise we have a fatal error. I will follow this issue.
I am investigating this, although I haven't been able to reproduce yet.
Some questions:
getFunction()
, invoke()
, ...?Also, @pieewiee & @dbielke1986 can you share your environment (SDK version, extension version, OS, 32/64bit).
And if anyone can test that with the latest SDK version and the latest code of the extension, that would help a lot (function desc cache related change post 2.0.0 - probably unrelated, but who knows)...
@gkralik
I've just tried it again and I'm unsure if I'm also running into the memory leak, but maybe that's the cause here too, so I'll briefly describe my problem, which meant we had to turn off the “use_function_desc_cache”.
We have the problem that we have to open two connections to an SAP system (client 100 and 200). However, it is not necessarily due to the second connection, but to every second call that we make to SAP to call an RFC. Apparently, it first asks for the descriptions of the fields and then wants to read them from the cache on the second call.
As already described, we get this message on every second call:
SAPNWRFC\FunctionCallException Object
(
[message:protected] => Failed to get description for parameter T_KUNNR
[string:Exception:private] =>
[code:protected] => 20
[file:protected] => /var/www/html/...php
[line:protected] => 495
[trace:Exception:private] => Array
....
[previous:Exception:private] =>
[errorInfo:protected] => Array
(
[code] => 20
[key] => RFC_INVALID_PARAMETER
[message] => field 'T_KUNNR' not found
)
)
So there seems to be a problem here if any description fields have not been found/maintained, although I have looked everywhere and in my opinion everything is correct.
If this is not in the same direction as the reporter's problem, then please ignore my statement or refer me to a separate item.
Environment:
@dbielke1986 OK, this sounds a little different.
If the parameters of an RFC change while your script is running, you have to either disable the function description cache completely (use_function_desc_cache
) or clear the cache manually.
If you get an error every second call, try the latest version of the extension in the repository (especially including e649a80efaa1fd92e9f30f83a27ecd14795417c1). This fixes a problem with repeated calls of the same RFC, especially when the RemoteFunction
object is freed (unset, variable reused).
Also, can you reproduce the issue with a generic RFC call (like RFC_PING
, STFC_STRUCTURE
) and if so, can you share a code snippet? This way I can try to debug this.
@gkralik
I will try to test this with e649a80 and give some feedback.
Thanks for your help and this absolutely incredibly helpful module (essential for us and our use case)!
I have drafted a new release 2.1.0, if that helps with testing.
Edit: make sure to use the latest SAP SDK (patch level 13 at the time of writing). SAP has been fixing quite a lot of issues, including memory leaks.
@gkralik
We have updated our page to 2.1.0 + SAP SDK 750 PL13 and everything seems to work right now. Even with use_function_desc_cache = true
.
I will monitor this issue for a few more days and then give feedback again. So far, however, everything looks great. Many, many thanks for the module and fixing the problem!
Good to hear. I suspect it indeed was e649a80...
Keep me posted if anything turns up - I'll leave this open until you report back.
Nonetheless, I still think the original issue @luckkas faced is something different.
@dbielke1986 has the issue emerged again or is everything working for you now?
@gkralik:
Everything is working great! The mentioned fix solves our issue with daily use and hundreds of calls a day. Thank you so much for you fast reply and the quick fix you provided!
Overview
I am currently experiencing a memory leak issue in my SAP PHP connection when using the SAP functions "L_TO_CREATE_SINGLE" and "BAPI_GOODSMVT_CREATE." I have identified a workaround by adjusting the use_function_desc_cache option, and I am seeking advice from the community to better understand the root cause and explore potential improvements.
Issue Details
Environment: SAP NW RFC SDK version 7500.0.12 ,PHP version 8.2.12, Windows Server 2016 Standard version 1607 OS build 14393.6351
The error message:
Workaround: I have found that setting the use_function_desc_cache option to false resolves the memory leaks. See the code snippet below:
try { $this->con = new SAPNWRFC\Connection($parameters, $options); return $this->con; } catch (Exception $e) { // Handle exceptions }