| Bug #9819 | Cursors: Mysql Server Crash while fetching from table with 5 million records. | ||
|---|---|---|---|
| Submitted: | 11 Apr 2005 15:44 | Modified: | 23 Sep 2005 16:48 | 
| Reporter: | Disha | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) | 
| Version: | 5.0.3 Beta | OS: | Any (ALL) | 
| Assigned to: | Konstantin Osipov | CPU Architecture: | Any | 
   [11 Apr 2005 15:44]
   Disha         
  
 
   [12 Apr 2005 2:08]
   MySQL Verification Team        
  I don't got the server crash, just ran out the memory. I will test however
the behavior of optimized server:
c:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.5-beta-debug
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> Create table res_t2 (f1 char(100) , f2 mediumint , f3 int , f4 real , f5
    -> numeric)//
    -> \c
mysql> delimiter //
mysql> Create table res_t2 (f1 char(100) , f2 mediumint , f3 int , f4 real , f5
    -> numeric)//
Query OK, 0 rows affected (0.11 sec)
mysql> Call sp1()//
ERROR 5 (HY000): Out of memory at line 195, 'C:\mysql-5.0.5-beta\mysys\my_alloc.c'
mysql> select count(*) from res_t2;
    -> //
+----------+
| count(*) |
+----------+
|  2039723 |
+----------+
1 row in set (0.37 sec)
mysql>
c:\mysql\bin>mysqld-debug --standalone --console
050411 19:49:10  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
050411 19:49:10  InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 0 502216.
InnoDB: Doing recovery: scanned up to log sequence number 0 502216
InnoDB: Last MySQL binlog file position 0 0, file name
050411 19:49:10  InnoDB: Started; log sequence number 0 502216
050411 19:49:10  InnoDB: Starting recovery for XA transactions...
050411 19:49:10  InnoDB: 0 transactions in prepared state after recovery
050411 19:49:11 [Note] mysqld-debug: ready for connections.
Version: '5.0.5-beta-debug'  socket: ''  port: 3306  Source distribution
050411 22:53:40 [ERROR] Out of memory; check if mysqld or some other process uses all available memory; if not, you may h
ave to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
050411 22:53:41 [ERROR] Out of memory; check if mysqld or some other process uses all available memory; if not, you may h
ave to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
 
   [12 Apr 2005 3:04]
   MySQL Verification Team        
  c:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.5-beta-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> delimiter //
mysql> Create table res_t2 (f1 char(100) , f2 mediumint , f3 int , f4 real , f5
    -> numeric)//
Query OK, 0 rows affected (0.14 sec)
mysql> Call sp1()//
ERROR 5 (HY000): Out of memory (Needed 2310412 bytes)
mysql> select count(*) from res_t2;
    -> //
+----------+
| count(*) |
+----------+
|  2183282 |
+----------+
1 row in set (1.26 sec)
c:\mysql\bin>mysqld-nt --standalone --console
050411 23:48:28  InnoDB: Started; log sequence number 0 502216
050411 23:48:28  InnoDB: Starting recovery for XA transactions...
050411 23:48:28  InnoDB: 0 transactions in prepared state after recovery
050411 23:48:29 [Note] mysqld-nt: ready for connections.
Version: '5.0.5-beta-nt'  socket: ''  port: 3306  Source distribution
050411 23:56:51 [ERROR] Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use m
ore memory or you can add more swap space
050411 23:56:54 [ERROR] Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use m
ore memory or you can add more swap space
 
   [9 May 2005 7:39]
   Konstantin Osipov        
  This bug should be taken care of when we replace the current implementation of cursors in stored procedures with the one used in the client-server protocol (among some other bugs)
   [11 May 2005 19:32]
   Matt Ryan        
  When will this be done? I'm sure there's lots waiting for a fix like we are will it be in 5.0.7?
   [5 Jul 2005 17:29]
   Konstantin Osipov        
  This bug will be fixed after Bug#10760 (dependency)
   [21 Sep 2005 16:18]
   Konstantin Osipov        
  The test case provided by Disha is invalid syntax for the latest MySQL. Using the test case provided by Miguel.
   [21 Sep 2005 17:48]
   Konstantin Osipov        
  I was able to verify that the bug does not show up when using the proposed patch and Miguel's test case. A reduced test case is added to sp-big.test
   [21 Sep 2005 22:11]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/30173
   [21 Sep 2005 22:22]
   Konstantin Osipov        
  Fixed in 5.0.13
   [23 Sep 2005 16:48]
   Paul DuBois        
  Noted in 5.0.13 changelog.

