cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

node rfc server issue being unreliable

Shayan23
Discoverer
0 Likes
619

Hi everyone,

I set up a node rfc server according to the official documentation. https://github.com/SAP-archive/node-rfc/blob/HEAD/doc/usage.md#nodejs-server-program-example

I set up the ini file, the rfc destination (which successfully passes the connection test), the sec_info, and reg_info.

I'm calling the Node.js RFC function from ABAP using a CALL FUNCTION ... DESTINATION statement.

The issue is sometimes it works and sometimes not. Once it executes the node js function I defined successfully then I restart the server again and then I get the error that the function module (name of the function) not found.

I could not find a reasonable pattern that under what condition it works and under what condition it does not.

I appreciate any help.

I can provide my full codes if needed.

Thanks in advance

@Srdjan 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

Ulrich_Schmidt1
Product and Topic Expert
Product and Topic Expert
0 Likes

Looks like you have two instances of the server running? One which has the required definition of the FM you call, and one that doesn't. The ABAP system then does "load balancing" and sometimes calls the correctly configured server program and sometimes the other one... 🙂

That is the only plausible explanation, because a server program simply does not "sometimes know the incoming FM and sometimes doesn't know it"...

Check "SMGW --> Logged on Clients" in order to see, how many registered server connections for the given Program ID (TP Name) exist.

Shayan23
Discoverer
0 Likes
Thanks for the reply. I appreciate it. I have already restarted sap and my node rfc server. I have even done soft and hard shut down on the SMGW. and at all of my tests I add the function in the code. when my server node rfc is off, there is always an entry in the logged on clients even when the server is off which has TP name of sapgw00. is this normal? even on soft or hard shut down it does not go away. then when I start my server, then four registered servers appear with the TP name 'IGS.NPL' appear. one external client with the TP name of 'node' appears. one remote gateway with the name 'sapdp00' appears. and one registered server with the TP name of my specified program_id which in this case is MYNODESERVER01 appears as well. Does this information help to detect the issue? I look forward to an answer from you again. thanks for your time
Ulrich_Schmidt1
Product and Topic Expert
Product and Topic Expert
0 Likes

Strange, looks fine so far.

In this case, there must be something very wrong either in the Python wrapper around libsapnwrfc.so, or in your Python code itself. Try setting the environment variable RFC_TRACE=4, before starting the server program. Then we can see, what the program is doing.

I have never used Python, but when doing it in C, I would do something like

RFC_ERROR_INFO errorInfo;
// Either manually created or obtained from ABAP DDIC:
RFC_FUNCTION_DESC_HANDLE myFuncDesc = ...;

RfcInstallServerFunction(cU("NPL"), myFuncDesc, handlerFunction, &errorInfo);

at the very beginning, and the function should be known for the runtime of the process. The only way to make it "unknown" again, is to call RfcInstallServerFunction a second time like this

RfcInstallServerFunction(cU("NPL"), myFuncDesc, NULL, &errorInfo);

If this is happening, we should see it in the RFC Trace.