-
Notifications
You must be signed in to change notification settings - Fork 363
Fixed #202 Conflict with other modules using libapr #222
Conversation
Could you give some steps to reproduce the problem, so I can verify that this fixes it? |
complie with this nginx module (https://github.com/chaizhenhua/ngx_apr.git) and run some test cases. then |
} | ||
void NgxRewriteDriverFactory::Terminate() { | ||
RewriteDriverFactory::Terminate(); | ||
apr_terminate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm no apr expert, but the docs at http://apr.apache.org/docs/apr/0.9/group__apr__library.html mention this:
The APR developers suggest using atexit to ensure this is called.
I remember that apr_initialize() and apr_terminate() perform reference counting, which makes me think that we should call terminate as late as possible, to prevent forwarding this problem to other modules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got the defination:
APR_DECLARE_NONSTD(void) apr_terminate(void)
{
initialized--;
if (initialized) {
return;
}
apr_pool_terminate();
}
reference counting is used.
so if apr_initialize and apr_terminate are paired and no race condition, the terminate sequence is unimportent.
i tried to find apr_initialize
in pagespeed but failed, may be the crash is caused by no paired apr_initialize and apr_terminate.
in my opinion, module can call apr_terminate
at any time after finish using it although there was a suggestation. atexit()
will break the encapsulation.
are you agree?
@chaizhenhua |
@chaizhenhua
All with different backtraces.
|
@oschaaf i forgotten to tell you that the ngx_apr has the same bug as modsecurity. now i have fixed it. could you please put the backtraces and use new I think we can ignore modsecurity, but only pass the tiny test module. I cant reproduce, i just run all test cases then quit, there is no crash. did SerfFetchers only run in RewriteDriverFactory lifetime? I think we should find the reason why crashed in this way. pagespeed can determine when to terminate apr, while other module is out of our control. so we'd better solve it without modify other module. |
@chaizhenhua @jeffkaufman |
Fixed by #601 |
No description provided.