I'm using the gremlin package version 3.5.2 with NodeJS.
If the server disconnects while the client waits for a query result from the server (await t.next()), the promise never finishes and the calling code gets stuck forever.
I've used the addListener function to register on "log" events and I see the client recognizes the socket was closed, but it doesn't throw an exception for ongoing requests.
I'm looking for a solution that will enable my server to handle such situations without getting stuck and without any resource leaks.
There is a ticket for it at: https://issues.apache.org/jira/browse/TINKERPOP-2754
You can find in the ticket a small program which demonstrates the problem.
Related
I wonder if there's a way to properly handle the situation when client can establish the channel to the server, but there's no matching service deployed on a server side.
So far in my tests I see that client can successfully send an rpc call and then wait forever for response.
Is there a way to instruct server or client to throw exception in this case?
I've stumbled upon the fallbackHandlerRegistry. But you can only return empty or null if nothing is found. There's seemingly no way you can say to the server close the call as there's nothing like this is deployed here.
No, there have logic to handle this situation, what is your language?
In grpc-java, it will check if the method is exist when execute StreamCreated task, and if method not found in registry and fallbackRegistry, it will return UNIMPLEMENTED status right now. You can reference the method StreamCreated#runInternal
The server does send UNIMPLEMENTED status in the response to the client and client will receive it as StatusRuntimeException with status = UNIMPLEMENTED
Is it good practice to be using cancellation tokens when making an asynchronous request to a SQL Server?
Lets just say we have a situation where we could end up with the SQL Server reporting an 'Operation Time out' failure.
Eventually SQL Server will return the exception to us.. and a Task from the thread pool that made receive a result containing the exception.
But would it be better if we where to defend against this by introducing a cancellation token with a shortened timeout limit.
My gut tells me that i should leave this up to the SQL Server to report any exceptions, but that could mean leaving the request hanging for minutes..
Hope this makes sense.
SQL Server does not have a time-out on the server side. ADO.NET already sets a timer that, when triggered, will abort the query.
Let me rephrase that: the client will ask the server to abort the query.
There's a more detailed explanation in this MSDN blog.
The webapp which I’m working on does some data manipulation at the back-end after a user clicks button. This process takes a long time to complete causing the browser to timeout. Therefore I’ve introduced an asynchronous ADO command which causes the page response immediately while the back-end process keeps running. That page also includes an AJAX call to check the status of the back-end process and when it detects that it is completed another AJAX request gets the result of that process form the back-end. All works as expected.
My question is regarding the ADO connection for this scenario as with the asynchronous execution the connection must not be closed.
Is there a way that I can reference the same connection object from another page (the result page requested by AJAX call) and close it ? Or should I just leave it for the server to kill it off eventually.
I was researching a bit for this answer with no success.
Is there a way that I can reference the same connection object from
another page
How about saving async connection in Session("xxx") variable?
I use asynchronous XMLHttpRequest to call a function in ASP.net web service.
When I call an abort method on the XMLHttpRequest, after the server has received the request and processing it, the server continues processing the request.
Is there a way to stop the request processing on the server?
Generally speaking, no, you can't stop the request being processed by the server once it has started. After all, how would the server know when a request has been aborted?
It's like if you navigated to a web page but browsed to another one before the first one had loaded. That initial request will, at least to some extent (any client-side work will of course not take place), be fulfilled.
If you do wish to stop a long-running operation on the server, the service that is being invoked will need to be architected such that it can support being interrupted. Some psuedo code:
void MyLongRunningMethod(opId, args)
{
work = GetWork(args)
foreach(workItem in work)
{
DoWork(workItem)
//Has this invocation been aborted?
if(LookUpSet.Contains(opId))
{
LookUpSet.Remove(opId)
return
}
//Or try this:
if(Response.IsClientConnected)
{
HttpContext.Current.Response.End();
return;
}
}
}
void AbortOperation(opId)
{
LookUpSet[opId] = true
}
So the idea here is that MyLongRunningMethod periodically checks to see if it has been aborted, returning if so. It is intended that opId is unique, so you could generate it based on the session Id of the client appended with the current time or something (in Javascript, new Date().getTime() will get you the number of milliseconds since the epoch).
With this sort of approach, the server must maintain state (the LookUpSet in my example), so you will need some way of doing that, such as a database or just storing it in memory. The service will also need to be architected such that calling abort does not leave things in a non-working state, which of course depends very heavily on what it does.
The other really important requirement is that the data can be split up and worked on in chunks. This is what allows the service to be interruptable.
Finally, if some operation is to be aborted, then AbortOperation must be called - simply aborting the XMLHttpRequest invocation won't do help as the operation will continue until completion.
Edit
From this question: ASP.Net: How to stop page execution when browser disconnects?
You could also check the Response.IsClientConnected property to try and determine whether the invocation had been aborted.
Generally speaking, the server isn't going to know that a client has disconnected until it attempts to send data to it. See Best practice to detect a client disconnection in .NET? and Instantly detect client disconnection from server socket.
As nick_w wrote you can't stop the request being processed by the server once it has started. But there is ability to implement solution which will give you ability to cancel server task. Dino Esposito has several great articles about how such things can be implemented:
Canceling Server Tasks with ASP.NET AJAX
And in the following articles to implement pooling to server Dino Esposito describes how to use SignalR library:
Build a Progress Bar with SignalR;
Long Polling and SignalR
So if you really need to cancel some task on server these articles can be used as starting point to implement required solution.
I getting Two-Phase commit Exption in my application for one of the datasource. Point is application only does ready only data option using Oracle Toplink. Here is what happling in Application
Request come to webservice
Webservice calls to JMS Queue. Application need response from queue so used queue with Read Respose
In Message Bean( Lets call this ProcessBean), several successful hit goes to Oracle DB using Oracle Toplink, [b]no exception is trown[/b].
After DB data read pointer goes to call to Blaze rule RMI API provided by Blaze. we get successful result.
Queue Calles Response Queue and Response Message is send back.
Now exception comes and Pointer again come to ProcessingBean
In webservice never get response back.
P.S. If you desible Global transation in Weblogic connection Pool then everything works fine. Or If I checked enable Two-Phase commit then also everything is working fine.