Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP ini parser doesn't strip trailing whitespace #3733

Closed
MichaelLorenzen opened this issue Apr 1, 2019 · 4 comments

Comments

@MichaelLorenzen
Copy link

commented Apr 1, 2019

I upgraded my debian installation with the following versions:

icinga2: 2.10.2-1.jessie to 2.10.4-jessie
icingaweb2: 2.6.1-1jessie to 2.6.2-jessie
php 5.6.40+dfsg-0deb8u1 to 5.6.40+dfsg-0deb8u2

Expected Behavior

The upgrade should worked flawlessly.

Current Behavior

An all pages with icinga data icingaweb shows the following error:

Cannot load resource config ""icinga_ido" ". Resource does not exist

icingacli shows an matching error message:

Icinga\Exception\ConfigurationError in /usr/share/php/Icinga/Data/ResourceFactory.php:49 with message: Cannot load resource config ""icinga_ido" ". Resource does not exist

Possible Solution

I did not find any, but downgrading only the icingaweb2 packages resolves the problem

Steps to Reproduce (for bugs)

  1. Upgrade as described above

Your Environment

  • Operating System and version: Debian Jessie 8.11 with 3.16.0-8-amd64 kernel
  • Enabled features (icinga2 feature list):
  • icinga_ido is present in resources.ini:
[icinga_ido]
dbname = "icinga"
password = "xxxx"
port = "3306"
host = "localhost"
db = "mysql"
username = "icinga"
type = "db"

I can validate the connection from the configuration pages in icingaweb2:
grafik

Error message screenshot:
grafik

@nilmerg

This comment has been minimized.

Copy link
Member

commented Apr 1, 2019

Please take a look into the monitoring module's configuration. (Configuration -> Modules -> monitoring -> Backends (Tab, on the right))

The resource configured there is probably corrupted somehow. By choosing the correct one it should work. (If you're provisioning this by e.g. puppet you need to fix it there as well.)

If it doesn't help please share your /etc/icingaweb2/modules/monitoring/backends.ini with us.

@MichaelLorenzen

This comment has been minimized.

Copy link
Author

commented Apr 4, 2019

If I open the Transport Tab I see two Backends: Monitoring and Transport, both named icinga2.

This is the configuration before the update (2.6.1-1jessie)
grafik

This is the configuration after the update (2.6.2-1jessie)
grafik

If I try to show the resource configuration for icingaweb_db, I get the error "Ressource not found" with this trace:

#0 /usr/share/php/Icinga/Web/Form.php(1187): Icinga\Forms\Config\ResourceConfigForm->onRequest()
#1 /usr/share/icingaweb2/application/controllers/ConfigController.php(377): Icinga\Web\Form->handleRequest()
#2 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Controllers\ConfigController->editresourceAction()
#3 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#4 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#5 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#6 /usr/share/php/Icinga/Application/webrouter.php(104): Icinga\Application\Web->dispatch()
#7 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#8 {main}

After setting Resource back to icinga_ido, everything works again.

So finally this seems to be a quirk in the update process, not a real bug.

@nilmerg

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

Neither a quirk nor a bug in Icinga Web 2. Though, a bug in PHP. It's fixed in v7.1.22.

Usually not a problem because Web 2 itself doesn't write configuration that will cause this bug. I guess you've defined your configuration somehow else. (Either by hand or with some other tool)
You should check your entire configuration so that not a single value's line ends with white space. (grep -r "\s$" /etc/icingaweb2/)

Future versions of Icinga Web 2 may include a work-around if the fix will not be backported.

@nilmerg

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

Affected versions: 5.3.0 - 5.3.14, 5.3.20 - 5.4.4, 5.4.10 - 5.6.40, 7.0.0 - 7.1.23, 7.2.0 - 7.2.11
Tested with: https://3v4l.org/
Verification: php/php-src@f42d7bd
Fixed versions: 7.1.24, 7.2.12, 7.3.0
Minimum relevant affected version: 5.6

Seems we need said work-around...

@lippserd lippserd added this to the 2.6.3 milestone Apr 8, 2019

@nilmerg nilmerg self-assigned this Apr 17, 2019

nilmerg added a commit that referenced this issue Apr 17, 2019

nilmerg added a commit that referenced this issue Apr 17, 2019

@nilmerg nilmerg changed the title Error message "cannot load resource" after update to 2.6.2 in icingaweb2 PHP ini parser doesn't strip trailing whitespace Apr 17, 2019

@nilmerg nilmerg removed the low priority label Apr 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.