Upgrading from 9 to 9.1 using occ command gives exception error

I'm upgrading to owncloud 9.1 from 9 and to complete the upgrade i used the following command line:

Steps to reproduce
sudo /usr/bin/php /var/www/html/owncloud/occ upgrade -v

Expected behaviour
Upgrade is not completing successfully - i suppose it should.

Actual behaviour
Unfortunately there is an error and upgrade halts. The error message is:

Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'INSERT INTO oc_preferences (userid, appid, configkey, configvalue) VALUES(?, ?, ?, ?)' with params ["KOTiS", "user_ldap", "displayName", "KOTiS"]:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
2016-09-07T12:32:04+00:00 Update failed
2016-09-07T12:32:04+00:00 Maintenance mode is kept active
2016-09-07T12:32:04+00:00 Reset log level

I tried to check and repair all mysql tables but it didn't helped. It seems to halt during the upgrade of a single ad (active directory) user - can i remove that user (from mysql)?

Can someone assist me?

Server configuration
Operating system: Linux centos 2.6.32-642.1.1.el6.x86_64 #1 SMP Tue May 31 21:57:07 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Web server: Apache version 2.2.15
Database: MySQL version 5.5.37
PHP version: PHP 5.4.27
ownCloud version (see ownCloud admin page): 9.1
Updated from an older ownCloud or fresh install: Updated from 8.x
ownCloud log (data/owncloud.log) : https://drive.google.com/file/d/0B_IcrOxs6ovQaWVrR0Z6RUxUcms/view?usp=sharing

Special configuration (external storage, external authentication, reverse proxy, server-side-encryption): external storage, active directory authentication

Integrity status for oC9+
Unable to login as admin user, owncloud is not running

The update can't be finished when the database-server goes away. Find out why your mysql server closed the connection and modify the timeouts.

9.1.0 is out for a while now with a number of bugs that will be fixed in OC 9.1.1 which is expected in 1-2 weeks (also prevents db-timeouts on filescans, not sure about updates):

If possible I would wait for the 9.1.1 release. If you have the possibility to test the release candidate, this would be awesome, if your error still happens on 9.1.1, you should report a bug report.

@tflidd i appreciate your answer here. You were totally right... i made the following change on mysql config

set-variable = max_allowed_packet=16M

upgrade completed successfully

2016-09-08T10:09:57+00:00 Repair step: Remove shares of a users root folder
2016-09-08T10:09:57+00:00 Starting code integrity check...
2016-09-08T10:10:26+00:00 Finished code integrity check
2016-09-08T10:10:26+00:00 Update successful
2016-09-08T10:10:26+00:00 Maintenance mode is kept active
2016-09-08T10:10:26+00:00 Reset log level

I turned off maintenance mode....

sudo /usr/bin/php /var/www/html/owncloud/occ maintenance:mode --off

but now i have http error 500 and owncloud is not working. Any more ideas?

Please create a new thread for this new issue (make sure you're filling out the issue template shown!!!!) for the reasons explained here: