Icinga / icingaweb2-module-director

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.
https://icinga.com/docs/director/latest
GNU General Public License v2.0
413 stars 203 forks source link

Fatal error: Cannot use ipl\Html\Util as Util #1057

Closed geotekberlin closed 7 years ago

geotekberlin commented 7 years ago

When clicking on any configuration in the deployment window I get the following error:

Fatal error: Cannot use ipl\Html\Util as Util because the name is already in use in /usr/share/icingaweb2/modules/director/library/Director/StartupLogRenderer.php on line 7

This means I am now unable to use the roll back feature.

Everything else seems to work in director. The only strange thing this is that System/About still shows Director V.1.3.1 while I assume it should show V.1.3.2.

Please advise

Thomas-Gelf commented 7 years ago

@geotekberlin: I'm sorry for this, but this sounds like a bug in your PHP version. Did not find a specific one matching your exact version, but here you can find two similar ones:

The problem is that StartupLogRenderer requires an Util class from a completely different directory - but there is also a class called Util (in a completely different namespace) sitting in the same directory as StartupLogRenderer. Somehow PHP (or it's opcache) seems to get confused about this in specific 5.5.x versions - I've heard about this before.

As you're using OpenSuse 42.3 - aren't there also PHP 5.6 or 7.x packages available?

Regards, Thomas

mkuerschner commented 7 years ago

Hello, have the error message as above, when I try to deploy a new configuration.

My installation, CentOS 7 with PHP 5.4.16, icingaweb2 2.4.1, director 1.3.1 (git updated for a minutes), icinga2 2.7.0.

Would by nice for a tip. Could not deploy new configuration.

Regards Michael


List of installed php packages: php-xml-5.4.16-42.el7.x86_64 php-ZendFramework-Db-Adapter-Pdo-1.12.20-1.el7.noarch php-Icinga-2.4.1-1.el7.centos.noarch php-pear-1.9.4-21.el7.noarch icingaweb2-vendor-lessphp-0.4.0-1.el7.centos.noarch php-gd-5.4.16-42.el7.x86_64 php-process-5.4.16-42.el7.x86_64 php-ZendFramework-1.12.20-1.el7.noarch php-ZendFramework-Db-Adapter-Pdo-Mysql-1.12.20-1.el7.noarch php-intl-5.4.16-42.el7.x86_64 php-pgsql-5.4.16-42.el7.x86_64 php-mysql-5.4.16-42.el7.x86_64 php-pecl-imagick-3.1.0-0.6.RC2.el7.x86_64 php-ldap-5.4.16-42.el7.x86_64 php-cli-5.4.16-42.el7.x86_64 php-5.4.16-42.el7.x86_64 php-bcmath-5.4.16-42.el7.x86_64 php-pear-Net-Curl-1.2.5-10.el7.noarch php-common-5.4.16-42.el7.x86_64 php-pdo-5.4.16-42.el7.x86_64 php-ZendFramework-Db-Adapter-Pdo-Pgsql-1.12.20-1.el7.noarch

Thomas-Gelf commented 7 years ago

@mkuerschner: that's VERY strange. I'm successfully running the current master (any many former current masters) of the Director since a long time on RHEL 7 (with the same PHP version I guess) in multiple customer environments, some of them being pretty large. Any chance I could somehow remotely connect to one of your systems to debug this issue?

mkuerschner commented 7 years ago

@Thomas-Gelf: Which kind of access? ssh or web?

Prefer to discuss via direct mail communication: michael.kuerschner@googlemail.com.

mkuerschner commented 7 years ago

Found this change in library/Director/StartupLogRenderer.php file:

https://github.com/Icinga/icingaweb2-module-director/commit/31d65fadc22fc0b0a3bbb430b731b276a8b0fdc3#diff-e481bb36af601b1be0ac725257c2b8c7

The crazy thing: yesterday after the upgrade of icinga2, icingaweb2 no problem with deployment.

Thomas-Gelf commented 7 years ago

@geotekberlin: did some tests with @mkuerschner, strange thing. Installing/enabling opcache (a good thing anyways) seems to solve the issue for him, at least at first sight we had that impression. Could you please install php5-opcache on your system, restart Apache and let me know whether this changed anything?

mkuerschner commented 7 years ago

@Thomas-Gelf: Thanks for your help.

Thomas-Gelf commented 7 years ago

I hate it doing so, but I'll push a workaround for this to avoid facing such issues with buggy PHP versions

geotekberlin commented 7 years ago

Thomas, enabling php5-opcache does ideed solve the issue for me. Thanks for the tip!

This makes me wonder, however: I stayed with php5 with intent assuming that Director would be more stable than with php7. Would you recommend to switch to php7 on an Icinga2/Director production system with regard to stability?

Thomas-Gelf commented 7 years ago

@geotekberlin: I would with no doubt strongly recommend PHP 7. Also, opcache should always be enabled. We are developing there, we are tuning the Code for PHP 7 and all our unit tests are also running on 7.x since quite some time. Still, we continue to support and test on PHP 5.x. Icinga Web 2 runs on 5.3, Director 1.4 will raise the entry barrier to 5.4, and we will probably require 5.6 with an upcoming web module for IcingaDB, our IDO successor (not yet available). So, we are slowly trying to push people towards newer versions. 5.6 is no longer in active support, but will still get security fixes 'til January 2019 - so we'll continue to support it.

Tontonitch commented 7 years ago

Hello Thomas, As you certainly know, for users running director on RHEL7, the PHP version is still 5.4 (RedHat custom version including security fixes).

[root@monitorsrv1 hosts]# php -v
PHP 5.4.16 (cli) (built: Aug  5 2016 07:50:38)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[root@monitorsrv1 hosts]#

New PHP versions are available through the RHSCL repo, but forces us to go to a specific support policy (shorter support) for the PHP product.

So, with the future module for IcingaDB, we will need to migrate to PHP >= 5.6 from RHSCL.

Thomas-Gelf commented 7 years ago

@Tontonitch: yes, I know. It's always hard to find a compromise here. Director v1.4.0 requiring 5.4 is kind of a wakeup call, we want to test how people react when we are going to raise our requirements ;-) Don't worry about RHEL, our plans are as follows:

Cheers, Thomas

Tontonitch commented 7 years ago

@Thomas-Gelf Thanks for the details, we can prepare ourself for the coming release of Director/IcingaDB