?
avatar degobbis
degobbis
27 Nov 2017

System information

A webserver that meets the requirements of Joomla! with a MySQL database version 5.5.57 or smaller, or MariaDB version 5.5.56 or smaller. (Actual Plesk 17.5.x on CentOS 7 servers uses MariaDB 5.5.56, one of biggest german hoster with a number in name, uses MySQL 5.5.57)

Steps to reproduce the issue

  • Install Joomla! 3.8.2 Stable without test datas
  • Create a new category named Legal
  • Add two new subcategories to Legal, named Imprint and Privacy Policy
  • Create a test article in each category
  • Create a new menu item from type Category blog and call it Imprint and assign the category Legal.
  • Change to the tab blog layout and set Include subcategory to one of the values 1 to 5

Expected result

A blog output of the articles from the specified category with subcategories

Actual result

Error 500

Could not connect to MySQL.: Warning: session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in /var/www/vhosts/local.vhost/httpdocs/libraries/joomla/session/handler/native.php on line 194

If you set the output of the subcategories to none or all, the error does not show up.

Additional comments

The error is misleading, because it is not really a session problem, but it is an error from the database.

This error is caused by this database call

SELECT DISTINCT a.id, a.title, a.alias, a.introtext, a.fulltext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, CASE WHEN c.published = 2 AND a.state > 0 THEN 2 WHEN c.published != 1 THEN 0 ELSE a.state END as state,CASE WHEN a.modified = '0000-00-00 00:00:00' THEN a.created ELSE a.modified END as modified, a.modified_by, uam.name as modified_by_name,CASE WHEN a.publish_up = '0000-00-00 00:00:00' THEN a.created ELSE a.publish_up END as publish_up,a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, a.language,  LENGTH(a.fulltext) AS readmore, a.ordering,c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias,c.published, c.published AS parents_published, c.lft,CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author,ua.email AS author_email,parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias FROM p2gz_content AS a LEFT JOIN p2gz_categories AS c ON c.id = a.catid LEFT JOIN p2gz_users AS ua ON ua.id = a.created_by LEFT JOIN p2gz_users AS uam ON uam.id = a.modified_by LEFT JOIN p2gz_categories as parent ON parent.id = c.parent_id WHERE a.access IN (1,1,5) AND c.access IN (1,1,5) AND c.published = 1 AND a.state = 1 AND (a.catid = 8 OR a.catid IN ( SELECT sub.id FROM p2gz_categories as sub INNER JOIN p2gz_categories as this ON sub.lft > this.lft AND sub.rgt < this.rgt WHERE this.id = 8 AND sub.level <= this.level + 1)) AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2017-11-21 09:36:15') AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2017-11-21 09:36:15') ORDER BY  c.lft,  a.ordering,  a.created   LIMIT 5

possible problem is a primary key fulltext search. Full-text searches are supported for MyISAM tables only. (In MySQL 5.6 and up, they can also be used with InnoDB tables.)

Thanks to Tom Möller from German Joomla! Forum for his step by step instruction to reproduce

avatar degobbis degobbis - open - 27 Nov 2017
avatar joomla-cms-bot joomla-cms-bot - change - 27 Nov 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Nov 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 27 Nov 2017
Category SQL
avatar csthomas
csthomas - comment - 27 Nov 2017

If you have a lots of rows then mysql may have a problem with complete it.
This query is heavy and would be good to rewrite it.

For now, I suggest to test #18731, which should eliminate the session error message. If you can please check your mysql error log, my mysql has been crash and need 1 second to restart in order to properly save the joomla session.

avatar franz-wohlkoenig franz-wohlkoenig - change - 27 Nov 2017
Status New Information Required
avatar degobbis
degobbis - comment - 27 Nov 2017

@csthomas I have already tested your issue, unfortunately without success.

avatar franz-wohlkoenig franz-wohlkoenig - change - 27 Nov 2017
Status Information Required Discussion
avatar csthomas
csthomas - comment - 27 Nov 2017

If you still get session error message then try to increase time in line 641:

sleep(1);

to some more, ex:

sleep(10);
avatar degobbis
degobbis - comment - 27 Nov 2017

Nothing changed.

avatar csthomas
csthomas - comment - 27 Nov 2017

Which database type do you use? (MySQLi or MySQL or MySQL (PDO))

Global Configuration -> Server -> Database Settings

avatar degobbis
degobbis - comment - 27 Nov 2017

