Fatal Error with starting mysqld with pquery from root

Bug #1475167 reported by Shahriyar Rzayev
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Percona QA
Fix Released
Medium
Roel Van de Paar

Bug Description

Will provide all explanation below. First of all i tried to run pquery as usual, with default MYSAFE:

[root@centos7_vm percona-qa]# ./pquery-run.sh
[11:51:05] [0] Workdir: /home/logs/pquery/568480 | Rundir: /dev/shm/568480 | Basedir: /opt/mysql-5.7D
[11:51:05] [0] Valgrind run: TRUE | pquery timeout: 195 | SQL file used: /home/fake/percona-qa/pquery/5.7.7.sql
[11:51:05] [0] MYSAFE: --no-defaults --event-scheduler=ON --maximum-bulk_insert_buffer_size=1M --maximum-join_buffer_size=1M --maximum-max_heap_table_size=1M --maximum-max_join_size=1M --maximum-myisam_max_sort_file_size=1M --maximum-myisam_mmap_size=1M --maximum-myisam_sort_buffer_size=1M --maximum-optimizer_trace_max_mem_size=1M --maximum-preload_buffer_size=1M --maximum-query_alloc_block_size=1M --maximum-query_prealloc_size=1M --maximum-range_alloc_block_size=1M --maximum-read_buffer_size=1M --maximum-read_rnd_buffer_size=1M --maximum-sort_buffer_size=1M --maximum-tmp_table_size=1M --maximum-transaction_alloc_block_size=1M --maximum-transaction_prealloc_size=1M --log-output=none --sql_mode=ONLY_FULL_GROUP_BY
[11:51:29] [0] Assert! The text '[ERROR] Aborting' was found in the error log. This may be an issue with one of the startup parameters. Saving trial for further analysis, and dumping error log ERRORs here for quick analysis. You likely have a problem in one of the startup parameters set in MYEXTRA (or MYSAFE)...
2015-07-16T06:51:29.480516Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2015-07-16T06:51:29.481811Z 0 [ERROR] Aborting

Then if you add --user=mysql to pquery-run.sh it will not start at all. Here is output from error log:

==2899== possibly lost: 2,881 bytes in 77 blocks
==2899== still reachable: 0 bytes in 0 blocks
==2899== suppressed: 0 bytes in 0 blocks
==2899== Rerun with --leak-check=full to see details of leaked memory
==2899==
==2899== For counts of detected and suppressed errors, rerun with: -v
==2899== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==2899== could not unlink /tmp/vgdb-pipe-from-vgdb-to-2899-by-root-on-centos7_vm
==2899== could not unlink /tmp/vgdb-pipe-to-vgdb-from-2899-by-root-on-centos7_vm
==2899== could not unlink /tmp/vgdb-pipe-shared-mem-vgdb-2899-by-root-on-centos7_vm

The solution was for me, adding --user=root to pquery-run.sh file:

[11:54:59] [0] Waiting for mysqld (pid: 3348) to fully start (note this is slow for Valgrind runs, and can easily take 35-90 seconds even on an high end server)...
[11:56:04] [0] Server started ok. Client: /opt/mysql-5.7D/bin/mysql -uroot -S/dev/shm/211332/1/socket.sock
[11:56:04] [0] Starting pquery (log stored in /dev/shm/211332/1/pquery.log)...
[11:56:04] [0] pquery running (Max duration: 195s)...

Diff:

