server.sh throws exception: "Call to a member function queryOneRecord() on null" [SOLVED]

Discussion in 'Installation/Configuration' started by Gwyneth Llewelyn, Jul 12, 2023.

  1. Hi there,

    I'm aware that I do not run a 'pristine' ISPConfig3 installation, so it's possible that this error comes from one of my many tweaks, done over the years.

    Here is what happens with the latest ISPConfig3 version (3.2.10p1) under Ubuntu 22.04.2 LTS, nginx 1.23.1, and the default PHP version set at 7.4.33 on the CLI (for the hosting itself, I use almost exclusively versions 8.X). When server.sh is due to run, or 'forced' to run, it throws the following error:

    Code:
    PHP Warning:  Undefined property masterdb of class app in /usr/local/ispconfig/server/lib/app.inc.php on line 109
    PHP Warning:  Undefined property masterdb of class app in /usr/local/ispconfig/server/lib/app.inc.php on line 118
    PHP Fatal error:  Uncaught Error: Call to a member function queryOneRecord() on null in /usr/local/ispconfig/server/plugins-available/nginx_reverseproxy_plugin.inc.php:248
    Stack trace:
    #0 /usr/local/ispconfig/server/lib/classes/plugins.inc.php(120): nginx_reverseproxy_plugin->ssl()
    #1 /usr/local/ispconfig/server/mods-available/web_module.inc.php(141): plugins->raiseEvent()
    #2 /usr/local/ispconfig/server/lib/classes/modules.inc.php(302): web_module->process()
    #3 /usr/local/ispconfig/server/lib/classes/modules.inc.php(235): modules->raiseTableHook()
    #4 /usr/local/ispconfig/server/server.php(180): modules->processDatalog()
    #5 {main}
      thrown in /usr/local/ispconfig/server/plugins-available/nginx_reverseproxy_plugin.inc.php on line 248
    Clearly, the error is connected to the warnings. Class app does not seem to have the masterdb property set (which is weird, I guess), so, when the nginx reverse proxy plugin PHP thing is called, it naturally fails to do a $app->masterdb->queryOneRecord() on line 248. A quick & dirty fix to get rid of the error, of course, is just to check if !empty($app->masterdb) and skip this step; but this is just masking the problem, not fixing it.

    I've so far figured out that this is connected to getting an SSL certificate, probably from Let's Encrypt, and somehow failing to write the certificate (because, for some reason, $app does not contain all fields). I'm using acme.sh to deal with all (re-)issuing requests. Aye, I have a love/hate relationship with acme.sh — it beats certbot on all points, though — which is related to some hiccups when I create a domain on the backoffice that hasn't been registered yet. This is something I do quite often when working on projects for future customers. I believe that there might be more edge cases where errors occur mostly due to the non-standard way I do some things.

    Because I cannot simply pull down every running service and start everything from scratch, I cannot start from a blank slate, and reconfigure ISPConfig3 from the very beginning, just in order to check that the base functionality works flawlessly. I have to debug and then fix a running installation, working with what I have. Sadly, the logs just show what I've posted above.

    Right now, the least I hoped to find on the logs would be the site domain that is throwing the error. How can I find that? I do have my suspicions about which domain(s) might be the culprit(s), but it would be nicer to have some place to be sure about which one is misbehaving.
     
  2. Update: I forgot to RTFM on the debug settings: https://www.faqforge.com/linux/debugging-ispconfig-3-server-actions-in-case-of-a-failure/

    I know it's stupid, but after all these years, I never even knew there was a "FAQforge"!

    Debug mode is really very useful, much more than I thought. Oh sure, things will take longer to process, but at least I can follow what server.sh is actually doing, instead of staring at a blank screen for a few seconds and then wondering if something is happening at all.

    I'm now happily seeing my gazillions of logs and see if I can catch the culprit; stay tuned...
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    I guess your problem is that you enabled a broken server side plugin. Likely, you do not want to use this plugin
    /usr/local/ispconfig/server/plugins-available/nginx_reverseproxy_plugin.inc.php as it is not used on any typical ISPConfig installation, and its quite likely that this third-party code does not fully work. Disable it with:

    rm -f /usr/local/ispconfig/server/plugins-enabled/nginx_reverseproxy_plugin.inc.php
     
  4. OMG. @till you're totally right! Deleting it immediately fixed this issue and many others I was having!

    /me *slaps her forehead*

    Thanks, this thread can be marked as [SOLVED]. Or rather as [STUPID USER].

    The irony was that this plugin was additionally breaking things on two places, and I was actually writing a new thread to deal with those issues separately, while eagerly going through the plugin's code and fixing minor things and putting more debugging messages, to see if I could figure out where it broke.

    Specifically, this plugin was:
    1. Truncating vhost files to zero bytes (nginx wouldn't complain, of course, since an empty file is a 100% valid configuration file);
    2. Creating bad symlinks on /etc/nginx/sites-enabled, namely, missing the 100- prefix.
    I have absolutely no idea where this plugin comes from or why it was active on my system. The only thing that I was wondering about is why it's called nginx_reverseproxy_plugin, because I run nginx as the main webserver, not 'merely' as a reverse proxy. And it was also clear that whoever wrote this plugin, even though they kept to the same style, has far less comments than the rest of the ISPConfig3 code.

    So, I was actually going to ask here: what is this nginx_reverseproxy_plugin and what exactly does it do? :)

    And after getting an answer, then I would post some of my research on its code :)

    Fortunately, I saw the notification for your reply here, which saved me a ton of time! I cannot fully express my deepest thanks. I'm currently in the middle of a website change for an old non-profit which are my friends, and this was preventing me to complete the move... so, once again, you saved my life! :)
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    That's a plugin that was developed by an external contributor to run Nginx as a proxy in front of Apache. But he abandoned his code long ago, so it's likely not working (anymore), and therefore it was labeled as not to get automatically enabled by the installer and will get removed in future, especially as there is a newly contributed plugin for this purpose which is scheduled to be included in 3.2.11.
     
    ahrasis likes this.

Share This Page