Open NilsFrkal opened 8 years ago
I did a bit more testing and found out that this error only occurs if I explicitly call connection.Close(). This however leads me to another question: Is the RFC connection automatically closed? And if yes, under which conditions? Thank you very much.
I also encounter this bug, albeit running both node and SAP on a linux system. My current attempt to deal with it is to run my app with pm2 to ensure it restarts as soon as it dies. Although I can't help with more details, I can answer your question. Unless connection.Close() is explicitly called, the RFC connection remains in place and can start to use up all available RFC ports over time. You can see the zombie RFC connections on the SAP side through transaction AL08.
Thanks a lot Ryan. Obviously both, auto-restart of app as well as leaving RFCs open are not production-ready solutions. Is someone able to fix this? Thanks, Nils
Im getting the same error, do you have any solution for this?
This patch might fix the issue:
---
src/Connection.cc | 8 +++++++-
diff --git a/src/Connection.cc b/src/Connection.cc
--- a/src/Connection.cc
+++ b/src/Connection.cc
@@ -36,7 +36,12 @@ Connection::Connection() :
Connection::~Connection()
{
- this->CloseConnection();
+
+ if (this->connectionHandle != nullptr) {
+ RFC_ERROR_INFO errorInfo;
+ memset(&errorInfo, 0, sizeof(RFC_ERROR_INFO));
+ RfcCloseConnection(this->connectionHandle, &errorInfo);
+ }
uv_mutex_destroy(&this->invocationMutex);
@@ -201,6 +206,7 @@ v8::Local<v8::Value> Connection::CloseConnection(void)
if (this->connectionHandle != nullptr) {
rc = RfcCloseConnection(this->connectionHandle, &errorInfo);
+ this->connectionHandle = nullptr;
if (rc != RFC_OK) {
scope.Escape(RfcError(errorInfo));
}
--
2.16.2.windows.1
We've used the same approach in our fork https://github.com/e2ebridge/node-sapnwrfc
Hi experts,
I am using this library to connect from nodejs to SAP. I am getting above error and nodejs crashes. When I deactivate the call to the rfc service this error does not occur, hence I assume it must have something to do with the library. Did anyone encounter this problem before and potentially have a solution?
System info:
nodejs 5.12 Windows 10 binaries copied from 5.0 to 5.12
Thank you very much.