SAP / node-rfc

Asynchronous, non-blocking SAP NW RFC SDK bindings for Node.js
Apache License 2.0
252 stars 74 forks source link

Docker container hung if sap does not respond to RFM call #306

Closed sajjanhubale closed 10 months ago

sajjanhubale commented 1 year ago

Hi Team,

We are encountering a critical problem with the node-rfc package (version 2.7.1) when making calls to ABAP Remote Function Modules (RFMs) in SAP. When calling an ABAP RFM and SAP does not respond, our Docker container gets hung, rendering it unable to perform any other operations within the container. No other REST APIs or operations can be executed until the workprocess responsible for the operation is manually terminated. We have to kill the workprocess to bring the Docker service back online and enable it to perform the same or any other operations.

Details: node-rfc Version: 2.7.1 SAP System Details: [Provide information about your SAP system, such as version, configuration, etc.] Node.js Version: 18 Operating System: Linux SUSE

Could you please help to identify the issue? You can find below code that we use tho connect to sap and invoke the RFMs. Please let me know if you need more details?

`const { Client } = require('node-rfc'); const { logger } = require('../../../config/logger');

const getSAPConnection = async (connectionParameters) => { try { const client = new Client(connectionParameters); await client.connect(); return client; } catch (error) { throw new Error(Failed to create a SAP connection: ${error.message}); } };

const invokeSAPRFC = async (client, funtionModule, params) => { try { logger.info(Invoking ${funtionModule}, params); const data = await client.call(funtionModule, params); return JSON.parse(JSON.stringify(data)); } catch (error) { throw new Error( Failed to invoke RFC call for module ${funtionModule}: ${error.message} ); } }; const formatConnectionParams = (connection) => { const connParams = { user: connection.userId, passwd: connection.sapPassword, ashost: connection.hostname, sysnr: connection.instanceNo, client: connection.clientNo, lang: 'EN', }; return connParams; };`

@bsrdjan it would be great if you can also check this issue from your end and help on this.

Thanks, Sajjan

bsrdjan commented 1 year ago

Hello @sajjanhubale,

which SAP NW RFC SDK version is used? Could you please upgrade and test with the latest node-rfc and SAP NW RFC SDK.

Does it hang when opening connection or after connection is opened, during RFC call execution?

Please note that client.connect() is callback, not async method. Try with await client.open() instead.

Regards, Srdjan