opendcim / openDCIM

An open source (GPL v3) Data Center Inventory Management (DCIM) application.
http://opendcim.org
306 stars 205 forks source link

Upgrade to 23.04 row and cabinet don't load #1541

Closed matthewgrainger closed 4 months ago

matthewgrainger commented 4 months ago

Hi

Firstly, apologies if this has been covered already, but I was not able to find anything on this problem I'm having I have done an upgrade of our openDCIM from version 19.01 to 23.04 which also involved an upgrade of PHP from version 5.4 to version 8.1

As it stands now all the preflight check are showing as green after the upgrade but when trying to view either the row or cabinet we get the bouncing square. When looking at the network debug in the browser, there is an error 500 Internal Server Error for https://dcim.eohcloud.co:7443/api/v1/cabinet/36/getpictures

when I dig in to the error logs in the /var/www/log/httpd/dcim_error.log I see the following errors

[Wed Jun 19 14:52:03.340331 2024] [php:error] [pid 5019] [client 10.249.105.1:54738] PHP Fatal error: Uncaught RuntimeException: Unexpected data in output buffer. Maybe you have characters before an opening <?php tag? in /var/www/openDCIM-23.04/vendor/slim/slim/Slim/App.php:621\nStack trace:\n#0 /var/www/openDCIM-23.04/vendor/slim/slim/Slim/App.php(317): Slim\App->finalize(Object(Slim\Http\Response))\n#1 /var/www/openDCIM-23.04/api/v1/index.php(130): Slim\App->run()\n#2 {main}\n thrown in /var/www/openDCIM-23.04/vendor/slim/slim/Slim/App.php on line 621, referer: https://dcim.eohcloud.co:7443/rowview.php?row=11

[Wed Jun 19 14:57:14.741929 2024] [php:error] [pid 5025] [client 10.249.105.1:54789] PHP Fatal error: Uncaught RuntimeException: Unexpected data in output buffer. Maybe you have characters before an opening <?php tag? in /var/www/openDCIM-23.04/vendor/slim/slim/Slim/App.php:621\nStack trace:\n#0 /var/www/openDCIM-23.04/vendor/slim/slim/Slim/App.php(317): Slim\App->finalize(Object(Slim\Http\Response))\n#1 /var/www/openDCIM-23.04/api/v1/index.php(130): Slim\App->run()\n#2 {main}\n thrown in /var/www/openDCIM-23.04/vendor/slim/slim/Slim/App.php on line 621, referer: https://dcim.eohcloud.co:7443/cabnavigator.php?cabinetid=36

at this point, I rolled back the upgrade (revert to snapshot) and did an upgrade from 19.01 to 23.02 also the php 5.4 to 8.1 this upgrade all work and everything was working fine I then upgrade 23.02 to 23.03 this time I was getting the bouncing square for the row, but the cabinets were loading fine. And there were no errors in the /var/www/log/httpd/dcim_error.log Then upgrade from 23.03 to 23.04 and i was back to the problem with bouncing square for both rows and cabinets with the above error in the /var/www/log/httpd/dcim_error.log again

From the release notes, I know that there was a change to the Slim Framework in version 23.03, but there were no errors been give on that version only on the version 23.04 I think this might be due to changes in the /vendor/slim/slim/Slim/App.php file from version 23.03 to 23.04, but I don't know.

If anyone can help or point me to something that could help, I would be very grateful.

wilpig commented 4 months ago

Do you have your php set to display errors to the browser or just log them like a sane person?

matthewgrainger commented 4 months ago

I honestly don't know. I have not changed anything on the error logging side from what the defaults are, so I'm just going on the error I can see in the current logs and debug via the F12 on the browser.

Also, I should note. I have taken over the openDCIM instance from someone who has not left. So there could be change from default that i don't know about.

samilliken commented 4 months ago

You are displaying errors to the browser. What you described fits it to a tee

Scott

On Wed, Jun 19, 2024, 9:51 AM matthewgrainger @.***> wrote:

I honestly don't know. I have not changed anything on the error logging side from what the defaults are, so I'm just going on the error I can see in the current logs and debug via the F12 on the browser.

— Reply to this email directly, view it on GitHub https://github.com/opendcim/openDCIM/issues/1541#issuecomment-2178775987, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMTY63QYYZSPYGWRNYCRBLZIGEHBAVCNFSM6AAAAABJSCAEF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZYG43TKOJYG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

wilpig commented 4 months ago

Typically we only see this error when display errors is set to on in the php.ini and you get it because the server is trying to show you the error to the screen and breaking the framework.

Uncaught RuntimeException: Unexpected data in output buffer. Maybe you have characters before an opening <?php tag? i

The only other condition that has triggered something like this is when the date.timezone = isn't set in the php.ini but I thought we fixed that with the 23.04 release, finally.

matthewgrainger commented 4 months ago

If there is any information or logs you need for our setup, just tell me where to get them and I will post them. I don't know PHP code, so reading these *.php files is a struggle.

matthewgrainger commented 4 months ago

So in the php.ini I found that there is a setting

; Besides displaying errors, PHP can also log errors to locations such as a ; server-specific log, STDERR, or a location specified by the error_log ; directive found below. While errors should not be displayed on productions ; servers they should still be monitored and logging is a great way to do that. ; Default Value: Off ; Development Value: On ; Production Value: On ; http://php.net/log-errors log_errors = On

not sure if this is what you mean by display errors is set to on?

wilpig commented 4 months ago

; This directive controls whether or not and where PHP will output errors, ; notices and warnings too. Error output is very useful during development, but ; it could be very dangerous in production environments. Depending on the code ; which is triggering the error, sensitive information could potentially leak ; out of your application such as database usernames and passwords or worse. ; For production environments, we recommend logging errors rather than ; sending them to STDOUT. ; Possible Values: ; Off = Do not display any errors ; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) ; On or stdout = Display errors to STDOUT ; Default Value: On ; Development Value: On ; Production Value: Off ; http://php.net/display-errors display_errors = Off

matthewgrainger commented 4 months ago

So the display_errors is set to Off in the php.ini Also, I have not changed log_errors = On to log_errors = Off

and this has stopped the error i was getting in /var/www/log/httpd/dcim_error.log but still only getting bouncing square for both rows and cabinets

wilpig commented 4 months ago

What do you get when you goto https://dcim.eohcloud.co:7443/api/v1/cabrow/11/devices in your browser?

matthewgrainger commented 4 months ago

I get a blank page and browse debug shows me this image

wilpig commented 4 months ago

then you should have an error or series of them in the apache error log.

matthewgrainger commented 4 months ago

Dumb question, which log file is that?

wilpig commented 4 months ago

I haven't seen your apache configs. If you haven't routed them someplace funky it will either be error_log or ssl_error_log

matthewgrainger commented 4 months ago

So in I have checked both /var/log/httpd/error_log /var/log/httpd/ssl_error_log

nothing be generated in these files when hitting https://dcim.eohcloud.co:7443/api/v1/cabrow/11/devices

in the VirtualHost the ErrorLog is defined as /var/log/httpd/dcim_error.log

matthewgrainger commented 4 months ago

I gave up.

I rebuilt a new VM with a fresh installation of openDCIM 23.04 and then import the DB on to the clean installation. And this has fixed the problem.

yay, \o/