-MYSAFE="--no-defaults --event-scheduler=ON --maximum-bulk_insert_buffer_size=1M --maximum-join_buffer_size=1M --maximum-max_heap_table_size=1M --maximum-max_join_size=1M --maximum-myisam_max_sort_file_size=1M --maximum-myisam_mmap_size=1M --maximum-myisam_sort_buffer_size=1M --maximum-optimizer_trace_max_mem_size=1M --maximum-preload_buffer_size=1M --maximum-query_alloc_block_size=1M --maximum-query_prealloc_size=1M --maximum-range_alloc_block_size=1M --maximum-read_buffer_size=1M --maximum-read_rnd_buffer_size=1M --maximum-sort_buffer_size=1M --maximum-tmp_table_size=1M --maximum-transaction_alloc_block_size=1M --maximum-transaction_prealloc_size=1M --log-output=none --sql_mode=ONLY_FULL_GROUP_BY" # See http://bugs.mysql.com/?id=73916 re: testing env setup
+MYSAFE="--no-defaults --event-scheduler=ON --maximum-bulk_insert_buffer_size=1M --maximum-join_buffer_size=1M --maximum-max_heap_table_size=1M --maximum-max_join_size=1M --maximum-myisam_max_sort_file_size=1M --maximum-myisam_mmap_size=1M --maximum-myisam_sort_buffer_size=1M --maximum-optimizer_trace_max_mem_size=1M --maximum-preload_buffer_size=1M --maximum-query_alloc_block_size=1M --maximum-query_prealloc_size=1M --maximum-range_alloc_block_size=1M --maximum-read_buffer_size=1M --maximum-read_rnd_buffer_size=1M --maximum-sort_buffer_size=1M --maximum-tmp_table_size=1M --maximum-transaction_alloc_block_size=1M --maximum-transaction_prealloc_size=1M --log-output=none --sql_mode=ONLY_FULL_GROUP_BY --user=root" # See http://bugs.mysql.com/?id=73916 re: testing env setup

Revision history for this message
Roel Van de Paar (roel11) wrote :

Thank you for the bug report.

Maybe one fix would be to

if [ "$(whoami)" == "rooot" ]; then
  MYEXTRA="--user=root ${MYEXTRA}"
fi

@Shahriyar @Ramesh - you agree? Thoughts?

Revision history for this message
Roel Van de Paar (roel11) wrote :

I remember from early reducer.sh days I had to do exactly that (add --user=root) to get reducer.sh to be able to handle all situations (running as user or running as root well)

@Shahriyar, btw, the simple workaround is to just run as a non-root user.

Revision history for this message
Roel Van de Paar (roel11) wrote :

@Shahriyar - Btw, you're running Valgrind (VALGRIND_RUN=1), and I traced the reason back to a small mistake I made - while working on episode #11 (which will be about Valgrind testing), I by accident changed VALGRIND_RUN to =1 and I likely pushed that back to launchpad in amongst other changes. I've reverted the change, please do;

$ cd ~/percona-qa # or where you stored percona-qa
$ bzr pull # get revision 1468 or later

Changed in percona-qa:
assignee: nobody → Roel Van de Paar (roel11)
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Ramesh Sivaraman (rameshvs02) wrote :

@Roel. The fix is nice. Working fine

Revision history for this message
Roel Van de Paar (roel11) wrote :

@Ramesh is pushing the fix

Revision history for this message
Roel Van de Paar (roel11) wrote :

Pushed in rev #1469

@Shahriyar, please test/check

Revision history for this message
Roel Van de Paar (roel11) wrote :

reducer.sh also has:

MYUSER=$(whoami)

And startup:

CMD="${TIMEOUT_COMMAND} ${MYBASE}${BIN} --no-defaults --basedir=$MYBASE --datadir=$WORKD/data --tmpdir=$WORKD/tmp \
                         --port=$MYPORT --pid-file=$WORKD/pid.pid --socket=$WORKD/socket.sock \
                         --user=$MYUSER $MYEXTRA --log-error=$WORKD/error.log.out --event-scheduler=ON \
                         --loose-debug-sync-timeout=$TS_DS_TIMEOUT"

IOW, it will be something like

--user=root --user=root

Which will work fine, just looks slightly off.

Revision history for this message
Ramesh Sivaraman (rameshvs02) wrote :

@Shahriyar, please pull latest revision
------------------------------------------------------------
revno: 1469
committer: Ramesh Sivaraman <email address hidden>
branch nick: percona-qa
timestamp: Fri 2015-07-17 09:38:17 +0530
message:
  Bug fix to initiate pquery-run.sh from root user
------------------------------------------------------------

Changed in percona-qa:
status: Triaged → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

What a lightening speed guys :)
It is great pleasure to get attention in that manner)

Thanks for approving and fixing. Will test again when I will back at work.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.