Strange php and mySQL warining suddenly appeard

Status
Not open for further replies.

igordr

Member
22
2012
1
0
Hi, i need some help.
I have problems with mySQL. In some of my sites, i get warnings at the top of the pages:

Code:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in  Warning: session_start() [function.session-start]: open(/tmp/sess_2768563f6f13c08c044c710c554aaa37, O_RDWR) failed: No space left on device (28) in /home/stranifi/public_html/musicvideo.php on line 17  Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/stranifi/public_html/musicvideo.php:17) in /home/stranifi/public_html/musicvideo.php on line 17  Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/stranifi/public_html/musicvideo.php:17) in /home/stranifi/public_html/musicvideo.php on line 17


Mentioned problems appeared suddenly. I didn't do anything.
My server configuration is:

HDD 2x 500 GB SATARAM
6 GB DDR2-RAM
CPU AMD Athlon 64 X2 3400+, Dual-Core
Template CentOS 6 - minimal - RAID 1

I have about 15k unique visitors every day.

My present my.cnf file looks like this:

Code:
[mysqld]
set-variable = max_connections=500
query_cache_limit       = 2M
query_cache_size        = 256M
table_cache = 400
thread_cache_size = 286
log-slow-queries
safe-show-database

What i should tweak to get error disappear and get mySQL to work again?

THANKS,
Igor
 
13 comments
you need to increase ur tmp folder size. if you are on Cenots, it uses tmpfs for /tmp. modify ur /etc/fstab to increase tmp size. an example how it should look
Code:
tmpfs /tmp tmpfs size=1g 0 0
 
check the root partition
How i do that?

What is the size of your MySQL db's?
That should not be the problem .They are not bigger than 500 MB, together.

Run the command below and see which use is as 100%:
Results:


Code:
root@bravo612 [~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1              586G   22G  535G   4% /
tmpfs                 2.8G     0  2.8G   0% /dev/shm
/dev/md0              496M   63M  409M  14% /boot
/usr/tmpDSK           4.0G  151M  3.6G   4% /tmp
Any help?


you need to increase ur tmp folder size. if you are on Cenots, it uses tmpfs for /tmp. modify ur /etc/fstab to increase tmp size. an example how it should look

I just need to type this in SHH?

Code:
tmpfs /tmp tmpfs size=1g 0 0
 
Results of the command 'df -h /tmp'

Code:
root@bravo612 [~]# df -h /tmp
Filesystem            Size  Used Avail Use% Mounted on
/usr/tmpDSK           4.0G  151M  3.6G   4% /tmp

Results of the mySQLtuner.PL

Code:
 >>  MySQLTuner 1.2.0 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.63-cll
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 168M (Tables: 715)
[!!] Total fragmented tables: 3

-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 1h 50m 16s (291K q [44.134 qps], 9K conn, TX: 531M, RX: 25M)
[--] Reads / Writes: 90% / 10%
[--] Total buffers: 280.0M global + 2.7M per thread (500 max threads)
[OK] Maximum possible memory usage: 1.6G (29% of installed RAM)
[OK] Slow queries: 0% (27/291K)
[OK] Highest usage of available connections: 3% (15/500)
[OK] Key buffer size / total MyISAM indexes: 8.0M/51.8M
[OK] Key buffer hit rate: 99.5% (20M cached / 97K reads)
[OK] Query cache efficiency: 53.0% (119K cached / 225K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (10 temp sorts / 7K sorts)
[!!] Joins performed without indexes: 115
[OK] Temporary tables created on disk: 22% (1K on disk / 7K total)
[OK] Thread cache hit rate: 99% (15 created / 9K connections)
[!!] Table cache hit rate: 11% (196 open / 1K opened)
[OK] Open file limit used: 14% (370/2K)
[OK] Table locks acquired immediately: 99% (123K immediate / 123K locks)

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Adjust your join queries to always utilize indexes
    Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
    join_buffer_size (> 128.0K, or always use indexes with joins)
    table_cache (> 400)

Yes, i have cleared cache of the browser. On every machine, warnings are shown. But periodically... They are not always present. My traffic made significant fall.

What to do next?
 
Strange did you clear tmp? is it a vps maybe the host ran out of space


you can add dir for mysql temp files in the big partition to save some space, maybe move your DB and symlink it aswell to stop it getting corrupted.

create a folder and chown to mysql:mysql and add a line to my.cnf
tmpdir = /home/stranifi/mysql_tmp
 
I have cleared tmp seasson files.

What to do next?


System information

System information
Server load 4.35 (1 CPU)
Memory Used 16.22% (930,260 of 5,733,840)
Swap Used 7.23% (151,712 of 2,097,136)
 
How are you streaming the videos?? Could be as you set up the videos to be played the temp space gets full and frees up before you see the error and check the space.
 
Last edited:
Status
Not open for further replies.
Back
Top