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

Bug: MongoDB error when attempting to use Tideways on fresh install #2697

Open
arose-wt opened this issue Jan 10, 2024 · 17 comments
Open

Bug: MongoDB error when attempting to use Tideways on fresh install #2697

arose-wt opened this issue Jan 10, 2024 · 17 comments
Labels

Comments

@arose-wt
Copy link

Are you using the latest stable or develop branch version of VVV?

Yes (develop)

Is it a new VVV, or an existing VVV that used to work?

New fresh install

Did you use a CustomFile?

No (default)

Whats the problem?

Setup details:

  • Windows 11 22H2
  • Fresh install (Both stable and develop)
  • Occurs on fresh install (only changes being uncommenting tideways and mongodb in config/config.yml) but tried destroying and re-upping as well

Changes in config/config.yml:

extensions:
  core: # The core VVV extensions
    - tls-ca # HTTPS SSL/TLS certificates
    - phpmyadmin # Web based database client
    #- memcached-admin # Object cache management
    #- opcache-status # opcache management
    #- webgrind # PHP Debugging
    - mongodb # needed for Tideways/XHGui
    - tideways # PHP profiling tool, also installs xhgui check https://varyingvagrantvagrants.org/docs/en-US/references/tideways-xhgui/
    #- nvm # Node Version Manager
    #- php56
    #- php70
    #- php71
    #- php72
    #- php73
    #- php74
    #- php80

What occurs:

The vagrant up --provision output gets riddled with the Unable to load dynamic library 'mongodb.so' warning shown below.

Trying to access tideways.vvv.test results in the slim application error shown below.

vagrant up --provision log:

...
==> default: Running provisioner: extension-core-mongodb (shell)...
    default: Running: C:/Users/Arianna/AppData/Local/Temp/vagrant-shell20240110-24492-2h92y3.sh
    default:  ▷ Running the 'extension-core-mongodb' provisioner...
    default: Warning: apt-key output should not be parsed (stdout is not a terminal)
    default: Warning: apt-key output should not be parsed (stdout is not a terminal)
    default: Created symlink /etc/systemd/system/multi-user.target.wants/mongod.service → /lib/systemd/system/mongod.service.
    default:  ✔ The 'extension-core-mongodb' provisioner completed in 54 seconds.
