Created attachment 242887 [details] experimental patch for graphics/gd Life cycle of the gdFontCacheMutex related to fontCache seems to be wrong and fontCache may be used when it is NULL. This problem seems to be resolved in the bundled version of PHP. It seems to me that a bundled version should be used for php, but I guess a combination of mod_php (e.g. mod_php81+php81-gd) and mod_perl (e.g. ap24-mod_perl2+p5-GD), etc. would cause conflicts in the symbol table. but I don't know :) So I have prepared a patch that I think will make this equivalent to the bundled version of php. The option is THREADS for now, but I think the meaning is different :)
I still don't understand why it's necessary to bring all that code into a single… application server. are these various applications dependent on each other's state in that single server? if not, you should either split this into: - two application servers (one for mod_perl and one for mod_php) and proxy in front - or, just a proxy, which uses mod_proxy_fcgi and fpm for php, and one of the several FCGI frameworks for perl even if we do fix this, there's no telling what's going to break next with this much code in one server
I will look into this.
(In reply to Mina Galić from comment #1) It just so happens that Apache httpd used thread MPM (worker,event) + mod_php is the one that can keep calling gdImageStringFTEx enough to cause problems, and this could happen in any multi-threaded program that uses it. (In reply to Dirk Meyer from comment #2) In my environment, I am experimenting with this as is for now, but please look at it up to the possibility of rewriting everything as the case may be :)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=7311c841f51fa73d3f380e2f4b270044e94a3b91 commit 7311c841f51fa73d3f380e2f4b270044e94a3b91 Author: Dirk Meyer <dinoex@FreeBSD.org> AuthorDate: 2023-07-01 15:10:04 +0000 Commit: Dirk Meyer <dinoex@FreeBSD.org> CommitDate: 2023-07-01 15:10:04 +0000 graphics/gd: add option to change timing of gdFontCacheMutex setup and shutdown PR: 272091 graphics/gd/Makefile | 4 +- graphics/gd/files/extra-patch-threads (new) | 154 ++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+), 1 deletion(-)