[Php kernel bug] Expansion of dynamic link compilation, expansion of global space dtor causes coredump
Source: Internet
Author: User
Author: goosman. lei (leiguo) blog: leiguo author: goosman. lei (leiguo) blog: http://blog.csdn.net/lgg201mail: lgg860911@yahoo.com.cn-related code can be referred Chapter 2: "Extension Globals. code for registering an extended global space: # ifdef ZTS ts_allocate_id (& sample_globals_id, sizeof (zend_sample_globals), (ts_allocate_ctor) samples (sample), (ts_allocate_dtor) samples )); # else sample_globals_ctor (& sample_globals TSRMLS_CC); # endif writes a record to the resource_types_table array in the ts_allocate_id () function call. during the tsrm_shutdown () process, the registered dtor callback function is called. however, after coding according to the book, coredump will occur when running the test code. after tracking, we found that during the zend_shutdown () call process, we have already called DL_UNLOAD (module-> handle) for the module; as a result, the currently registered dtor is executing tsrm_shutdown () is no longer accessible. in addition, you can see ext/standard/file in the standard extension. c also uses this registration method. However, it should be static compilation, so there is no problem. my extension is compilation. so dynamic link. the following is the call path from zend_shutdown () to DL_UNLOAD. zend_shutdown () => zend_desctroy_modules () => modules () => zend_hash_apply_deleter () => module_destructor () => DL_UNLOAD ()
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.