meeting-room-booking-system / mrbs-code

MRBS application code
Other
124 stars 61 forks source link

MRBS Stopped Working #2955

Open jberanek opened 3 years ago

jberanek commented 3 years ago

Hi all,

MRBS suddenly stopped working this morning. Yesterday, I created a new area and added several rooms to it. It seemed to work fine. Today, I am not able to access the site. Below is the error log:

[Thu Dec 17 11:38:32.081213 2020] [:error] [pid 23028] [client 172.16.68.50:51142] \nE_WARNING in /var/www/mrbs/html/edit_room_handler.php at line 110\narray_intersect(): Argument #2 is not an array\nMRBS GET: Array\n(\n)\nMRBS POST: Array\n(\n [csrf_token] => 2b08ac8629ef3fed1c6fc1cf237af328781866b50e3faf1e0d314b12e27567b5\n [room] => 9\n [old_area] => 3\n [old_room_name] => Implant motors\n [new_area] => 3\n [room_name] => Implant motors\n [sort_key] => Implant motors\n [room_disabled] => 0\n [description] => \n [capacity] => 0\n [room_admin_email] => stevek@test.com\n)\nMRBS SESSION: Array\n(\n [csrf_token] => 2b08ac8629ef3fed1c6fc1cf237af328781866b50e3faf1e0d314b12e27567b5\n [user] => MRBS\User Object\n (\n [username] => stevek\n [display_name] => Steve Kiss\n [email] => stevek@test.com\n [level] => 2\n )\n\n)\n\n, referer: http://mrbs.test.com/edit_room.php?room=9 [Thu Dec 17 11:39:06.182532 2020] [:error] [pid 22464] [client 172.16.68.50:51163] \nE_WARNING in /var/www/mrbs/html/edit_room_handler.php at line 110\narray_intersect(): Argument #2 is not an array\nMRBS GET: Array\n(\n)\nMRBS POST: Array\n(\n [csrf_token] => 2b08ac8629ef3fed1c6fc1cf237af328781866b50e3faf1e0d314b12e27567b5\n [room] => 10\n [old_area] => 3\n [old_room_name] => Piezo machine\n [new_area] => 3\n [room_name] => Piezo machine\n [sort_key] => Piezo machine\n [room_disabled] => 0\n [description] => \n [capacity] => 0\n [room_admin_email] => stevek@test.com\n)\nMRBS SESSION: Array\n(\n [csrf_token] => 2b08ac8629ef3fed1c6fc1cf237af328781866b50e3faf1e0d314b12e27567b5\n [user] => MRBS\User Object\n (\n [username] => stevek\n [display_name] => Steve Kiss\n [email] => stevek@test.com\n [level] => 2\n )\n\n)\n\n, referer: http://mrbs.test.com/edit_room.php?room=10

Can anyone advise please?

Thank you.

Reported by: stevekiss

Original Ticket: mrbs/support-requests/2264

jberanek commented 3 years ago

It seems there may be a possible bug in MBRS. If I look in the DB table mrbs_room for the rooms that created the error, the column invalid_types contains the word 'null' instead of the null value. I changed the value of the field to the null value with the commands below and suddenly it works again.

UPDATE `mrbs`.`mrbs_room` SET `invalid_types` = NULL WHERE (`id` = '9');
UPDATE `mrbs`.`mrbs_room` SET `invalid_types` = NULL WHERE (`id` = '10');

I am able to reproduce this behavior. When you create a room, the null value is inserted in the column. If later you update the room, the word null is entered instead of the null value.

In my configuration, I have the following settings related to this field:

unset($booking_types);
$prevent_invalid_types = true;

Original comment by: stevekiss

jberanek commented 3 years ago

Original comment by: stevekiss

jberanek commented 3 years ago

Can you confirm which release of MRBS you are running and which database system (MySQL or PostgreSQL) you are running?

Original comment by: campbell-m

jberanek commented 3 years ago

MRBS v1.9.2 with MySQL database.

Original comment by: stevekiss

jberanek commented 3 years ago

It looks like you must have

unset($booking_types);

in your config file. Is that correct? I can see that that would produce the error message above and I am working on a fix.

However I can't reproduce the problem that puts "NULL" in the database.

Original comment by: campbell-m

jberanek commented 3 years ago

I've now fixed the bug to do with $booking_types in a97b05.

Original comment by: campbell-m

jberanek commented 3 years ago

Apologies! I've just noticed that you've already said you have unset($booking_types);.

Original comment by: campbell-m

jberanek commented 3 years ago

Thank you for the fix!

Also, sorry for the confusion. This case was a combination of 2 issues only one of which is with MRBS. The inability to access the site seems to be related to network issues. Having the column contain the text 'null' or a NULL value does not cause MRBS to crash. That being said, I am able to reproduce this consistently in my environment. I've attached 2 screenshots from MySQL Workbench.

Original comment by: stevekiss

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/e5c40052b1/822c/attachment/MRBSAfterUpdate.png https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/e5c40052b1/822c/attachment/MRBSBeforeUpdate.png

jberanek commented 3 years ago

Thanks. I'm not quite sure what you mean by before and after update. Update of what?

Original comment by: campbell-m

jberanek commented 3 years ago

Editing a room. On the admin.php page I click on the room name, on the edit_room.php page I click Change.

Original comment by: stevekiss

jberanek commented 3 years ago

OK, and that still happens with the fix in?

Could you post a screenshot of the structure of your room table please?

Also, what version of MySQL are you running?

Original comment by: campbell-m

jberanek commented 3 years ago

After the fix, once I update a room the invalid_types column contains a pair of square brackets. When the room is created it contains the NULL value. I am not sure if this is by design or not, but no error gets thrown.

I am using the following MySQL version: mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1

Attached are before and after screenshots as well as my room table structure.

Original comment by: stevekiss

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/e5c40052b1/892d/attachment/MRBSAfterUpdateRoom.png https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/e5c40052b1/892d/attachment/MRBSBeforeUpdateRoom.png https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/e5c40052b1/892d/attachment/MRBSRoomTableStructure.png

jberanek commented 3 years ago

Thanks. Good, that's the way it's supposed to work. (The column contains a JSON encoded array of invalid types, so '[]' represents an empty array).

Original comment by: campbell-m