cancel
Showing results for 
Search instead for 
Did you mean: 

SAP RFC SDK RfcGetFunctionDesc thread safe bug

maiemy
Explorer
0 Kudos

Hi, All

I am working on a project in which I use SAP RFC SDK 7,50 patch 12

I am making calls to RfcGetFunctionDesc and all works well when the calls are sequentials,

When I call RfcGetFunctionDesc in parallels threads, only for the first call, I receive an error

Error Code: InvalidParameter

Error Group: ExternalRuntimeFailure

Key: RFC_INVALID_PARAMETER

Message: Index does not exist

If I make a first single call and then subsequent calls in parallel everything works.

From my own debugging and a series of tests, I think I have figured out that the problem is on using DDIC's cache when calling the function RfcGetFunctionDesc. I think I understood that it is due to the fact that on the first round when two threads access DDIC this is not thread safe. the error seems to indicate that the name of the function on the DDIC is initialized (first thread) but when the second thread tries to access with that name in the cache the item is not there and thus the error is returned "Index does not exist" probably because the first thread has not yet finished writing operations to the cache.

This problem with RfcGetFunctionDesc occurs only with functions that have parameter tables.

Has this ever happened to you?

How can i report this problem to the SAP RFC SDK development team?

Sandra_Rossi
Active Contributor
0 Kudos

https://support.sap.com - via a S-User (all SAP customers with a license can give you a S-User)

  • to check existing SAP notes
  • to contact SAP support

https://support.sap.com/en/product/connectors/nwrfcsdk.html

Accepted Solutions (1)

Accepted Solutions (1)

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert

This is in fact a known bug introduced in PL 11 or 12: for accessing the DDIC, certain FMs are needed (for example RFC_GET_FUNCTION_INTERFACE etc.). The metadata for these FMs cannot be looked up in the DDIC (obviously...) and is therefore hard-coded in the library. The construction of this hard-coded metadata used to be synchronized, but due to a bug, this synchronization got broken, so now we have a race condition. Will be fixed again starting with PL 12, HotFix 2.

Workaround for now: only the very first call to RfcGetFunctionDesc needs to be synchronized. After the first call has returned, the static metadata construction is finished, and from then on, RfcGetFunctionDesc is thread-safe again and can be called in multiple threads.

So until the patch will be available, if you do something trivial like RfcGetFunctionDesc("RFC_SYSTEM_INFO") in the main thread, before starting the other threads, the problem should be gone.

maiemy
Explorer
0 Kudos

Thanks very much for your help.

I did not know about this bug. I will wait for the hotfix. 🙂

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert

Yesterday, the Hotfix 2 has been shipped. SAP note 3384574 describes how it can be downloaded.

Answers (0)