View Issue Details

IDProjectCategoryView StatusLast Update
0006318mantisbtsqlpublic2012-08-17 14:11
Reporterpchaintreuil Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
OSGentoo Linux 
Product Version1.0.0rc1 
Summary0006318: APPLICATION ERROR 0000401 when uploading a file.
Description

I get the following:

Database query failed. Error received from database was 0001153: Got a packet bigger than 'max_allowed_packet' for the query:
INSERT INTO mantis_bug_file_table
(bug_id, title, description, diskfile,
filename, folder, filesize, file_type,
date_added, content) VALUES

(28, '', '', 
 '/var/www/localhost/htdocs/mantisbt/uploads/gbitviewer/e04fa7b2cbb49068240bd7bfa4436569',
 'dmd20_0001.ss',
 '/var/www/localhost/htdocs/mantisbt/uploads/gbitviewer/',
 1048576, 'application/octet-stream',
 '2005-10-05 15:28:45', '*snip*');

(where the '*snip' "binary" data.) when trying to upload a certain file.

Steps To Reproduce

1.) Navigate to any bug.
2.) Attempt to upload dmd20_0001.ss.

TagsNo tags attached.

Relationships

duplicate of 0008867 closedryandesign APPLICATION ERROR 0000401 while uploading files into MySQL 

Activities

pchaintreuil

pchaintreuil

2005-10-05 16:51

reporter   ~0011471

The file is about 1 Meg (less than the 50meg limit set in PHP & Mantis). You can get a gzip'ed version of it from http://tinyurl.com/7r93x (You'll probably have to right-click and "save-as" on that link). Remember to unzip it before trying to replicate the bug as the zipped version does not cause the problem.

My back-end DB is a MySQL one.

pchaintreuil

pchaintreuil

2005-10-05 16:56

reporter   ~0011472

Raising the my /etc/mysql/my.cnf's pair of max_allowed_packet variable to 20M (from their default of 1M) allows me to upload the file. (I also changed my php.ini's upload_max_filesize to 20M and Mantis's config_inc.php's g_max_file_size to 20000000.)

This should probably be handled more correctly, at least like when you blatently try to upload a file that's too large. Additionally, I don't know how much bloat occurs when "escaping" the binary file into something that can be sent to the database happens. Does it expand by a factor of two? More? This should probably be better documented too....

thraxisp

thraxisp

2005-10-05 21:51

reporter   ~0011473

You need to adjust the "max_packet_size" setting in the mySQL configuration file (usually /etc/my.cnf) to match the maxinim uploaded file size. See http://www.futureware.biz/blog/index.php?p=112&more=1&c=1&tb=1&pb=1 for details.

pchaintreuil

pchaintreuil

2005-10-31 09:27

reporter   ~0011565

Do you think it's logical for the admin check installation page to verify that all these variables sync? Are they all determinable from within PHP?

thraxisp

thraxisp

2005-10-31 21:18

reporter   ~0011566

The SQL parameters are not readily available to PHP in a way that is database neutral. We might add database specific code to address this.

herringm

herringm

2008-02-26 13:29

reporter   ~0017204

This looks to be a duplicate of 0008867 which has been resolved. It may be worth adding some logic or documentation for this issue as it appears to be common.

giallu

giallu

2008-07-08 19:30

reporter   ~0018344

I just found this in the notes section of the page http://it.php.net/manual/en/mysqli.options.php

honestly, I'm not sure if it will work at all but it's worth noting

Example on using mysqli_options to increase size of max_allowed_packet for working with big blobs.

function dbConnect()
{
$user = 'jomama';
$pass = 'cartoon';
$dbName = 'LifeCycle';
$host = 'localhost';

$mysqli = mysqli_init();
mysqli_options($mysqli,MYSQLI_READ_DEFAULT_GROUP,
"max_allowed_packet=50M");
mysqli_real_connect($mysqli,$host, $user, $pass,$dbName)
or die ('

Unable to connect

');

return $mysqli;
}