- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 Windows 上的 C# 应用程序中使用 Postgresql。我遇到的问题真的很奇怪,可以描述如下:
SELECT COUNT(*) AS c FROM files WHERE total_bytes IS NOT NULL
奇怪的笔记:
SELECT COUNT(*) AS c FROM files
异常回溯:
Npgsql.NpgsqlException: Exception while reading from stream
at Npgsql.ReadBuffer.Ensure(Int32 count, Boolean dontBreakOnTimeouts)
at Npgsql.NpgsqlConnector.DoReadMessage(DataRowLoadingMode dataRowLoadingMode, Boolean isPrependedMessage)
at Npgsql.NpgsqlConnector.ReadMessageWithPrepended(DataRowLoadingMode dataRowLoadingMode)
at Npgsql.NpgsqlConnector.ReadMessage(DataRowLoadingMode dataRowLoadingMode)
at Npgsql.NpgsqlConnector.ReadExpecting[T]()
at Npgsql.NpgsqlDataReader.NextResultInternal()
at Npgsql.NpgsqlDataReader.NextResult()
at Npgsql.NpgsqlCommand.Execute(CommandBehavior behavior)
at Npgsql.NpgsqlCommand.ExecuteDbDataReaderInternal(CommandBehavior behavior)
at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader()
at Npgsql.NpgsqlCommand.ExecuteReader()
at DriveShare.Database.Postgresql.ExecuteQuery(NpgsqlCommand command) in c:\projetos\driveshareclient\DriveShare\DriveShare\Database\Postgresql.cs:line 216
at DriveShare.Database.Postgresql.Query(String sql, Object[] args) in c:\projetos\driveshareclient\DriveShare\DriveShare\Database\Postgresql.cs:line 72
at DriveShare.Database.Postgresql.QueryOne(String sql, Object[] args) in c:\projetos\driveshareclient\DriveShare\DriveShare\Database\Postgresql.cs:line 83
at DriveShare.Database.Postgresql.QueryValue(String key, String sql, Object[] args) in c:\projetos\driveshareclient\DriveShare\DriveShare\Database\Postgresql.cs:line 97
at DriveShare.Database.Postgresql.QueryValue(String key, String sql) in c:\projetos\driveshareclient\DriveShare\DriveShare\Database\Postgresql.cs:line 92
at DriveShare.Database.FileIndexDataSet.CountIndexedFiles() in c:\projetos\driveshareclient\DriveShare\DriveShare\Database\FileIndexDataSet.cs:line 89
at DriveShare.Engine.DriveShareEngine.Start() in c:\projetos\driveshareclient\DriveShare\DriveShare\Engine\DriveShareEngine.cs:line 156
at DriveShareWebService.Program.Main(String[] args) in c:\projetos\driveshareclient\DriveShare\DriveShareWebService\Program.cs:line 19
由于我必须让程序保持运行,我编写了一个解决方法,让应用在继续之前重试该查询。我并不为此感到自豪:
public void WaitForConnection()
{
int limitSeconds = 3 * 60;
var start = DateTime.Now;
while (true)
{
try
{
Log.WaitingForDatabaseConnection();
Query("SELECT COUNT(*) AS c FROM files WHERE total_bytes IS NOT NULL");
Log.DatabaseConnectionAquired();
break;
}
catch (Exception e)
{
var wastedTime = DateTime.Now - start;
if (wastedTime.TotalSeconds > limitSeconds)
throw;
else
Log.Exception(e);
}
Thread.Sleep(1000);
}
}
我正在使用 Npgsql(在一个瘦抽象类中)连接到 Postgresql。 Postgresql 日志显示了一些我还不理解的关于 winsock 错误的条目:
2016-08-16 10:14:34 BRT LOG: database system was shut down at 2016-08-16 10:12:07 BRT
2016-08-16 10:14:34 BRT FATAL: the database system is starting up
2016-08-16 10:14:34 BRT LOG: MultiXact member wraparound protections are now enabled
2016-08-16 10:14:34 BRT LOG: sistema de banco de dados está pronto para aceitar conexões
2016-08-16 10:14:34 BRT LOG: autovacuum launcher started
2016-08-16 10:17:16 BRT LOG: could not receive data from client: unrecognized winsock error 10053
2016-08-16 10:17:27 BRT LOG: could not send data to client: unrecognized winsock error 10054
2016-08-16 10:17:27 BRT STATEMENT: SELECT path FROM files
2016-08-16 10:17:27 BRT FATAL: connection to client lost
2016-08-16 10:17:27 BRT STATEMENT: SELECT path FROM files
2016-08-16 10:17:27 BRT LOG: could not receive data from client: unrecognized winsock error 10053
2016-08-16 10:17:27 BRT LOG: unexpected EOF on client connection with an open transaction
2016-08-16 10:17:33 BRT LOG: unexpected EOF on client connection with an open transaction
2016-08-16 10:25:14 BRT LOG: could not receive data from client: unrecognized winsock error 10053
2016-08-16 10:25:15 BRT LOG: could not receive data from client: unrecognized winsock error 10053
2016-08-16 10:25:15 BRT LOG: unexpected EOF on client connection with an open transaction
2016-08-16 10:26:30 BRT LOG: could not send data to client: unrecognized winsock error 10054
2016-08-16 10:26:30 BRT FATAL: connection to client lost
2016-08-16 10:26:50 BRT LOG: could not send data to client: unrecognized winsock error 10054
2016-08-16 10:26:50 BRT FATAL: connection to client lost
2016-08-16 10:26:50 BRT LOG: could not receive data from client: unrecognized winsock error 10053
2016-08-16 10:26:50 BRT LOG: unexpected EOF on client connection with an open transaction
2016-08-16 10:27:06 BRT LOG: could not send data to client: unrecognized winsock error 10054
2016-08-16 10:27:06 BRT FATAL: connection to client lost
2016-08-16 10:27:06 BRT LOG: could not send data to client: unrecognized winsock error 10054
2016-08-16 10:27:06 BRT FATAL: connection to client lost
2016-08-16 10:27:30 BRT LOG: pedido de desligamento rápido foi recebido
2016-08-16 10:27:30 BRT LOG: interrompendo quaisquer transações ativas
2016-08-16 10:27:30 BRT LOG: autovacuum launcher shutting down
2016-08-16 10:27:30 BRT ERROR: canceling statement due to user request
2016-08-16 10:27:30 BRT LOG: autovacuum launcher shutting down
2016-08-16 10:27:30 BRT LOG: shutting down
2016-08-16 10:27:30 BRT LOG: database system is shut down
我不希望有人知道我的问题到底是什么。我只是希望有人可能有一些类似的问题可以阐明它。
最佳答案
在一些帮助下,我在 Npgsql 文档中找到了解决方案,here .
Npgsql 默认带有一些用于连接和命令的超时参数。 Windows 重启后,第一次访问表非常慢,触发命令超时。
通过连接字符串上的附加参数,我能够将这些设置更改得更高并解决我的问题:
connectionString += ";Timeout=180;Command Timeout=180";
额外提示:Postgresql 函数pg_sleep(seconds)
帮助我重现了该问题,而无需实际重新启动。非常有帮助:
SELECT pg_sleep(60);
关于c# - Windows 重启后 Postgresql 特定查询失败一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38977119/
我有一个 UWP 应用程序(在 Windows/Microsoft Store 中发布),我正在进行新的更新,我在我的应用程序中使用了 Template10,它具有深色和浅色主题,并且在 Window
我是 spring batch 的新手,有一些关于暂停/恢复的问题。看了spring batch的文档,好像没有内置的pause或者resume功能。但是,我从主站点找到了这个用例: http://d
我正在编写一个网络服务并有以下观察结果:即使我只是将一个文本文件添加到存储 web 服务引用的所有 dll 的目录 (bin),appdomain 也会刷新。 这会导致存储在字典(在其中一个 dll
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 6 年前。 Improve this qu
Hadoop 1.0.3 工作 36 小时后说: INFO mapred.JobClient: map 42% reduce 0% mapred.JobClient: Job Failed
我使用 AVAssetWriter 将视频录制到文件中。所以我为此创建了类。 link to gist 然后在项目的某处我推送记录并开始录制视频。 func start() { assetWriter
我想要一个在后台运行的 python 脚本(无限循环)。 def main(): # inizialize and start threads [...] try:
我在重新启动 Activity 时感到困惑。我有两个功能可以很好地完成同一任务。请指导我哪个最好,为什么? public void restart() { Intent
重启sidekiq的正确方法是什么。它似乎在我启动它时缓存了我的 worker 代码,所以每次我对我的 worker 进行更改时我都需要重新启动它。我正在使用 Ctrl/C 执行此操作,但该过程需要很
我在我的 Android 模拟器上安装了新字体。说明说我必须重新启动设备。我尝试使用“关机”按钮,但它只显示“正在关机”并且什么也不做。即使我去 adb shell 并运行“重启”它也会挂起。 任何想
启动操作 ? 1
关闭 service nginx stop systemctl stop nginx 启动 service nginx start systemctl start n
正在学习Linux中。。。一边学一边记录着。。所有观点只是个人观点 Linux有个文件 /etc/inittab 复制代码 代码如下:
如果我运行 systemctl restart kubelet它会影响其他正在运行的节点吗?它会停止集群吗?你能预见任何影响吗? 任何帮助,将不胜感激! 最佳答案 在回答之前,小声明:重启不是由于对
嗯,问题是我有一个在 MATE 上完美运行的 Abyssus Razer,但是 在 Debian、Elementary、OpenSUSE 和其他平台上,默认 设置 super 慢。 我用 解决了这个问
我在 Ubuntu 16.04 上安装了 NGINX 并编辑了我的配置。 当我想用 sudo service nginx restart 重新启动时我得到错误: Job for nginx.servi
我已经在我的 Ubuntu 上安装了 Gearman Job Server(又名 Gearmand)1.0.6: Distributor ID: Ubuntu Description: Ubun
我有一个 WiX Burn使用 ManagedBootstrapperApplicationHost 的自定义安装程序。安装必备 Microsoft Windows Installer 之一后4.5
我已经使用 brew install mosquitto 在我的 mac 上安装了蚊子代理. 通常我不会给出任何命令来启动 mosquitto 服务器。当我打开我的 mac 时它会自动启动。 我已经使
我有一个带有 2 个容器的 pod test-1495806908-xn5jn。我想重新启动其中一个名为 container-test 的项目。是否可以重新启动 Pod 中的单个容器以及如何重新启动?
我是一名优秀的程序员,十分优秀!