I'm using MySQLi on a MariaDB 5.5.56

avatar csthomas
csthomas - comment - 27 Nov 2017

I suppose this is because of subquery statement in WHERE ...a.catid IN (SELECT ....) which crash on older versions of mysql and mariadb.

Can you execute above query in phpMyAdmin?

avatar degobbis
degobbis - comment - 27 Nov 2017

In PhpMyAdmin it causes the same crash.

avatar csthomas
csthomas - comment - 27 Nov 2017

Then this is database server issue and administrator of server should update mysql/mariadb.

But please do not close this issue, joomla should have better database query than above.

avatar degobbis
degobbis - comment - 27 Nov 2017

The database version is still in the minimum requirements for Joomla!

avatar csthomas
csthomas - comment - 28 Nov 2017

Can you remove text ORDER BY c.lft, a.ordering, a.created from the query and try again on phpMyAdmin?

avatar degobbis
degobbis - comment - 28 Nov 2017

Done, but get the same error: #2006 - MySQL server has gone away

avatar csthomas
csthomas - comment - 28 Nov 2017

If you used LIMIT 5 then it is weird.

I tested similar query on 5.5.5-10.1.29-MariaDB without any problem. The issue may be generated by invalid configuration of mysql or some of you table is corrupted.

avatar csthomas
csthomas - comment - 28 Nov 2017

I tested on J.3.7.3

avatar degobbis
degobbis - comment - 28 Nov 2017

Can You please test my query with the current stable Joomla! version on Your server to compare the results? Otherwise it will be a comparison like apples and eggs.
Or better, follow the steps to reproduce the error.

avatar csthomas
csthomas - comment - 28 Nov 2017

OK, I did test on J3.8.2 with 5.5.5-10.1.29-MariaDB and there is my result.
test

avatar brianteeman
brianteeman - comment - 28 Nov 2017

can't help but think that the original error message is actually correct

Could not connect to MySQL.: Warning: session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in /var/www/vhosts/local.vhost/httpdocs/libraries/joomla/session/handler/native.php on line 194

avatar degobbis
degobbis - comment - 29 Nov 2017

I get this error on a Plesk 17.5-Server with default installation.

avatar csthomas
csthomas - comment - 29 Nov 2017

Your problem could be related to http://www.fromdual.com/beware-of-large-mysql-max-sort-length-parameter

I suggest to check mariadb error log.

On phpmyadmin please test the query without DISTINCT and without ORDER BY ...
If it still does not work out, then remove as much as necessary to make the query successful.

avatar degobbis
degobbis - comment - 4 Dec 2017

Ok, I was clearing my mariadb.log and reproduce this error.
Here is the entry from log

171121 10:11:41 [ERROR] mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see http://kb.askmonty.org/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.

