Windows 更新后 Active 设置为 False 时 TIdHttpServer 冻结
TIdHttpServer freezing when Active set to False after Windows Update
我们有一个 Indy(版本 10.6.1.5235)TIdHttpServer "service" 多年来一直与 Delphi 2007 配合使用。在最近的 Windows 更新(KB4338815 和 KB4338830)之后我们注意到当 TIdHttpServer 设置为 false 时服务会冻结。
我已经包含了创建 TIdHttpServer 的源代码。在我们的服务 "Stop" 处理程序中,我们将 IdHttpServer1.Active 设置为 False,这就是它冻结的地方。似乎 Indy 在尝试关闭 http 连接时挂起。有解决办法吗?
Update One Per Remy Lebeau,我创建了一个最小的、完整的和可验证的示例。这是:
procedure TMainForm.Button1Click(Sender: TObject);
begin
memo1.clear;
iCall := 0;
IdHTTPServer1 := TIdHTTPServer.Create;
IdHTTPServer1.MaxConnections := 10;
IdHTTPServer1.AutoStartSession := True;
IdHTTPServer1.SessionState := True;
IdHTTPServer1.OnCommandGet := IdHTTPServer1CommandGet;
IdHTTPServer1.KeepAlive := False;
idHttpServer1.DefaultPort := 80;
if ReuseSocket.checked then
IDHTTPSERVER1.ReuseSocket := rsTrue;
IdHTTPServer1.Active := True;
end;
procedure TMainForm.IdHTTPServer1CommandGet(AContext: TIdContext;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
iCall := iCall + 1;
if iCall mod 100 = 0 then
memo1.lines.add(inttostr(iCall)+ ' calls made');
AResponseInfo.ContentText := '<html><body>Hello There</body></html';
end;
procedure TMainForm.StopClick(Sender: TObject);
begin
try
IdHTTPServer1.Active := False;
memo1.lines.add('IdHTTPServer1.Active := False;');
except
on e: exception do
memo1.lines.add('Exception on IdHTTPServer1.Active := False; Message:'+e.message);
end;
end;
应用程序 运行 正常,但是一旦您单击 "Stop" 按钮将 IdHttpServer Active 属性 设置为 False,它就会挂起。
您可能遇到过类似的问题:
The issue was brought by patch from Microsoft KB4338815, which caused closesocket
tо hang forever on Intel Xeon processors
已通过卸载您已安装的 KB4338815 解决了该问题。因此,请尝试在您的系统上卸载该 KB,看看它是否能解决您的问题。
我们有一个 Indy(版本 10.6.1.5235)TIdHttpServer "service" 多年来一直与 Delphi 2007 配合使用。在最近的 Windows 更新(KB4338815 和 KB4338830)之后我们注意到当 TIdHttpServer 设置为 false 时服务会冻结。
我已经包含了创建 TIdHttpServer 的源代码。在我们的服务 "Stop" 处理程序中,我们将 IdHttpServer1.Active 设置为 False,这就是它冻结的地方。似乎 Indy 在尝试关闭 http 连接时挂起。有解决办法吗?
Update One Per Remy Lebeau,我创建了一个最小的、完整的和可验证的示例。这是:
procedure TMainForm.Button1Click(Sender: TObject);
begin
memo1.clear;
iCall := 0;
IdHTTPServer1 := TIdHTTPServer.Create;
IdHTTPServer1.MaxConnections := 10;
IdHTTPServer1.AutoStartSession := True;
IdHTTPServer1.SessionState := True;
IdHTTPServer1.OnCommandGet := IdHTTPServer1CommandGet;
IdHTTPServer1.KeepAlive := False;
idHttpServer1.DefaultPort := 80;
if ReuseSocket.checked then
IDHTTPSERVER1.ReuseSocket := rsTrue;
IdHTTPServer1.Active := True;
end;
procedure TMainForm.IdHTTPServer1CommandGet(AContext: TIdContext;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
iCall := iCall + 1;
if iCall mod 100 = 0 then
memo1.lines.add(inttostr(iCall)+ ' calls made');
AResponseInfo.ContentText := '<html><body>Hello There</body></html';
end;
procedure TMainForm.StopClick(Sender: TObject);
begin
try
IdHTTPServer1.Active := False;
memo1.lines.add('IdHTTPServer1.Active := False;');
except
on e: exception do
memo1.lines.add('Exception on IdHTTPServer1.Active := False; Message:'+e.message);
end;
end;
应用程序 运行 正常,但是一旦您单击 "Stop" 按钮将 IdHttpServer Active 属性 设置为 False,它就会挂起。
您可能遇到过类似的问题:
The issue was brought by patch from Microsoft KB4338815, which caused
closesocket
tо hang forever on Intel Xeon processors
已通过卸载您已安装的 KB4338815 解决了该问题。因此,请尝试在您的系统上卸载该 KB,看看它是否能解决您的问题。