这是我每天在我的应用程序日志中获得的常见异常,通常每天5/6次,每天访问量为1K:
db error trying to store stats
Traceback (most recent call last):
File "/base/data/home/apps/stackprinter/1b.347728306076327132/app/utility/worker.py", line 36, in deferred_store_print_statistics
dbcounter.increment()
File "/base/data/home/apps/stackprinter/1b.347728306076327132/app/db/counter.py", line 28, in increment
db.run_in_transaction(txn)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 1981, in RunInTransaction
DEFAULT_TRANSACTION_RETRIES, function, *args, **kwargs)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 2067, in RunInTransactionCustomRetries
ok, result = _DoOneTry(new_connection, function, args, kwargs)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 2105, in _DoOneTry
if new_connection.commit():
File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1585, in commit
return rpc.get_result()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 530, in get_result
return self.__get_result_hook(self)
File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1613, in __commit_hook
raise …Run Code Online (Sandbox Code Playgroud) 我讨厌甚至提起这个b/c有这么多的几百页报道这个错误可追溯到7 - 8年......但是,我无法想象这一点.
我在服务器A上运行的报表服务连接到服务器B上的SQL Server 2008 R2.两台服务器都运行Windows Server 2008.报表服务是多线程的,每次在自己的线程上运行多达10个报表.
我的连接字符串如下:
Data Source=ServerB;Initial Catalog=DBName;trusted_connection=YES;Connection Timeout=0;Max Pool Size=500;
Run Code Online (Sandbox Code Playgroud)
如您所见,我已将连接超时设置为0以等待连接,直到其可用,并且最大池大小为500 b/c我想确保池对于我的多线程服务来说不是太小.该错误通常仅在服务启动时显示,并且存在等待处理的报告队列.
显然,要做的第一件事就是寻找泄漏的连接..必须有未关闭的连接导致池填满,对吧?没有 - 看起来像池永远不会填满.
我花了最后几个小时在服务器上运行性能监视器,观看".NET数据提供程序为SqlServer",而NumberOfPooledConnections从未超过20左右.我还在SQL服务器上运行perfmon,观看"SQLServer:General Statistics",UserConnections永远不会超过50.在此期间,我通过手动重新启动服务导致此错误报告2或3次.
我还能找到什么?还有什么会导致这个错误?完整的错误消息是:
System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
Run Code Online (Sandbox Code Playgroud)
谢谢,斯蒂芬
我正在使用netty和ios构建服务器客户端应用程序,当用户只关闭他/她的ios设备上的WiFi时,我遇到了问题,netty服务器不知道它.服务器需要知道为该用户进行清理并将他/她设置为脱机,但现在当用户再次尝试连接时,服务器只是告诉他他/她已经在线.
在循环中使用UrlFetchApp.fetch时,有些URL比其他URL花费的时间更长并且失败.
有任何想法吗?
我是棱角分明的新手.我想在几分钟后使用$ timeout of angular来刷新范围.我正在开发一个社交应用程序,我需要在几分钟后刷新通知范围.使用服务从http请求获取通知.
JS:
App.factory('MyService' ,function($scope,$timeout){
return{
notification:return function(callback){
$timeout(function(){
$http.get("notification/get").success(callback)
},100000);
}
});
function Controller($scope,MyService){
MyService.notification(function(result){
$scope.notification =data;
});
Run Code Online (Sandbox Code Playgroud)
}
现在我怎么能在几分钟后做出http请求,1分钟后刷新通知范围.我尝试使用$ timeout但事情并不顺利.
我正在尝试使用量角器测试我网站上的登录页面.
如果您登录不正确,该网站会显示一条"吐司"消息,该消息会弹出5秒钟,然后消失(使用$timeout).
我正在使用以下测试:
describe('[login]', ()->
it('should show a toast with an error if the password is wrong', ()->
username = element(select.model("user.username"))
password = element(select.model("user.password"))
loginButton = $('button[type=\'submit\']')
toast = $('.toaster')
# Verify that the toast isn't visible yet
expect(toast.isDisplayed()).toBe(false)
username.sendKeys("admin")
password.sendKeys("wrongpassword")
loginButton.click().then(()->
# Verify that toast appears and contains an error
toastMessage = $('.toast-message')
expect(toast.isDisplayed()).toBe(true)
expect(toastMessage.getText()).toBe("Invalid password")
)
)
)
Run Code Online (Sandbox Code Playgroud)
相关标记(玉)如下:
.toaster(ng-show="messages.length")
.toast-message(ng-repeat="message in messages") {{message.body}}
Run Code Online (Sandbox Code Playgroud)
问题是toastMessage测试失败(找不到元素).它似乎在等待吐司消失然后运行测试.
我也尝试将toastMessage测试放在then()回调之外(我认为这无论如何都是多余的),但我得到完全相同的行为.
我最好的猜测是,量角器看到有一个$timeout …
我正在进行复杂模拟参数的优化.我使用多处理模块来增强优化算法的性能.我在http://pymotw.com/2/multiprocessing/basics.html上学到了多处理的基础知识.根据优化算法中给定的参数,复杂模拟持续不同的时间,大约1到5分钟.如果选择的参数非常糟糕,则模拟可持续30分钟或更长时间,结果无效.所以我在考虑在多处理的超时中构建,这会终止所有持续超过定义时间的模拟.这是问题的抽象版本:
import numpy as np
import time
import multiprocessing
def worker(num):
time.sleep(np.random.random()*20)
def main():
pnum = 10
procs = []
for i in range(pnum):
p = multiprocessing.Process(target=worker, args=(i,), name = ('process_' + str(i+1)))
procs.append(p)
p.start()
print 'starting', p.name
for p in procs:
p.join(5)
print 'stopping', p.name
if __name__ == "__main__":
main()
Run Code Online (Sandbox Code Playgroud)
该行p.join(5)定义了5秒的超时.由于for循环for p in procs:,程序等待5秒直到第一个进程完成,然后再等待5秒直到第二个进程完成,依此类推,但我希望程序终止所有持续超过5秒的进程.此外,如果所有进程的持续时间都不超过5秒,则程序不得等待5秒钟.
在我的一个应用程序中,我使用Googlevolley提供的服务器发送请求.
问题:超时和错误对象为空 onErrorResponse(VolleyError error)
到目前为止我尝试了什么:
1)首先我得到了null错误对象,所以使用下面的代码解决了它:
@Override
protected void deliverResponse(String response) {
super.deliverResponse(response);
}
@Override
public void deliverError(VolleyError error) {
super.deliverError(error);
DebugLog.e("deliverResponse", "getNetworkTimeMs : " + error.getNetworkTimeMs());
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,我得到了timeout当我得到错误对象时发生的事情null.
2)现在的应用是Android和iOS和web,但timeout只针对发生Android.
要求的排球日志:
BasicNetwork.logSlowRequests: HTTP response for request
Run Code Online (Sandbox Code Playgroud)
编辑说明:
在服务器端开发的Web服务对于所有三个实例(Android,Web和iOS)都是相同的.
Timeout 当有太多用户向服务器发出请求时发生.
我已经设定了2分钟的时间,但有时只有30秒的凌空抽射超时.
我有很多答案来改变服务器,但因为它是不可能所以任何其他解决方案请.
我还想补充一点,如果我能获得更多关于何时可以超时的超时的信息?
参考文献我经历过:
HttpClient的,经常超时的-使用-WiFi的是持续的,细带-3G
long_xmlhttprequest_ajax_requests_timeout_on_android
编辑:
我还设置了重试政策如下:
request.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 48,
0, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
Run Code Online (Sandbox Code Playgroud)
而且我也不想在连接超时时重试.
如何才能进行有效的服务调用,以解决问题timeout.
任何帮助都会得到满足.
谢谢.
这些都是超时错误,但是谁在408和504中超时?
根据w3,408被定义为:
客户端在服务器准备等待的时间内未产生请求。客户端可以在以后的任何时间重复请求而无需修改。
... 504是:
该服务器在充当网关或代理服务器时,未收到由URI指定的上游服务器(例如HTTP,FTP,LDAP)或尝试完成访问所需访问的其他一些辅助服务器的及时响应。请求。
那么,如果不是中间服务器,408中的“客户端”是谁?如果是实际的最终用户,那么服务器如何知道在发出请求之前要等待他们的请求?
我想知道你是否可以帮我解决我遇到的一个错误.我有一个我创建的HTTP管理器,可以帮助我处理来自网站的POSTing/GETing数据.直到最近,当我尝试使用两者的混合物时,它一直工作正常.第一个循环循环一切正常,在第二个循环上它挂起在HttpWebRequest.GetRequestStream()上.我已经在网上阅读并找不到真正的解决方案.以下是获取/接收的代码块:
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] buffer = encoding.GetBytes(_PostData);
_HttpWebRequest = (HttpWebRequest)WebRequest.Create(_FetchUrl);
_HttpWebRequest.Credentials = _Credentials;
_HttpWebRequest.Method = _RequestType.ToString();
_HttpWebRequest.ContentType = "application/x-www-form-urlencoded";
_HttpWebRequest.ContentLength = buffer.Length;
_HttpWebRequest.UserAgent = userAgent;
_HttpWebRequest.CookieContainer = _CookieContainer;
_HttpWebRequest.KeepAlive = false;
_HttpWebRequest.AllowAutoRedirect = _AllowAutoRedirect;
_HttpWebRequest.AutomaticDecompression = DecompressionMethods.GZip;
_HttpWebRequest.ServicePoint.Expect100Continue = false;
if (_RequestType.Equals(RequestTypes.POST))
{
// Write POST
Stream reqStream = _HttpWebRequest.GetRequestStream();
{
reqStream.Write(buffer, 0, buffer.Length);
reqStream.Flush();
reqStream.Close();
}
}
Run Code Online (Sandbox Code Playgroud)
和响应:
HttpWebResponse httpWebResponse = (HttpWebResponse)_HttpWebRequest.GetResponse();
{
Stream responseStream = httpWebResponse.GetResponseStream();
{
if (_UseGzip)
{
if (httpWebResponse.ContentEncoding.ToLower().Contains("gzip"))
{
responseStream = …Run Code Online (Sandbox Code Playgroud)