我将Puma作为上游应用服务器运行,将Riak作为后台数据库集群运行.当我发送一个请求map - 减少大约25K用户的数据块并将其从Riak返回给应用程序时,我在Nginx日志中收到错误:
上游超时(110:连接超时),同时从上游读取响应头
如果我在没有nginx代理的情况下直接查询我的上游,使用相同的请求,我会得到所需的数据.
一旦放入代理,就会发生Nginx超时.
**nginx.conf**
http {
keepalive_timeout 10m;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
include /etc/nginx/sites-enabled/*.conf;
}
**virtual host conf**
upstream ss_api {
server 127.0.0.1:3000 max_fails=0 fail_timeout=600;
}
server {
listen 81;
server_name xxxxx.com; # change to match your URL
location / {
# match the name of upstream directive which is defined above
proxy_pass http://ss_api;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache cloud;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 …Run Code Online (Sandbox Code Playgroud) 我想为我的Web应用程序使用的休息服务设置连接超时.我正在使用Spring的RestTemplate与我的服务交谈.我做了一些研究,我发现并使用了下面的xml(在我的应用程序xml中),我认为这是为了设置超时.我正在使用Spring 3.0.
我也看到了同样的问题这里使用RestTemplate的spring webservices的超时配置,但解决方案看起来不干净,我更喜欢通过Spring配置设置超时值
<bean id="RestOperations" class="org.springframework.web.client.RestTemplate">
<constructor-arg>
<bean class="org.springframework.http.client.CommonsClientHttpRequestFactory">
<property name="readTimeout" value="${restURL.connectionTimeout}" />
</bean>
</constructor-arg>
</bean>
Run Code Online (Sandbox Code Playgroud)
似乎无论我设置readTimeout是什么,我得到以下内容:
网络电缆断开连接: 等待大约20秒并报告以下异常:
org.springframework.web.client.ResourceAccessExcep tion:I/O错误:无主机路由:connect; 嵌套异常是java.net.NoRouteToHostException:没有到host的路由:connect
网址不正确,因此休息服务返回404: 等待大约10秒并报告以下异常:
org.springframework.web.client.HttpClientErrorException:404 Not Found
我的要求需要更短的超时时间,所以我需要能够更改这些.关于我做错了什么的任何想法?
非常感谢.
我试图让一个元素淡入,然后在5000毫秒再次淡出.我知道我可以这样做:
setTimeout(function () { $(".notice").fadeOut(); }, 5000);
Run Code Online (Sandbox Code Playgroud)
但这只会控制淡出,我会在回调中添加上述内容吗?
我需要在python的socket recv方法上设置超时.怎么做?
当客户端尝试连接到断开连接的IP地址时,超过15秒的超时超时...我们如何减少此超时?配置它的方法是什么?
我用来设置套接字连接的代码如下:
try
{
m_clientSocket = new Socket(
AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
IPAddress ip = IPAddress.Parse(serverIp);
int iPortNo = System.Convert.ToInt16(serverPort);
IPEndPoint ipEnd = new IPEndPoint(ip, iPortNo);
m_clientSocket.Connect(ipEnd);
if (m_clientSocket.Connected)
{
lb_connectStatus.Text = "Connection Established";
WaitForServerData();
}
}
catch (SocketException se)
{
lb_connectStatus.Text = "Connection Failed";
MessageBox.Show(se.Message);
}
Run Code Online (Sandbox Code Playgroud) 我们有一个应用程序,它具有在IIS7上运行的WCF服务(*.svc)以及查询该服务的各种客户端.服务器正在运行Win 2008 Server.客户端正在运行Windows 2008 Server或Windows 2003服务器.我得到以下异常,我看到它实际上可能与大量潜在的WCF问题有关.
System.TimeoutException: The request channel timed out while waiting for a reply after 00:00:59.9320000. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. ---> System.TimeoutException: The HTTP request to 'http://www.domain.com/WebServices/myservice.svc/gzip' has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer …Run Code Online (Sandbox Code Playgroud) 我在Go中创建一个URL提取器,并有一个要获取的URL列表.我向http.Get()每个URL 发送请求并获取其响应.
resp,fetch_err := http.Get(url)
Run Code Online (Sandbox Code Playgroud)
如何为每个Get请求设置自定义超时?(默认时间很长,这使得我的提取器非常慢.)我希望我的提取器有超过40-45秒的超时时间,之后它应该返回"请求超时"并继续下一个URL.
我怎样才能做到这一点?
为了添加一些基本的错误处理,我想重写一段使用jQuery的$ .getJSON来从Flickr中提取一些照片的代码.这样做的原因是$ .getJSON不提供错误处理或使用超时.
因为$ .getJSON只是$ .ajax的包装,所以我决定改写这个东西并惊喜,它完美无缺.
现在开始有趣了.当我故意导致404(通过更改URL)或导致网络超时(没有连接到互联网)时,错误事件根本不会触发.我不知道自己做错了什么.非常感谢帮助.
这是代码:
$(document).ready(function(){
// var jsonFeed = "http://api.flickr.com/services/feeds/photos_public.gne"; // correct URL
var jsonFeed = "http://api.flickr.com/services/feeds/photos_public.gne_______"; // this should throw a 404
$.ajax({
url: jsonFeed,
data: { "lang" : "en-us",
"format" : "json",
"tags" : "sunset"
},
dataType: "jsonp",
jsonp: "jsoncallback",
timeout: 5000,
success: function(data, status){
$.each(data.items, function(i,item){
$("<img>").attr("src", (item.media.m).replace("_m.","_s."))
.attr("alt", item.title)
.appendTo("ul#flickr")
.wrap("<li><a href=\"" + item.link + "\"></a></li>");
if (i == 9) return false;
});
},
error: function(XHR, textStatus, errorThrown){
alert("ERREUR: " + textStatus); …Run Code Online (Sandbox Code Playgroud) 我已经使用JAXWS-RI 2.1基于WSDL为我的Web服务创建了一个接口.我可以与Web服务进行交互没有问题,但是无法指定向Web服务发送请求的超时.如果由于某种原因它没有响应客户端似乎永远旋转它的轮子.
狩猎已经显示我应该尝试做这样的事情:
((BindingProvider)myInterface).getRequestContext().put("com.sun.xml.ws.request.timeout", 10000);
((BindingProvider)myInterface).getRequestContext().put("com.sun.xml.ws.connect.timeout", 10000);
Run Code Online (Sandbox Code Playgroud)
我还发现,根据您拥有的JAXWS-RI版本,您可能需要设置这些属性:
((BindingProvider)myInterface).getRequestContext().put("com.sun.xml.internal.ws.request.timeout", 10000);
((BindingProvider)myInterface).getRequestContext().put("com.sun.xml.internal.ws.connect.timeout", 10000);
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是,无论上述哪一项是正确的,我都不知道我能在哪里做到这一点.我所拥有的只是一个Service子类,它实现了自动生成的webservice接口,并且实现了这一点,如果WSDL没有响应,那么设置属性已经太晚了:
MyWebServiceSoap soap;
MyWebService service = new MyWebService("http://www.google.com");
soap = service.getMyWebServiceSoap();
soap.sendRequestToMyWebService();
Run Code Online (Sandbox Code Playgroud)
任何人都能指出我正确的方向吗?!
有没有办法清除给定窗口的所有时间?我想超时存储在window对象的某个地方,但无法确认.
欢迎任何跨浏览器解决方案.