Windows更新后将Active设置为False时TIdHttpServer冻结 [英] TIdHttpServer freezing when Active set to False after Windows Update

查看:135
本文介绍了Windows更新后将Active设置为False时TIdHttpServer冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Indy(版本10.6.1.5235)TIdHttpServer服务",在Delphi 2007中已经使用了很多年.在最新的Windows Update(KB4338815和KB4338830)之后,我们注意到当TIdHttpServer设置为false时,该服务将冻结.

We have a Indy (version 10.6.1.5235) TIdHttpServer "service" that has worked well for years with Delphi 2007. After the most recent Windows Update (KB4338815 and KB4338830) we noticed the service freezes when TIdHttpServer is set to false.

我已包含创建TIdHttpServer的源代码.在我们的服务停止"处理程序中,将 IdHttpServer1.Active 设置为False,这就是冻结的地方.似乎Indy尝试关闭http连接时挂起.有解决方法吗?

I have included source code where TIdHttpServer is created. In our service "Stop" handler we set IdHttpServer1.Active to False and this is where it freezes. It seems Indy hangs when it is trying to close the http connections. Is there a work around?

更新一个每个Remy Lebeau,我创建了一个最小,完整和可验证的示例.在这里:

Update One Per Remy Lebeau, I have created a Minimal, Complete, and Verifiable example. Here it is:

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;

应用程序可以正常运行,但是一旦您单击停止"按钮(将IdHttpServer Active属性设置为False),它就会挂起.

Application will run fine but once you click the "Stop" button which sets the IdHttpServer Active property to False it hangs.

推荐答案

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

You might have encountered this similar issue:

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

此问题是由Microsoft KB4338815 修补程序引起的,该补丁导致closesockett®永久挂在Intel Xeon处理器上

The issue was brought by patch from Microsoft KB4338815, which caused closesocket tо hang forever on Intel Xeon processors

此问题已通过卸载确实已安装的 KB4338815 得以解决.因此,请尝试在系统上卸载该KB,然后查看它是否可以解决您的问题.

That issue was fixed by uninstalling KB4338815, which you do have installed. So try uninstalling that KB on your system and see if it solves your issue.

这篇关于Windows更新后将Active设置为False时TIdHttpServer冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