Bug #1280 error 5 Out of memory running cron scripts
Submitted: 15 Sep 2003 9:58 Modified: 18 Jan 2004 0:23
Reporter: already told you already told you Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S2 (Serious)
Version:4.1.0-alpha OS:Linux (RH7.3 2.4.20-18.7)
Assigned to: CPU Architecture:Any

[15 Sep 2003 9:58] already told you already told you
Description:
got "ERROR 5 at line 18: Out of memory (Needed 1543503928 bytes)" doing INSERT/UPDATE simple statements.
cron -> bash -> mysql  --execute="my SQL statements"

- Mysql client + server are on the same host
- did appear recently ; no kernel changes ; no mysqld changes.
- SQL statements work fine when running from telnet + mysql < my_scripts.sql
- tables type : MyISAM
- free :
             total       used       free     shared    buffers     cached
Mem:        514100     472024      42076          0      67772     317488
-/+ buffers/cache:      86764     427336
Swap:      1044184         36    1044148
( system load has not increased recently)
MySQL doc says memory needs occurs when doing SELECT ; but I'm not, my INSERT,UPDATE statements should not need client side memory.

thanxs for help

How to repeat:
1)write simple SELECT/ UPDATE statements into a myscript.sql
2) check statements are Ok running console command 
   mysql MyDataBase < myscript.sql
3) write a simple shell script that launch the command :
myscript.sh:
     mysql --user=xx --password=xxx MyDataBase < myscript.sql > /tmp/my.log 2>&1

4) crontab your script (see crontab command)

 sometime it works, sometime is fails  :-(
[18 Sep 2003 5:26] Alexander Keremidarski
I wasn't able to repeatr it with some random queries.

Can you please send us your script to test it?
[18 Sep 2003 8:55] already told you already told you
Bug occurs ONLY when mysql is called from a shell script launched by crontab.
The SQL statement is really a basic one (looks like "UPDATE mytable SET xyz_date = NOW() WHERE blablabla")
It works fine when called from command line ( mysql mydatabase < myscript.sql)
you need to call the operation from cron to get into same conditions.

exact shell code is :
 mysql --user=$DB_USER --host=$DB_HOST --database=$DB_NAME --quick
  --disable-pager --silent --skip-column-name < $LOCAL_BASE_DIR/bin/codif_type_ldp.sql

I added "--quick" yesterday but still got "Out of memory" error
[17 Dec 2003 1:15] Are you mortal Then prepare to die.
You wouldn't be using an ALPHA would you? 

Is it a multi CPU machine?

How about a multi user machine with process limits imposed by sys admin?

I find very similar bugs... If the select works alone, it should work with an 'INSERT INTO' or as part of a cron job right?

This is a pain in the assets.
[18 Dec 2003 0:23] already told you already told you
>You wouldn't be using an ALPHA would you? 
>Is it a multi CPU machine?
No, Intel mono-CPU, kernet 2.4.20-18.7 (RH7.3)

>How about a multi user machine with process limits imposed by sys admin?
multi-user machine: yes of course ; process limits: no, login user (telnet) can run the jobs 100%

>I find very similar bugs... If the select works alone, it should work with an
'INSERT INTO' or as part of a cron job right?
Yes, I use SELECT, INSERT, UPDATE, DELETE

>This is a pain in the assets.
Indeed :(
[14 Feb 2005 22:54] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".