在Windows Update之后,当Active设置为False时,TIdHttpServer将冻结



我们有一个Indy(版本10.6.1.5235(TIdHttpServer"服务",多年来一直与Delphi 2007配合使用。在最近的Windows Update(KB4338815和KB4338830(之后,我们注意到当TIdHttpServer设置为false时,服务冻结。

我已经包含了创建TIdHttpServer的源代码。在我们的服务"停止"处理程序中,我们将IdHttpServer1.Active设置为False,这就是它冻结的位置。Indy在试图关闭http连接时似乎挂起了。附近有工作吗?

更新一个根据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;

应用程序运行良好,但一旦您单击"停止"按钮,将IdHttpServerActive属性设置为False,它就会挂起。

您可能遇到过类似的问题:

Windows 2012 R2 closesocket((挂在侦听套接字上

该问题是由Microsoft的修补程序带来的,该修补程序导致closesockettо永远挂在Intel Xeon处理器上

通过卸载您已安装的KB4338815解决了该问题。因此,请尝试在您的系统上卸载该KB,看看它是否能解决您的问题。

相关内容

最新更新