在Delphi XE中Apache方法apr_pool_create_ex的正确使用是什么?
在Delphi XE中Apache方法apr_pool_create_ex的正确使用是什么?
我之前创建过 Apache 模块,但都是处理程序。现在我正在开发一个服务提供商。框架模块已创建,并且 Apache 正在调用我的 child_init 回调方法。在 child_init 方法中,我成功调用 ap_pool_create_ex* (返回 APR_SUCCESS),但是在离开 child_it 调用之后,我在 (httpd.exe) 生成第三个或第四个工作线程期间收到访问冲突(第三个显示在事件中)日志)。
procedure provider_child_init(pchild: Papr_pool_t; s: Pserver_rec); cdecl;
var
rv : apr_status_t;
mypool : Papr_pool_t;
begin
rv := -1;
rv := apr_pool_create_ex(@mypool,pchild,nil,nil);
end;
AV消息是:
“项目C:\Apache2.2\bin\http.exe 连续筹集太多 异常:'访问冲突 0x00000000:读取地址 0x00000000'。进程已停止。使用步骤 或运行以继续”
事件日志:
…
Thread Start: Thread ID: 5652. Process httpd.exe (4212)
Thread Start: Thread ID: 5132. Process httpd.exe (4212)
Thread Start: Thread ID: 5988. Process httpd.exe (4212)
注意:AV 发生在线程 ID 5988 和 4212 中,是父 httpd.exe 进程。
- Windows“libapr-1.dll”不包含“apr_pool_create”,这就是我使用“_ex”版本的原因。知道为什么 apr_pool_create 丢失吗?我看到 apr_pool_create 被用在其他成功的模块中,尽管它们都是用“C”写的。
操作系统:Windows 7 Enterprise 64 位
阿帕奇:2.2.17.0
IDE:Delphi XE
What is proper use of Apache method apr_pool_create_ex in Delphi XE?
I’ve created Apache modules before, but all were Handlers. Now I’m working on developing a Service provider. A skeleton module has been created and my child_init call back method is being called by Apache. In the child_init method I call ap_pool_create_ex* successfully (returns APR_SUCCESS), but after leaving the child_it call, I receive an access violation either during the (httpd.exe) spawning of the third or the fourth worker thread (third is showing in the event log).
procedure provider_child_init(pchild: Papr_pool_t; s: Pserver_rec); cdecl;
var
rv : apr_status_t;
mypool : Papr_pool_t;
begin
rv := -1;
rv := apr_pool_create_ex(@mypool,pchild,nil,nil);
end;
The AV message is:
“Project C:\Apache2.2\bin\http.exe
raised too many consecutive
exceptions: ‘access violation at
0x00000000: read of address
0x00000000’. Process Stopped. Use Step
or Run to continues”
Event Log:
…
Thread Start: Thread ID: 5652. Process httpd.exe (4212)
Thread Start: Thread ID: 5132. Process httpd.exe (4212)
Thread Start: Thread ID: 5988. Process httpd.exe (4212)
NOTE: The AV occurs in Thread ID 5988 and 4212 is the Parent httpd.exe process.
- The windows “libapr-1.dll” does not include “apr_pool_create”, that is why I’m using the “_ex” version. Any idea why apr_pool_create is missing? I see apr_pool_create being used in other successful modules although they are written in ‘C’.
OS: Windows 7 Enterprise 64-bit
Apache: 2.2.17.0
IDE: Delphi XE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您对函数的翻译正确吗? Delphi XE Version Insight(Subversion 插件)声明如下:
另请检查您的
provider_child_init< /code> 回调实际上应该声明为
cdecl
而不是stdcall
。另外,由于出现空指针访问冲突,还有一些想法。根据apr源代码评论:
abort_fn
将会被回调。你将其传递为零;也许池试图调用它是因为它无法分配内存?Is your translation of the function correct? Delphi XE Version Insight (Subversion plugin) declares it as follows:
Also check if your
provider_child_init
callback should really be declared ascdecl
and notstdcall
.Also, some ideas since you get a null pointer access violation. According to the apr source code comment:
abort_fn
will be called back if the pool cannot allocate memory. You're passing it nil; perhaps the pool is trying to call it because it cannot allocate memory?