1

I have read a lot about this error in different forums but still cannot find a solution

My productive server currently has:

Apache: 2.4.25 PHP: 5.6.40

Using the PHPSpreadsheet library in version 1.8.2, different Excel files are generated; For different reasons (Large amounts of information and styles applied to the cell sheet) an xlsx file of maximum 3MB is exported in quite long execution time (It can reach 30/40 minutes).

And all this worked until we moved and dockerized to our new server, whose OS is CentOS7 and has a docker for apache, php and another for mysql.

Now when generating these "large" files the error.log trace shows the following error: [core: notice] [pid 8] AH00052: child pid 15829 exit signal Segmentation fault (11)

I tried to replicate the error using virtual machines in my local machine and in another one, I put OS centos7 and dockerized on them, I even copied the same configuration files from the productive server, however, on these machines the error does not appear and allows me to download correctly.

Currently I am desperate, I have tried every internet solution in reverse to replicate the error before trying any solution on the production line, but this error is by no means replicated.

I appreciate any information and help with a just cause ... I know that at this point php 5.6 is quite sent to collect, but I cannot commit the work time to an update if in the end it is not going to solve this incident.

Andres
  • 41
  • 1
  • 6
  • 1
    Probably need a trace to really have any insight. Upgrade to PHP 7.x is not that hard. Few non BC changes but I've updated some large code bases in less than an hour. – ficuscr Sep 23 '20 at 18:22
  • Use the deprecated mysql as db connector make it harder. I prefer to upgrade if that for sure fix the mistake, i have to sustain any decision i make – Andres Sep 23 '20 at 18:34
  • 1
    Ouch. No PDO huh. Yeah that's tough. Did you change httpd versions too or just centos? Other workarounds... Is this long running thing actually tied to an httpd process or does that just kick it off? Can you reproduce the issue with a simple script that you could share? – ficuscr Sep 23 '20 at 18:47
  • I copied the php.ini and httpd.conf files in every new environment that i used; and yes, my process is tied to httpd. I don't know if can replicate it in a new script, my theory is that the error occurs when theres a long loop, like if some configuration takes it as an infinite loop. But how said before, i can't replicate it in other enviroment diferent of production :_( May can i put here my script for the xlsx generation? – Andres Sep 23 '20 at 19:12
  • There is a [shim for `mysql`](https://github.com/dshafik/php7-mysql-shim) in PHP 7, that internally uses `mysqli` alternatives. It is not a direct replacement for parameterized queries but would allow you to upgrade to PHP 7.x until you are able to rewrite the `mysql_*()` function calls. However, I don't believe this issue specifically would be resolved by upgrading PHP to 7.x or 8 – Will B. Sep 23 '20 at 19:53

1 Answers1

0

Seems like a possible fix, and definitely an optimization, would be getting away from having an httpd child tied to anything that runs that long. I'd expect something like this to fail. The number of things that would want to timeout this request is long. I mean is the user sitting there for 40 minutes?

What about having your web interface trigger a PHP script (CLI)?

exec('php slowasf.php arg1 arg2 >/dev/null 2>/dev/null &');

Could look at a message queue to track progress. More of a long comment maybe than an answer. But then your question lacks code!

Finally, you did try giving it more RAM?

ficuscr
  • 6,975
  • 2
  • 32
  • 52