500 Error with Physical Interface List on 6.3.0
ichilton opened this issue · comments
ISSUE TYPE
Bug Report
OS
Ubuntu focal
VERSION
define( 'APPLICATION_VERSION', '6.3.0' );
define( 'APPLICATION_VERDATE', '2022110200' );
ENVIRONMENT
$ php -v
PHP 8.0.14 (cli) (built: Dec 20 2021 21:22:57) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.14, Copyright (c) Zend Technologies
with Zend OPcache v8.0.14, Copyright (c), by Zend Technologies
$ dpkg -l | grep php
ii libapache2-mod-php8.0 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)
ii php-common 2:91+ubuntu20.04.1+deb.sury.org+1 all Common files for PHP packages
ii php-composer-ca-bundle 1.2.6-1 all utility library to find a path to the system CA bundle
ii php-composer-semver 1.5.1-1 all utilities, version constraint parsing and validation
ii php-composer-spdx-licenses 1.5.3-1 all SPDX licenses list and validation library
ii php-composer-xdebug-handler 1.4.0-1 all Restarts a process without Xdebug
ii php-json-schema 5.2.9-1 all implementation of JSON schema
ii php-psr-container 1.0.0-2 all Common Container Interface (PHP FIG PSR-11)
ii php-psr-log 1.1.2-1 all common interface for logging libraries
ii php-symfony-console 4.3.8+dfsg-1ubuntu1 all run tasks from the command line
ii php-symfony-filesystem 4.3.8+dfsg-1ubuntu1 all basic filesystem utilities
ii php-symfony-finder 4.3.8+dfsg-1ubuntu1 all find files and directories
ii php-symfony-process 4.3.8+dfsg-1ubuntu1 all execute commands in sub-processes
ii php-symfony-service-contracts 1.1.8-1 all Generic abstractions related to writing services
ii php8.0 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 all server-side, HTML-embedded scripting language (metapackage)
ii php8.0-bcmath 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 Bcmath module for PHP
ii php8.0-cgi 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (CGI binary)
ii php8.0-cli 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 command-line interpreter for the PHP scripting language
ii php8.0-common 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 documentation, examples and common module for PHP
ii php8.0-curl 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 CURL module for PHP
ii php8.0-ds 1.4.0-1+ubuntu20.04.1+deb.sury.org+1 amd64 PHP extension providing efficient data structures for PHP 7
ii php8.0-fpm 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php8.0-gd 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 GD module for PHP
ii php8.0-igbinary 3.2.6+2.0.8-2+ubuntu20.04.1+deb.sury.org+3 amd64 igbinary PHP serializer
ii php8.0-intl 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 Internationalisation module for PHP
ii php8.0-mbstring 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 MBSTRING module for PHP
ii php8.0-memcache 8.0+4.0.5.2+3.0.9~20170802.e702b5f9+-3+ubuntu20.04.1+deb.sury.org+3 amd64 memcache extension module for PHP
ii php8.0-memcached 3.1.5+2.2.0-10+ubuntu20.04.1+deb.sury.org+3 amd64 memcached extension module for PHP, uses libmemcached
ii php8.0-msgpack 2.2.0~rc1+2.1.2+0.5.7-2+ubuntu20.04.1+deb.sury.org+3 amd64 PHP extension for interfacing with MessagePack
ii php8.0-mysql 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 MySQL module for PHP
ii php8.0-opcache 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 Zend OpCache module for PHP
ii php8.0-readline 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 readline module for PHP
ii php8.0-rrd 2.0.3+1.1.3-2+ubuntu20.04.1+deb.sury.org+3 amd64 PHP bindings to rrd tool system
ii php8.0-snmp 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 SNMP module for PHP
ii php8.0-xml 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 DOM, SimpleXML, XML, and XSL module for PHP
ii php8.0-yaml 2.2.2+2.1.0+2.0.4+1.3.2-1+ubuntu20.04.1+deb.sury.org+3 amd64 YAML-1.1 parser and emitter for PHP
ii php8.0-zip 8.0.14-1+ubuntu20.04.1+deb.sury.org+1 amd64 Zip module for PHP
SUMMARY
After upgrading to 6.3.0, we see the following error when going to:
https://portal.ourdomain.net/interfaces/physical/list
The page gets partially rendered and fails with a 500 error:
[Server Error :: Missing required parameter for [Route: customer@overview] [URI: customer/overview/{cust}/{tab?}] [Missing parameter: cust].](https://portal.lonap.net/interfaces/physical/%3C!DOCTYPE%20html%3E%3Chtml%20lang=)
Thanks,
Ian
Hey @ichilton -
It looks like you have an interface without a customer? I.e. the bug may be more the data than the code. Not sure how you could find this situation via the UI tbh - maybe manual database editing?
Try running the following SQL:
SELECT
pi.id AS piid,
vi.id AS viid,
c.id AS cid
FROM
physicalinterface AS pi
LEFT JOIN virtualinterface AS vi ON vi.id = pi.virtualinterfaceid
LEFT JOIN cust AS c ON c.id = vi.custid
WHERE
c.id IS NULL
If you get results, that's the issue. If you don't pare it back to:
SELECT
pi.id AS piid
FROM
physicalinterface AS pi
WHERE
pi.virtualinterfaceid IS NULL
and any results there will be the problem (physical interface without a virtualinterface).
If this doesn't solve it, can you post the storage/logs/laravel.log snippet that will be generated which you trigger this?
If it does solve it, we'll look about implementing FKs on these fields in the DB. There should be there really and would be if we were starting fresh rather than working on the core of a schema that is now about 20 years old (but proven and robust like its creator, @nickhilliard).
Hi,
Thanks for that - There was one match:
+------+------+------+
| piid | viid | cid |
+------+------+------+
| 1032 | NULL | NULL |
+------+------+------+
mysql> select * from physicalinterface where id = 1032;
+------+--------------+--------------------+--------+-------+--------+------------+-------+------------------------------+---------+---------------------+---------------------+
| id | switchportid | virtualinterfaceid | status | speed | duplex | rate_limit | notes | fanout_physical_interface_id | autoneg | created_at | updated_at |
+------+--------------+--------------------+--------+-------+--------+------------+-------+------------------------------+---------+---------------------+---------------------+
| 1032 | NULL | NULL | 1 | 10000 | full | NULL | NULL | NULL | 1 | 2022-04-19 12:56:10 | 2022-04-19 12:56:10 |
+------+--------------+--------------------+--------+-------+--------+------------+-------+------------------------------+---------+---------------------+---------------------+
1 row in set (0.00 sec)
Looking at historical data from the dev copy, and that date and time in our support tickets, it looks like this occurred when we deleted a resold customer.
I think the customer resold port was on virtual interface 633, with the switchportid of 2182.
The fanout port was on virtual interface 634, physical interface 1032 with the switchportid of 2186.
(From dev copy of database):
mysql> select * from physicalinterface where id = 1032;
+------+--------------+--------------------+--------+-------+--------+------------+-------+------------------------------+---------+------------+------------+
| id | switchportid | virtualinterfaceid | status | speed | duplex | rate_limit | notes | fanout_physical_interface_id | autoneg | created_at | updated_at |
+------+--------------+--------------------+--------+-------+--------+------------+-------+------------------------------+---------+------------+------------+
| 1032 | 2186 | 634 | 1 | 1000 | full | NULL | NULL | NULL | 1 | NULL | NULL |
+------+--------------+--------------------+--------+-------+--------+------------+-------+------------------------------+---------+------------+------------+
So I'm guessing that for some reason the associated fanout port wasn't cleaned up correctly when we deleted the resold customer port.