Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Installation: detect disabled gzcompress/gzuncompress #1776

Closed
anonymous-piwik-user opened this Issue · 27 comments

3 participants

@anonymous-piwik-user

On the Dashboard almost all the Tabs show the same bug.

Here is the phpinfo from the server I am using: http://23.se.gp/phpinfo.php

Warning: gzuncompress() [<a href='function.gzuncompress'>function.gzuncompress</a>]: data error in /data/multiserv/users/452235/projects/1039869/www/piwik/core/Archive/Single.php on line 270

Backtrace -->
#0 Piwik_ErrorHandler(2, gzuncompress() [<a href='function.gzuncompress'>function.gzuncompress</a>]: data error, /data/multiserv/users/452235/projects/1039869/www/piwik/core/Archive/Single.php, 270, Array ([name] => UserSettings_browser,[typeValue] => blob,[table] => piwik_archive_blob_2010_10,[db] => Piwik_Db_Adapter_Pdo_Mysql Object ([] => mysql,[] => Array ([0] => 0,[1] => 1,[2] => 2,[INT] => 0,[INTEGER] => 0,[MEDIUMINT] => 0,[SMALLINT] => 0,[TINYINT] => 0,[BIGINT] => 1,[SERIAL] => 1,[DEC] => 2,[DECIMAL] => 2,[DOUBLE] => 2,[DOUBLE PRECISION] => 2,[FIXED] => 2,[FLOAT] => 2),[] => Zend_Db_Statement_Pdo,[] => Array (),[] => 2,[] => Zend_Db_Profiler Object ([] => Array (),[] => ,[] => ,[] => ),[] => Zend_Db_Profiler,[] => PDO Object (),[] => 0,[] => 1,[] => 1,[] => ),[value] => ))
#1 gzuncompress() called at [/data/multiserv/users/452235/projects/1039869/www/piwik/core/Archive/Single.php:270]
#2 Piwik_Archive_Single->get(UserSettings_browser, blob) called at [/data/multiserv/users/452235/projects/1039869/www/piwik/core/Archive/Single.php:443]
#3 Piwik_Archive_Single->getDataTable(UserSettings_browser) called at [/data/multiserv/users/452235/projects/1039869/www/piwik/plugins/UserSettings/API.php:39]
#4 Piwik_UserSettings_API->getDataTable(UserSettings_browser, 1, day, 2010-10-21) called at [/data/multiserv/users/452235/projects/1039869/www/piwik/plugins/UserSettings/API.php:70]
#5 Piwik_UserSettings_API->getBrowser(1, day, 2010-10-21)
#6 call_user_func_array(Array ([0] => Piwik_UserSettings_API Object (),[1] => getBrowser), Array ([0] => 1,[1] => day,[2] => 2010-10-21)) called at [/data/multiserv/users/452235/projects/1039869/www/piwik/core/API/Proxy.php:151]
#7 Piwik_API_Proxy->call(Piwik_UserSettings_API, getBrowser, Array ([method] => UserSettings.getBrowser,[format] => original,[filter_limit] => 5,[filter_sort_column] => nb_uniq_visitors,[filter_sort_order] => desc,[module] => UserSettings,[action] => getBrowser,[idSite] => 1,[period] => day,[date] => 2010-10-21)) called at [/data/multiserv/users/452235/projects/1039869/www/piwik/core/API/Request.php:117]
#8 Piwik_API_Request->process() called at [/data/multiserv/users/452235/projects/1039869/www/piwik/core/ViewDataTable.php:367]
#9 Piwik_ViewDataTable->loadDataTableFromAPI() called at [/data/multiserv/users/452235/projects/1039869/www/piwik/core/ViewDataTable/HtmlTable.php:75]
#10 Piwik_ViewDataTable_HtmlTable->main() called at [/data/multiserv/users/452235/projects/1039869/www/piwik/core/Controller.php:140]
#11 Piwik_Controller->renderView(Piwik_ViewDataTable_HtmlTable Object ([] => ,[arrayDataTable] => ,[] => CoreHome/templates/datatable.tpl,[] => 1,[] => Array ([enable_sort] => 1,[filter_sort_column] => nb_uniq_visitors,[filter_sort_order] => desc,[filter_limit] => 5),[] => Array ([show_goals] => ,[show_search] => ,[show_table] => 1,[show_table_all_columns] => 1,[show_all_views_icons] => 1,[show_export_as_image_icon] => ,[show_exclude_low_population] => ,[show_offset_information] => 1,[show_pagination_control] => 1,[show_footer] => 1,[show_footer_icons] => 1,[apiMethodToRequestDataTable] => UserSettings.getBrowser,[uniqueId] => UserSettingsgetBrowser),[] => 0,[] => ,[] => Array (),[] => getBrowser,[] => UserSettings,[] => ,[] => UserSettings.getBrowser,[] => ,[] => Array ([nb_visits] => Visits,[nb_uniq_visitors] => Unique visitors,[nb_actions] => Actions,[nb_actions_per_visit] => Actions per Visit,[avg_time_on_site] => Avg. Time on Website,[bounce_rate] => Bounce Rate,[conversion_rate] ...
#12 Piwik_UserSettings_Controller->getBrowser()
#13 call_user_func_array(Array ([0] => Piwik_UserSettings_Controller Object ([] => UserSettings,[] => 2010-10-21,[] => Piwik_Date Object ([] => 1287619200,[] => UTC),[] => 1,[] => Piwik_Site Object ([] => 1)),[1] => getBrowser), Array ()) called at [/data/multiserv/users/452235/projects/1039869/www/piwik/core/FrontController.php:126]
#14 Piwik_FrontController->dispatch() called at [/data/multiserv/users/452235/projects/1039869/www/piwik/index.php:60]
@robocoder
Collaborator

