Skip to content

Commit

Permalink
ext/opcache/zend_jit: call TSRM dtor before unloading opcache.so
Browse files Browse the repository at this point in the history
Commit a211956 added a TSRM destructor, but that destructor
will get called by tsrm_shutdown(), which is after opcache.so has
already been unloaded, resulting in a shutdown crash, e.g.:

  #0  0x00007fad01737500 in ?? ()
  php#1  0x000055ac54e723c4 in tsrm_shutdown () at TSRM/TSRM.c:194
  php#2  0x000055ac54c42180 in main (argc=80, argv=0x55ac57bc14d0) at sapi/cli/php_cli.c:1388

By calling ts_free_id() before opcache.so gets unloaded, we can easily
fix this crash bug.
  • Loading branch information
MaxKellermann committed Feb 7, 2023
1 parent c95125d commit a42cc57
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ext/opcache/jit/zend_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -5078,7 +5078,9 @@ ZEND_EXT_API void zend_jit_shutdown(void)
zend_jit_perf_jitdump_close();
}
#endif
#ifndef ZTS
#ifdef ZTS
ts_free_id(jit_globals_id);
#else
zend_jit_trace_free_caches();
#endif
}
Expand Down

0 comments on commit a42cc57

Please sign in to comment.