Bug #39289 libmysqld.a calls exit() upon error
Submitted: 6 Sep 2008 17:15 Modified: 19 Mar 2009 3:41
Reporter: Edward Hades Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S1 (Critical)
Version:5.1.26-rc OS:Any
Assigned to: Alexey Botchkov CPU Architecture:Any

[6 Sep 2008 17:15] Edward Hades
When a serious error occurs in MySQL Embedded, it calls exit() immediately.

Can you please implement a better error handling policy, that would not make a GUI application using libmysqld disappear?

How to repeat:
Way 1.
Use InnoDB storage engine.
Setup a database on a partition where there isn't much disk space.
Run a libmysqld-using app there.
Fill remaining disk space.
Do something to make mysql write new data to the disc.
(InnoDB exits, saying no more disk space left)

Way 2.
Use MyISAM storage engine.
Abort a libmysqld-using app, so it cannot call mysql_library_end() safely
Run the app again.
(app exits, saying MyISAM tables need repair)

Suggested fix:
Replace exit() calls in libmysqld library with some callback routine, that can notify host application of the error, so it can take appropriate measures and/or notify the user.
[8 Sep 2008 11:21] Susanne Ebrecht
Many thanks for writing a feature request. We will discuss it.
[27 Oct 2008 11:24] 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:


2664 Alexey Botchkov	2008-10-27
      Bug#39289 libmysqld.a calls exit() upon error 
      Several functions (mostly in mysqld.cc) directly call
      exit() function in case of errors, which is not a desired
      behaviour expecially in the embedded-server library.
      Fixed by making these functions return error sign instead
      of exiting.
      per-file comments:
      Bug#39289 libmysqld.a calls exit() upon error 
        added 'error' retvalue for my_getopt_register_get_addr
      Bug#39289 libmysqld.a calls exit() upon error 
        unireg_clear() function implemented
      Bug#39289 libmysqld.a calls exit() upon error 
        error returned instead of exit() call
      Bug#39289 libmysqld.a calls exit() upon error 
        free_tmpdir() - fixed so it's not produce crash on uninitialized
          tmpdir structure
      Bug#39289 libmysqld.a calls exit() upon error 
        error returned instead of exit() call
      Bug#39289 libmysqld.a calls exit() upon error 
        unireg_abort definition fixed for the embedded server
      Bug#39289 libmysqld.a calls exit() upon error 
        various functions fixed
        error returned instead of exit() call
[13 Mar 2009 19:07] Bugs System
Pushed into 5.1.33 (revid:joro@sun.com-20090313111355-7bsi1hgkvrg8pdds) (version source revid:patrick.crews@sun.com-20090225081629-ent6zn9d1lt6bx68) (merge vers: 5.1.33) (pib:6)
[18 Mar 2009 13:17] Bugs System
Pushed into 6.0.11-alpha (revid:joro@sun.com-20090318122208-1b5kvg6zeb4hxwp9) (version source revid:holyfoot@mysql.com-20090224115659-ju15jcofiff051zw) (merge vers: 6.0.10-alpha) (pib:6)
[19 Mar 2009 3:41] Paul DuBois
Noted in 5.1.33, 6.0.11 changelogs.

Several functions in libmysqld called exit() when an error occurred
rather than returning an error to the caller.
[9 May 2009 16:46] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (version source revid:jonas@mysql.com-20090508100057-30ote4xggi4nq14v) (merge vers: 5.1.33-ndb-6.2.18) (pib:6)
[9 May 2009 17:43] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (version source revid:jonas@mysql.com-20090508175813-s6yele2z3oh6o99z) (merge vers: 5.1.33-ndb-6.3.25) (pib:6)
[9 May 2009 18:40] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (version source revid:jonas@mysql.com-20090509073226-09bljakh9eppogec) (merge vers: 5.1.33-ndb-7.0.6) (pib:6)