Edit config/config.ini.php, adding 'charset = utf8' to the database connection settings.

@anonymous-piwik-user

It is already (Version 1.0)

[database]
host = "localhost"
username = "xxx
password = "xxx"
dbname = "xxx"
tables_prefix = "piwik_"
adapter = "MYSQLI"
port = 3306
charset = "utf8"

@robocoder
Collaborator

Has it always been charset=utf8?

A mangled row was inserted. You'll have to delete the bad row in the archive table. Piwik should regenerate it.

@robocoder
Collaborator

Are you sure you're looking at the right config? Your stacktrace shows PDO_MYSQL while comment:2 shows MYSQLI.

@robocoder
Collaborator

Attachment:
ZlibDecompress.php

@robocoder
Collaborator

Attachment:
HuffmanTable.php

@robocoder
Collaborator

Attachment:
1776.patch

@robocoder
Collaborator

If you haven't already deleted the affected row in your table...

You can also try the attached patch + .php files (put them in the core/Archive folder). If gzuncompress() fails, it'll try to use Emanuele Iannone's decompression class (based on the official Zlib code).

@anonymous-piwik-user

I tried MYSQLI and PDO_MYSQL, each time I used a new database/new installation.
There are no installation errors either, everything is checked green.
charset = "utf8" is always set by default.

I applied the patch (in the old database, and later on new database)
but then it goes "...ZlibDecompress.php on line 174..." which is
"trigger_error("Out of input", E_USER_ERROR);"

"Last visitor graph" works, "Live visitors" works but not "List of keywords" or for example "Length of Visits".

Any more clues?

@robocoder
Collaborator

What version of mysql server are you using?

@robocoder
Collaborator

My only other thought is to use mysql's compress/uncompress functions ... this would any encoding errors between php and mysql server.

@anonymous-piwik-user

MYSQL version is: 5.0.51a-24+lenny4-log

I think I just use go for another server.

Thanks for the great help!

@robocoder
Collaborator

5.0.51a is old and buggy. Upgrading mysql generally won't hurt.

Can you check your my.cnf for max_allowed_packet? If this is set too low, I suspect the INSERT fails (eg blob is truncated), which would explain the data error when we SELECT and gzuncompress).

@anonymous-piwik-user

max allowed packet = 16,776,192

@robocoder
Collaborator

Attachment:
1776-2.patch

@robocoder
Collaborator

This second patch uses MySQL's native compress/uncompress functions per comment:8.

@anonymous-piwik-user

Wahoo it works!

This is what I call service! Thanks again.
Who needs Google anyway? ;)

@robocoder
Collaborator

We still don't know what the exact cause is, since it works "as-is" usually. This may not make it into Piwik 1.1as it needs changes to the Installer and adapters, and affects the db abstraction in #1368.

@robocoder
Collaborator

I took another look at your phpinfo. Was gzcompress always disabled on your system?

@anonymous-piwik-user

Yes it was.
My mistake, I didn't look into it.

A solution would be to expand the System Check in the installation.
At least until there is a better way.

@mattab
Owner

What should we test for in order to prevent this bug then? thx

@anonymous-piwik-user

Check if gzcompress is enabled on the server.

@robocoder
Collaborator

Ok. I was thinking of a custom adapter that would use the built-in MySQL functions, but let's go with the quick fix of detecting this at installation.

@robocoder
Collaborator

(In [3321]) fixes #1776

@mattab
Owner

Looking at the error message "function.gzuncompress: data error", it makes me believe that the function was properly defined, but just didn't work as expected. Otherwise the error message is more like: 'Fatal error: Call to undefined function'

So I don't think the SVN commit would really fix this issue - thoughts?

@robocoder
Collaborator

That's because gzcompress was disabled while gzuncompress was enabled.

We're good here.

@mattab
Owner

Thanks, good stuff vipsoft!

@anonymous-piwik-user anonymous-piwik-user added this to the Piwik 1.1 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.