==> default: Running provisioner: extension-core-tideways (shell)...
    default: Running: C:/Users/Arianna/AppData/Local/Temp/vagrant-shell20240110-24492-xuewwu.sh
    default:  ▷ Running the 'extension-core-tideways' provisioner...
    default: PHP Warning:  PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /usr/lib/php/20220829/mongodb.so (/usr/lib/php/20220829/mongodb.so: cannot open shared object file: No such file or directory), /usr/lib/php/20220829/mongodb.so.so (/usr/lib/php/20220829/mongodb.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    default: PHP Warning:  PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /usr/lib/php/20220829/mongodb.so (/usr/lib/php/20220829/mongodb.so: cannot open shared object file: No such file or directory), /usr/lib/php/20220829/mongodb.so.so (/usr/lib/php/20220829/mongodb.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    default: HEAD is now at 5b8516b Merge pull request #468 from kornrunner/0.21.x
    default: PHP Warning:  PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /usr/lib/php/20220829/mongodb.so (/usr/lib/php/20220829/mongodb.so: cannot open shared object file: No such file or directory), /usr/lib/php/20220829/mongodb.so.so (/usr/lib/php/20220829/mongodb.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    default: Loading composer repositories with package information
    default: Updating dependencies
    default: Nothing to modify in lock file
    default: Installing dependencies from lock file (including require-dev)
    default: Nothing to install, update or remove
    default: Package perftools/xhgui-collector is abandoned, you should avoid using it. No replacement was suggested.
    default: Generating autoload files
    default: No security vulnerability advisories found.
    default: Cloning into '/var/local/tideways-php'...
    default: /var/local/tideways-php7.4/tracing.c: In function ‘tracing_callgraph_get_parent_child_name’:
    default: /var/local/tideways-php7.4/tracing.c:186:38: warning: zero-length gnu_printf format string [-Wformat-zero-length]
    default:   186 |         snprintf(symbol, symbol_len, "");
    default:       |                                      ^~
    default: /var/local/tideways-php8.2/tracing.c: In function ‘tracing_callgraph_get_parent_child_name’:
    default: /var/local/tideways-php8.2/tracing.c:186:38: warning: zero-length gnu_printf format string [-Wformat-zero-length]
    default:   186 |         snprintf(symbol, symbol_len, "");
    default:       |                                      ^~
    default: PHP Warning:  PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /usr/lib/php/20220829/mongodb.so (/usr/lib/php/20220829/mongodb.so: cannot open shared object file: No such file or directory), /usr/lib/php/20220829/mongodb.so.so (/usr/lib/php/20220829/mongodb.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    default:  ✔ The 'extension-core-tideways' provisioner completed in 129 seconds.
...

full output

Slim Application Error when attempting to access the url for tideways:

Notice: Undefined index: tableWatch in /srv/www/default/xhgui/src/ServiceProvider/PdoStorageProvider.php on line 55

full output

Additional info:

That tideways error also occurred when I had uncommented tideways in extensions/core but hadn't yet uncommented mongodb so, while it may well also be an issue, I am assuming it is unrelated to the mongodb.so issue.

How do we reproduce it?

  1. Run git clone -b stable https://github.com/Varying-Vagrant-Vagrants/VVV.git ~/vvv-local
  2. Run cd ~/vvv-local
  3. Run vagrant plugin install --local
  4. Uncomment - mongodb and - tideways (lines 87 and 88, respectively) in config/config.yml
  5. Run vagrant up --provision

(Terminal displays error)

  1. Open browser and go to one.wordpress.test?enable-tideways=1
  2. Open a new tab and go to tideways.vvv.test

(Tideways error appears)

What is the output of vagrant status

__ __ __ __
\ V\ V\ V / v3.13 Ruby:3.1.3, Path:"C:/Users/Arianna/repos/vvv-fresh"
 \_/\_/\_/  git::develop(4ba78d6a)

Platform: mingw32 windows  missingWinAdminPriv  vagrant-goodhosts monochrome-terminal shared_db_folder_disabled
Vagrant: v2.4.0, virtualbox: v7.0.12

Which Operating System are you using?

Microsoft Windows

Which provider are you using?

VirtualBox 7

Copy link

welcome bot commented Jan 10, 2024

Thanks for opening your first issue here! Be sure to follow the issue template and include your OS/Vagrant/VVV versions! Don't forget you can get support in the VVV slack at https://varyingvagrantvagrants.org/docs/en-US/slack/

VVV
Join the VVV Slack Workspace

@tomjn
Copy link
Member

tomjn commented Jan 10, 2024

That tideways error also occurred when I had uncommented tideways in extensions/core but hadn't yet uncommented mongodb so, while it may well also be an issue, I am assuming it is unrelated to the mongodb.so issue.

My understanding of the Tideways provisioner was that if MongoDB wasn't installed that it would run the MongoDB provisioner to ensure this.

@Mte90 do you have any thoughts? It's been a while since I used Tideways myself.

The other thing that could have impacted this is PHP versions

@tomjn
Copy link
Member

tomjn commented Jan 10, 2024

I've opened Varying-Vagrant-Vagrants/vvv-utilities#108 to handle Tideways in PHP v8.3, though the default PHP isn't 8.3 so it shouldn't impact this bug

@arose-wt
Copy link
Author

arose-wt commented Jan 11, 2024

Actually this seems to be a known issue with php 8.1 (and, presumably, 8.2 and 8.3):
https://bugs.launchpad.net/ubuntu/+source/php-mongodb/+bug/1992999

Short StackOverflow discussion on the matter:
https://askubuntu.com/questions/1434953/unable-to-load-dynamic-library-mongodb-so-tried-usr-lib-php-20210902-mongod

I'm going to test with 8.0 and 7.x versions and see where I get.

Launchpad
I installed a fresh image of 22.04.1 on a Hetzner cloud server apt update && apt upgrade -y and additional apt install php8.1-cli php8.1-mongodb then php-v PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /usr/lib/php/20210902/mongodb.so (/usr/lib/php/20210902/mongodb.so: undefined symbol: ns_parserr), /usr/lib/php/20210902/mongodb.so.so (/usr/lib/php/20210902/mongodb.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

like I ...

Ask Ubuntu
I installed a fresh image updated and upgraded apt nginx-common php8.1-cli php8.1-fpm php8.1-mongodb PHP -v PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /usr/lib/...

@tomjn
Copy link
Member

tomjn commented Jan 11, 2024

So we have mongodb because it's how perftools/xhgui-collector stores the data, but that package is deprecated and replaced by https://github.com/perftools/php-profiler which supports other mechanisms such as files etc. This might let us remove mongodb as a dependency.

In the past we've explored this only to find that MongoDB is necessary for certain xhgui features, as were certain versions of PHP

GitHub
A PHP profiling library based on XHGUI Data Collector - GitHub - perftools/php-profiler: A PHP profiling library based on XHGUI Data Collector

@tomjn
Copy link
Member

tomjn commented Jan 11, 2024

it looks like this is the preferred storage mechanism now https://github.com/perftools/php-profiler?tab=readme-ov-file#upload-saver

I also forgot that we'd already made the switch over and use PDO, so maybe mongodb isn't needed afterall? @Mte90 is removing mongodb feasible?

GitHub
A PHP profiling library based on XHGUI Data Collector - GitHub - perftools/php-profiler: A PHP profiling library based on XHGUI Data Collector

@tomjn
Copy link
Member

tomjn commented Jan 11, 2024

nevermind I realise now it's XHGUI that's the problem, not the collector, it supports MongoDB or PDO but using PDO removes features from the GUI, and composer expects the mongo PHP extension.

On the plus side they explicitly support 8.0/8.1 now

@arose-wt
Copy link
Author

arose-wt commented Jan 11, 2024

I'm seeing now that PDO is set as the default db option for tideways in VVV's xhgui config.

www\default\xhgui\config\config.php:

$defaults = array(
    'debug' => false,
    'save.handler' => 'pdo',
...

Meaning that what I have seen are separate errors.

MongoDB warning

  1. MongoDB has a warning where it is looking for its .so file but it does not exist (I haven't been able to find the file anywhere under /etc/php/ nor /usr/lib/php). Provisioning a machine with the mongodb extension (as set by config.yml) will trigger this warning, as will running mongo --version on the machine after it finishes provisioning. I am unsure what the consequences of this warning are. This issue occurs even when I explicitly set my site to use php7.0.
  2. Following the previous numbered point, if I set the save.handler in xhgui's config to be mongo.db, I get a 500 internal server error, with no additional user-side information, as soon as I try to access tideways.vvv.test while my site is up.

XHGUI/Tideways error/misbehaviour

  1. If I leave save.handler as pdo (its default), accessing tideways.vvv.test gives me the error I listed here.
  2. Following the previous numbered point, if I modify xhgui's pdo config (adding the tableWatch parameter to make the custom config closer to the default config in www\default\xhgui\config\config.default.php), that removes the 500 error but tideways.vvv.test will instead say Looks like you haven't done any profiling when I refresh--even after I visit one.wordpress.test?enable-tideways=1.

www\default\xhgui\config\config.php modification:

    'pdo' => array(
        'dsn' => 'sqlite:/tmp/xhgui.sqlite3',
        'user' => null,
        'pass' => null,
        'table' => 'results',
        'tableWatch' => 'watches'
    ),

@tomjn
Copy link
Member

tomjn commented Jan 11, 2024

If I leave save.handler as pdo (its default), accessing tideways.vvv.test gives me the error I listed here.

My editors really struggle with that file but it's missing the error message and only contains the stack trace

MongoDB warning

This implies MongoDB can be jettisoned

@arose-wt
Copy link
Author

arose-wt commented Jan 11, 2024

My editors really struggle with that file but it's missing the error message and only contains the stack trace

Ah! My bad.

Here's the error belonging to that stack trace:
Notice: Undefined index: tableWatch in /srv/www/default/xhgui/src/ServiceProvider/PdoStorageProvider.php on line 55

@tomjn
Copy link
Member

tomjn commented Jan 11, 2024

0.21.3 is the latest version but our provisioner is pinned with:

noroot git checkout "0.20.4"

does checkout out the 0.21.3 tag help with this?

@tomjn
Copy link
Member

tomjn commented Jan 11, 2024

Varying-Vagrant-Vagrants/vvv-utilities#108 updates the PHP version used to install xhgui and the version it installs

@arose-wt
Copy link
Author

arose-wt commented Jan 11, 2024

Unfortunately the above error occurs even after changing the provisioner script to pull xhgui 0.21.3 and when including the changes from Varying-Vagrant-Vagrants/vvv-utilities#108. Similarly, manually including the tableWatch parameter also still results in the same message ("Looks like you haven't done any profiling").

@tomjn
Copy link
Member

tomjn commented Jan 12, 2024

@arose-wt that's a shame, would you consider those changes an improvement though? Or did they introduce new issues? I'd like to see if they can be merged so we can continue debugging from a better place, and it sounds like we need to adjust the docs to remove the mongodb mention

@tomjn
Copy link
Member

tomjn commented Jan 12, 2024

Similarly, manually including the tableWatch parameter also still results in the same message ("Looks like you haven't done any profiling").

If you can do a quick PR upstream for that, I think the message about not getting any profiling is probably a separate issue related to our collector

@tomjn
Copy link
Member

tomjn commented Jan 12, 2024

I've merged both PRs, does all work as expected for you?

@arose-wt
Copy link
Author

| I've merged both PRs, does all work as expected for you?

I'm having unrelated system issues with my system's ssh/ssh-agent at the moment.
But when I was testing yesterday I had already made the changes, that were included in both PRs, locally, and still had the same outcomes occur. (See my previous comment here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants