Forum OpenACS Development: Naviserver File download cancelled around 500k

I have a server we migrated from AOLserver to Naviserver.

Downloads of a CSV file using ns_return are silently cancelled if the file is greater than 400kb to 500kb.

During testing 400kb was successful but 600kb was unsuccessful.

I believe we are using the default openacs config file configured for Naviserver. Are there any settings I can check that might cause this behavior?

Collapse
Posted by Gustaf Neumann on
Hi Dave,

We have never seen such a scenario. Concerning the config file: the easiest option to test whether the config file is the culprit is to use the sample-config file for OpenACS that is shipped with naviserver. Per default, this is located in /usr/local/ns/conf/openacs-config.tcl

-g

Collapse
Posted by Dave Bauer on
I did use the sample config to create my config file.

I am getting dropped connections for all kinds of things sometimes the request only takes 5-10 seconds. Slow but not anything that should timeout. I see nothing in the error logs.

Collapse
Posted by Gustaf Neumann on
You say, this happens just for "downloads" via ns_return? does this happen as well with downloads form the file-storage? Do you have writer threads configured?

What version of NaviServer do you use?

In case of doubt, find out with "ns_info patchlevel" in ds/shell. If you have a recent version of NaviServer, you can turn on at runtime detailed logging from sockets with "ns_logctl severity Debug(ns:driver) on" via ds/shell. Find out about the available severities via "ns_logctl severities".

Collapse
Posted by Dave Bauer on
Thanks.

I looked into this more.

There is an Amazon ECB in front of Naviserver. I don't have control over that. The requests get a 504 Gateway timeout when examined in Firefox Inspector after about 6 seconds.

Here is a quick sample of the log data. I have no idea what I am looking for. Is unable to read request a problem or might that be some sort of spam request?

[12/Mar/2015:10:02:00][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): SockError: Unable to read request (11: Resource temporarily unavailable), sock: 12, peer: 10.196.20.247:48602, request:
[12/Mar/2015:10:02:00][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): sockread returned read error; close socket
[12/Mar/2015:10:02:00][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): SockError: Unable to read request (11: Resource temporarily unavailable), sock: 11, peer: 10.196.20.247:48601, request:
[12/Mar/2015:10:02:01][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): sockread returned read error; close socket
[12/Mar/2015:10:02:01][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): SockError: Unable to read request (11: Resource temporarily unavailable), sock: 7, peer: 10.252.11.44:23749, request:
[12/Mar/2015:10:02:01][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): sockread returned read error; close socket
[12/Mar/2015:10:02:01][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): SockError: Unable to read request (11: Resource temporarily unavailable), sock: 15, peer: 10.252.11.44:23750, request:
[12/Mar/2015:10:02:04][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): sockread returned read error; close socket
[12/Mar/2015:10:02:04][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): SockError: Unable to read request (11: Resource temporarily unavailable), sock: 8, peer: 10.196.20.247:48598, request:
[12/Mar/2015:10:02:04][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): sockread returned read error; close socket
[12/Mar/2015:10:02:04][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): SockError: Unable to read request (11: Resource temporarily unavailable), sock: 16, peer: 10.196.20.247:48606, request:
[12/Mar/2015:10:02:04][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): sockread returned read error; close socket
[12/Mar/2015:10:02:04][6126.2aaab102f940][-driver:nssock-] Debug(ns:driver): SockError: Unable to read request (11: Resource temporarily unavailable), sock: 19, peer: 10.196.20.247:48607, request:
[12/Mar/2015:10:02:04][6126.2aaab102f940][-driver:nssock-] Notice: ... sockAccept accepted 2 connections

Collapse
Posted by Gustaf Neumann on
Dear Dave,

i can help you more, when you answer my questions:

  • Does the truncation happen as well with downloads from the file-storage?
  • Do you have writer threads configured?
  • What version of NaviServer do you use?

From you reply is see just cases, where the debug output shows log lines from the input side (from different ip addresses). i would recommend to add ns_log entries before and after the ns_return statement when you send the CSV file.

What exactly is "an Amazon ECB"? I assume this is something like a reverse proxy. It the communication via SSL? How does your comment with the 504 error (usually this means "no response from upstream server") fit together with the partial result of the 500k. I can't believe you get a truncated result in the body the 504 error reply.

Do you see an entry for the request in the access.log?

Collapse
Posted by Dave Bauer on
Thanks Gustaf,

It does appear the proxy is expecting a complete response within about 15 seconds and if the reply is not completed it responds with 504 to the client. I am trying to get the administrator of the proxy to give me information about what happens there.

Collapse
Posted by Gustaf Neumann on
It seems, that there are more things to know to address the problem. If the result is sent via ns_return, then the problem will only appear when it takes the program more than 15 secs to generate the output. In this case, this has nothing to do with NaviServer.

Maybe it is an option for you to produce streaming output (via ns_write) as soon as you have partial results available. Most proxies send the "backend unresponsive" only when they receive no upstream output after the timeout.