AngularJS 1: How not to "Socket hang up" on a request which is taking long time to respond - angularjs

I am sending a request from client(angularjs) to backend requesting 1million records. I know this is dumb but that's the requirement. The request will run a stored procedure in Oracle database which is taking around 3 minutes and within this time, at the client side, am getting the error "problem with request: socket hang up" and the request is failed.
Can anyone please let me know how to increase this time taken for socket to hangup ? or any other solution is also welcome
Thanks in advance.

Related

Apache2: how to log rejected connections and client timeout

I am doing some load testing on a service run with Apache2 and my load testing tool has a default timeout of 30 seconds. When I run the tool for a minute with 1 request per second load, it reports that 40 succeeded with 200 OK response and 20 requests were cancelled because client timeout exceeded while awaiting headers.
Now, I was trying to spot this on the server side. I can't see the timeouts logged either in apache access logs or gunicorn access logs. Note that I am interested in connections that weren't accepted as well as that are accepted and times out.
I have some experience working on similar services on Windows. The http.sys error logs would show connection dropped errors and we would know if our server was dropping connections.
When a client times out, all the server knows is that the client has aborted the connection. In mod_log's config, the %X format specifier is used to log the status of the client connection after the request has completed, which is exactly what you want to know in this case.
Configure your logs to use %X, and look for the X character in the log lines.
Bonus: I even found the discussion about this feature in apache's dev forum, from 20 years ago
Update:
Regarding refused connections, these cannot be logged by apache. Connection refusal is done by the kernel, in the tcp stack, and not by apache. The closest solution including only apache that I can think of is keeping track of the amount of open connections (using mod_status). If it reaches the maximum you know you might be refusing connections. Otherwise, you'd need to set up some monitoring solution to track tcp resets sent by the kernel.

Delay in receiving emails

Currently, we are using one Gmail API to receive MFA through Email. We are using this in automated tests to read to code.Until yesterday we are receiving emails in seconds and we are able to read the code. But starting from today there is some delay in receiving an Email and sometimes the email is not been received.
Is there any way to check these logs? Can anyone help with this?
Well, if you experienced some delay, based on this documentation there can be a delay of several minutes if the user exceeds their quota. You can also try to use the Users.messages: get to get the specific message and check if it has some delay in receiving.
I found here a related SO question about your problem. So just check it if it can help you. It uses IMAP for this issue.

Amazon api keeps cancelling my request

Everytime I ping amazon to get _GET_FBA_MYI_UNSUPPRESSED_INVENTORY_DATA_ I can make the request and it SUBMITTED for about 10 seconds then when I ping again it says cancel I have tried making the request 3 times and all of the times it seems to get cancelled.
You are querying too much. For that particular report I request once an hour (the most you can) and if you get a cancel message have it wait an hour and then query again. It is initially hard to debug so I would keep around the exports to test your other portions of your code while keep the report download code separate.

Deeper server block request

Today I had a problem searching songs on Deezer API. The server was blocking my requests.
A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection
failed because connected host has failed to respond 195.244.30.137:80
What do I need to do so that it wouldn't happen again?
I solved my problem.
There was a internet problem in my side.
Sorry

How to achieve interrupt-driven communication from server to client with servlets?

we wrote in C++ a screen sharing application based on sending screenshots.
It works by establishing a TCP connection btw the server and client, where the server forwards every new screenshot received for a user through the connection, and this is popped-up by the client.
Now, we are trying to host this on google app engine, and therefore need 'servlet'-ize and 'sandbox' the server code, so to implement this forwarding through HTTP requests.
I immagine the following:
1. Post request with the screenshot as multiple-data form (apache uploads ..).
But now the server needs to contact the specified client (who is logged in) to send it/forward the screenshot.
I'm not sure how to 'initiate' such connection from the servlet to the client. The client doesn't run any servlet environment (of course).
I know HTTP 1.1 mantains a TCP connection, but it seems gapps won't let me use it.
1 approaches that comes to mind is to send a CONTINUE 100 to every logged in user at login, and respond with the screenshot once it arrives. Upon receival the client makes another request, and so on.
an alternative (insipired from setting the refresh header for a browser) would be to have the app pool on a regular basis (every 5 secs).
You're not going to be able to do this effectively on GAE.
Problem 1: All output is buffered until your handler returns.
Problem 2: Quotas & Limits:
Some features impose limits unrelated
to quotas to protect the stability of
the system. For example, when an
application is called to serve a web
request, it must issue a response
within 30 seconds. If the application
takes too long, the process is
terminated and the server returns an
error code to the user. The request
timeout is dynamic, and may be
shortened if a request handler reaches
its timeout frequently to conserve
resources.
Comet support is on the product roadmap, but to me your app still seems like a poor fit for a GAE application.
Long Polling is the concept used for such asynchronous communications between server and client.
In Long Polling, servlet keeps a map of client and associated messages. Key of Map being client id and value being list of messages to be sent to the client. When a client opens a connection with server (sends request to a servlet), the servlet checks the Map if there are any messages to be sent to it. If found, it sends the messages to the client exits from the method. On receiving messages, the client opens a new connection to the server. If the servlet does not find any messages for given client, it waits till the Map gets updated with messages for given client.
This is a late reply, I'm aware, but I believe that Google have an answer for this requirement: the Channel API.

Resources