Server version: 5.5.56-MariaDB
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=2
max_threads=153
thread_count=2
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 466711 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x56371066bb10
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x7f511a7d1dc0 thread_stack 0x48000
/usr/libexec/mysqld(my_print_stacktrace+0x3d)[0x56370e26e96d]
/usr/libexec/mysqld(handle_fatal_signal+0x515)[0x56370de84285]
/lib64/libpthread.so.0(+0xf5e0)[0x7f5137afd5e0]
/usr/libexec/mysqld(+0x3962ef)[0x56370dd782ef]
/usr/libexec/mysqld(_Z20get_best_combinationP4JOIN+0x35b)[0x56370dd7edcb]
/usr/libexec/mysqld(+0x3b73b3)[0x56370dd993b3]
/usr/libexec/mysqld(_ZN4JOIN8optimizeEv+0x675)[0x56370dd9c625]
/usr/libexec/mysqld(_ZN13st_select_lex31optimize_unflattened_subqueriesEb+0xc8)[0x56370dd4bb18]
/usr/libexec/mysqld(_ZN4JOIN8optimizeEv+0x1ec7)[0x56370dd9de77]
/usr/libexec/mysqld(_Z12mysql_selectP3THDPPP4ItemP10TABLE_LISTjR4ListIS1_ES2_jP8st_orderSB_S2_SB_yP13select_resultP18st_select_lex_unitP13st_select_lex+0xc8)[0x56370dd9eae8]
/usr/libexec/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x2db)[0x56370dd9f5fb]
/usr/libexec/mysqld(+0x36b9d9)[0x56370dd4d9d9]
/usr/libexec/mysqld(_Z21mysql_execute_commandP3THD+0x45d1)[0x56370dd58001]
/usr/libexec/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x125)[0x56370dd5a8c5]
/usr/libexec/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1753)[0x56370dd5c923]
/usr/libexec/mysqld(_Z24do_handle_one_connectionP3THD+0x1c2)[0x56370de0e632]
/usr/libexec/mysqld(handle_one_connection+0x4a)[0x56370de0e6da]
/lib64/libpthread.so.0(+0x7e25)[0x7f5137af5e25]
/lib64/libc.so.6(clone+0x6d)[0x7f51362f334d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f50f8004bf8): SELECT DISTINCT a.id, a.title, a.alias, a.introtext, a.fulltext, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, a.created_by_alias, CASE WHEN c.published = 2 AND a.state > 0 THEN 2 WHEN c.published != 1 THEN 0 ELSE a.state END as state,CASE WHEN a.modified = '0000-00-00 00:00:00' THEN a.created ELSE a.modified END as modified, a.modified_by, uam.name as modified_by_name,CASE WHEN a.publish_up = '0000-00-00 00:00:00' THEN a.created ELSE a.publish_up END as publish_up,a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, a.hits, a.xreference, a.featured, a.language,  LENGTH(a.fulltext) AS readmore, a.ordering,c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias,c.published, c.published AS parents_published, c.lft,CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author,ua.email AS author_email,parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias FROM p2gz_content AS a LEFT JOIN p2gz_categories AS c ON c.id = a.catid LEFT JOIN p2gz_users AS ua ON ua.id = a.created_by LEFT JOIN p2gz_users AS uam ON uam.id = a.modified_by LEFT JOIN p2gz_categories as parent ON parent.id = c.parent_id WHERE a.access IN (1,1,5) AND c.access IN (1,1,5) AND c.published = 1 AND a.state = 1 AND (a.catid = 8 OR a.catid IN ( SELECT sub.id FROM p2gz_categories as sub INNER JOIN p2gz_categories as this ON sub.lft > this.lft AND sub.rgt < this.rgt WHERE this.id = 8 AND sub.level <= this.level + 1)) AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2017-11-21 09:11:41') AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2017-11-21 09:11:41') ORDER BY  c.lft,  a.ordering,  a.created   LIMIT 5
Connection ID (thread ID): 3
Status: NOT_KILLED

Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
171121 10:11:41 mysqld_safe Number of processes running now: 0
171121 10:11:41 mysqld_safe mysqld restarted
171121 10:11:41 [Note] /usr/libexec/mysqld (mysqld 5.5.56-MariaDB) starting as process 1959 ...
171121 10:11:41 InnoDB: The InnoDB memory heap is disabled
171121 10:11:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins
171121 10:11:41 InnoDB: Compressed tables use zlib 1.2.7
171121 10:11:41 InnoDB: Using Linux native AIO
171121 10:11:41 InnoDB: Initializing buffer pool, size = 128.0M
171121 10:11:41 InnoDB: Completed initialization of buffer pool
171121 10:11:41 InnoDB: highest supported file format is Barracuda.
171121 10:11:41  InnoDB: Starting crash recovery from checkpoint LSN=12906254
InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
171121 10:11:41  InnoDB: Starting final batch to recover 6 pages from redo log
171121 10:11:42  InnoDB: Waiting for the background threads to start
171121 10:11:43 Percona XtraDB (http://www.percona.com) 5.5.52-MariaDB-38.3 started; log sequence number 12907088
171121 10:11:43 [Note] Plugin 'FEEDBACK' is disabled.
171121 10:11:43 [Note] Server socket created on IP: '127.0.0.1'.
171121 10:11:43 [Note] Event Scheduler: Loaded 0 events
171121 10:11:43 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.56-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
avatar csthomas
csthomas - comment - 4 Dec 2017

It is probably this mariadb/mysql issue https://jira.mariadb.org/browse/MDEV-12673, which was fixed in 5.5.57.
The similar query, as in joomla, is in above page in section Issue links, duplicates: https://jira.mariadb.org/browse/MDEV-12726

avatar degobbis
degobbis - comment - 6 Dec 2017

Ok, it seems to be a database error. Everything works fine with the newer version 5.5.58 or 10.x.

avatar degobbis degobbis - change - 6 Dec 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-12-06 14:46:05
Closed_By degobbis
avatar degobbis degobbis - close - 6 Dec 2017

Add a Comment

Login with GitHub to post a comment