简体   繁体   English

Indy 10 TCP命令处理程序是否异步?

[英]Are Indy 10 TCP command handlers asynchronous?

I have been having exceptions crop in my application, either stack overflow or our of memory . 我的应用程序中出现了异常裁剪,无论是stack overflow还是our of memory They show up in different places, depending on when the system has had enough. 它们显示在不同的位置,具体取决于系统何时可用。 To put it another way, running the app twice won't lead to the same exception in the same place. 换句话说,两次运行该应用程序不会在同一位置导致相同的异常。

I have some timers which cause database access. 我有一些导致数据库访问的计时器。 The AnyDac d/b component guys tell me that I can't reuse a global TADConnection but have to allocate it dynamically in each timer handler, which I have done. AnyDac d / b组件人员告诉我,我不能重用全局TADConnection而必须在每个计时器处理程序中动态分配它,这已经完成了。

I just thought that I had had a d'oh! 我只是以为我已经过了! moment when I looked at the latest stack trace. 当我查看最新堆栈跟踪的那一刻。

fMainForm.TMainForm.GetToolNumberFromContext($31846FB4)
fMainForm.TMainForm.Received_HEART_BEAT($249AEFD0)
IdCommandHandlers.TIdCommand.DoCommand
IdCommandHandlers.TIdCommandHandler.DoCommand(???,$31846FB4,'')
IdCommandHandlers.TIdCommandHandler.Check('HEART_BEAT',$31846FB4)
IdCommandHandlers.TIdCommandHandlers.HandleCommand($31846FB4,'HEART_BEAT') <===
uADDatSManager.TADDatSRow.SetBlobLength($7DA10FDC,0,$C18DDDC,10,0,1,False)
uADDatSManager.TADDatSRow.SetBlobData($7DA10FDC,0,$C18DDDC,10,False)
uADDatSManager.TADDatSRow.SetData(0,$C18DDDC,10)
uADPhysMySQL.TADPhysMySQLCommand.FetchRow($7D2F4F90,nil)
uADPhysMySQL.TADPhysMySQLCommand.InternalFetchRowSet($7D2F4F90,nil,50)
uADPhysManager.DoFetch(0,50,50,False)
uADPhysManager.TADPhysCommand.FetchBase($7D2F4F90,False)
uADPhysManager.TADPhysCommandAsyncFetch.Execute
uADStanAsync.TADStanAsyncExecutor.ExecuteOperation(False)
uADStanAsync.TADStanAsyncExecutor.Run
uADPhysManager.TADPhysCommand.ExecuteTask(TADPhysCommandAsyncFetch($7DA24FEC) as IADStanAsyncOperation,TADPhysCommandAsyncFetch($7DA24FF8) as IADStanAsyncHandler,True)
uADPhysManager.TADPhysCommand.Fetch($7D2F4F90,False,True)
uADCompClient.TADCustomCommand.Fetch($7D2F4F90,False,True)
uADCompClient.TADCustomTableAdapter.Fetch(False)
uADCompClient.TADAdaptedDataSet.DoFetch($7D2F4F90,False,fdDown)
uADCompDataSet.TADDataSet.InternalFetchRows(False,True,fdDown)
uADCompDataSet.TADDataSet.GetRecord($7DA1AFF4,gmNext,True)
Data.DB.TDataSet.GetNextRecord
Data.DB.TDataSet.GetNextRecords
Data.DB.TDataSet.SetBufferCount(???)
Data.DB.TDataSet.UpdateBufferCount
Data.DB.TDataSet.DoInternalOpen
Data.DB.TDataSet.OpenCursor(???)
uADCompDataSet.TADDataSet.OpenCursor(False)
uADCompClient.TADRdbmsDataSet.OpenCursor(False)
Data.DB.TDataSet.SetActive(???)
uADCompDataSet.TADDataSet.SetActive(True)
Data.DB.TDataSet.Open
uADCompClient.TADRdbmsDataSet.Open('SELECT * FROM tagged_chemicals',(...),(...))
uADCompClient.TADRdbmsDataSet.Open('SELECT * FROM tagged_chemicals')
fMainForm.TMainForm.CheckEndOfScheduleTimerTimer($B116FAC)
Vcl.ExtCtrls.TTimer.Timer
Vcl.ExtCtrls.TTimer.WndProc(???)
System.Classes.StdWndProc(133584,275,1,0)
:768a62fa ; C:\Windows\syswow64\USER32.dll
:768a6d3a USER32.GetThreadDesktop + 0xd7
:768a77c4 ; C:\Windows\syswow64\USER32.dll
:768a788a USER32.DispatchMessageW + 0xf
Vcl.Forms.TApplication.ProcessMessage(???)

I don't understand that marked line, the sudden switch from AnyDac to Indy code 我不明白那条标记线,突然从AnyDac切换到Indy代码

IdCommandHandlers.TIdCommandHandlers.HandleCommand($31846FB4,'HEART_BEAT') <===
uADDatSManager.TADDatSRow.SetBlobLength($7DA10FDC,0,$C18DDDC,10,0,1,False)

Can someone please explain it? 有人可以解释一下吗? Thanks 谢谢

My first thought was that Indy was interrupting AnyDac, perhaps because it called Applciation.ProcessMessages or similar, but I don't see that on the stack ... 我的第一个想法是Indy正在中断AnyDac,可能是因为它调用了Applciation.ProcessMessages或类似名称,但是我在堆栈上看不到它。

But if it can do that, then can it interrupt "normal" non-timer handler code? 但是,如果可以做到,那么它可以中断“正常”的非计时器处理程序代码吗?

I was sure that I had it cracked and that the problem was that my TCP command handlers were reusing an AnyDac component used by something else ... then I looked at my code and saw that there is no database access in the command handlers or in anything that they call. 我确定我破解了它,问题是我的TCP命令处理程序正在重用别的东西使用的AnyDac组件……然后我查看了我的代码,发现命令处理程序中或其中没有数据库访问权限他们所说的任何东西。

I am stumped. 我感到难过。 Does what I wrote even make sense? 我写的东西有意义吗? Can anyone offer any advice? 谁能提供任何建议?

Thanks a 1,000,000 in advance for any help. 预先感谢1,000,000的任何帮助。

Indy's commands handlers are used by TIdCmdTCPServer and TIdCmdTCPClient , which are both multi-threaded components. 都是多线程组件的TIdCmdTCPServerTIdCmdTCPClient使用Indy的命令处理程序。 The command handlers are invoked inside of worker threads that Indy creates internally. 命令处理程序在Indy内部创建的工作线程内部调用。 There is no way that a command handler can interrupt an operation that is running in a different thread. 命令处理程序无法中断在其他线程中运行的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM