-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sap connections not being closed. #35
Comments
Please try again with version 1.0.0.84, I think this bug was already addressed a few months ago. |
Closing this issue as the new version should fix this issue (we had the same problem in the past). Feel free to re-open if after updating the problem persists. |
Hi, unfortunatelly problem stiil encounters on 1.2.0 version |
I no longer have access to an SAP server, so if you can, please help debug this issue. Normally, when connections are broken, you should arrive in the |
Well, actually it is the case, when connection with Sap is not established, so you do not need access to SAP to recreate this problem. I believe there is some problem when
As we can see the first line of this method tries to Dispose SapConnection object (object with not established connection) which in this case throws exception and next lines of methods are never called (_openConnectionCount is not decreased), so when we call this method |
I have a fix for this ready. I only have one question: if connect fails during a call to The reason why I'm asking is because there will be no delay between the two connection attempts, so the chance a connection will be made the second time is probably very small... and not worth the retry. What do you think @Snejki or @zoki986 ? |
@huysentruitw That is what I had done here #53 (comment) but reverted it because of your comments #53 (comment). _connection = _connection ?? _pool.GetConnection(cancellationToken); outside of the try catch and even has a test specific for this behavior. SapNwRfc/src/SapNwRfc/Pooling/SapPooledConnection.cs Lines 52 to 71 in 1811294
_connection = _connection ?? _pool.GetConnection(cancellationToken); code out of the try catch then an addition null check is needed before In addition to that the Here is a fix for this case: campersau@2776646
_connection = _connection ?? _pool.GetConnection(cancellationToken); code out of the try catch: campersau@0d4351b I prefer option 2. |
…ions This ensures the exception bubbles through to the caller and no `null` reference is returned to pool.ForgetConnection (part of fix for #35)
Package version 1.4.0 has been published that should fix this issue. I'll close this issue for now. |
Hi, I'm using version 1.0.0.62 of SapNwRfc and have an API that is calling SAP RFC functions, and everything works fine until SAP becomes unavailable.
When SAP is not available or it takes too long to establish a connection I get this exception.
System.NullReferenceException: Object reference not set to an instance of an object.
at SapNwRfc.Pooling.SapConnectionPool.ForgetConnection(ISapConnection connection)
at SapNwRfc.Pooling.SapPooledConnection.InvokeFunction[TOutput](String name, Object input, CancellationToken cancellationToken)
The connection limit is reached ( it was 5 default value) and SapConnectionPool.GetConnection returns null which afterward produces the above exception.
I have temporarily resolved this by increasing pool size and max pool size and app pool recycle after 1 hour.
Is there some way that this can be handled without increasing pool size to a large number?
The text was updated successfully, but these errors were encountered: