Bug #39260 Falcon should detect that it has been compiled without support for C++ exception
Submitted: 4 Sep 2008 21:45 Modified: 13 Dec 2008 10:02
Reporter: Olav Sandstå Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0.7 OS:Any
Assigned to: Olav Sandstå CPU Architecture:Any
Tags: F_ERROR HANDLING
Triage: Triaged: D1 (Critical)

[4 Sep 2008 21:45] Olav Sandstå
Description:
Falcon uses C++ exceptions and needs to be compiled with support for C++ exceptions. At the moment, failure to include C++ exceptions support in the compilation leads to strange failures that can be hard to understand the cause for. 

Falcon should handle this more gracefully by being able to detect that it had been compiled without C++ exception.

How to repeat:
Compile Falcon without support for C++ exceptions and try to run it.

Suggested fix:
On IRC following code was suggested as a way of solving this issue (include this in the startup code of Falcon):

 
 try {
   throw 1;
 }
 catch(int) {
   return;
 }
 signal(SIGABRT);

Some suggested even that Falcon should provide a human readable error message in this case.
[10 Sep 2008 13:43] 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/commits/53693

2819 Olav Sandstaa	2008-09-10
      Bug#39260 Falcon should detect that it has been compiled without
      support for C++ exception
      
      During initialisation of Falcon: check that it has been compiled with
      support for exception. If it has not been compiled with support for
      exception it will write an error message and return an error status to
      the server.
[10 Sep 2008 14:03] 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/commits/53695

2819 Olav Sandstaa	2008-09-10
      Bug#39260 Falcon should detect that it has been compiled without
      support for C++ exception
      
      During initialisation of Falcon: check that it has been compiled with
      support for exception. If it has not been compiled with support for
      exception it will write an error message and return an error status to
      the server.
[11 Sep 2008 12:02] Olav Sandstå
An initial patch that prevents Falcon from being initialized when it detects that it has been built without support for C++ exception have been committed and pushed. 

The plan is to update this patch later with a change where Falcon will crash the mysqld process if it detects that it is built without C++ support. This will be implemented when we have implemented a fix in configure/build that will also attempt to detect this situation.

Setting status back to "In progress".
[16 Nov 2008 11:31] 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/commits/58885

2917 Olav Sandstaa	2008-11-16
      Fix to bug#39260 Falcon should detect that it has been compiled without support for C++ exception
      
      This is the second patch for handling the problem of Falcon being compiled without support for
      C++ exceptions. Changes how Falcon behaves when it detects that it has been compiled without 
      exception support from returning an error code to the server (as implemeneted in first patch)
      to crash the process. The rationale for this is that this should only happen in rare occations 
      where configure and/or compile has been done with wrong compiler options.
[16 Nov 2008 12:19] Olav Sandstå
Note to the attached patch:

With this patch the following will be written to the MySQL's error log if Falcon has been compiled without C++ exception support followed by mysqld exiting:

===========================================================================

081116 12:21:12 [ERROR] Falcon must be compiled with C++ exceptions enabled to w
ork. Please adjust your compile flags.
[Falcon] Error: Falcon exiting process.

081116 12:21:12 - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

===========================================================================

The patch have been tested using Sun Studio compiler by adding -noex as a compile flag when compiling Falcon. 

Note that as the fix to Bug #39419 "Falcon should not be compiled if compiler or options do not support exceptions" a test will be added to configure that should prevent/reduce the risk for Falcon being compiled without support for C++ exceptions.
[11 Dec 2008 14:20] Bugs System
Pushed into 6.0.9-alpha  (revid:olav@sun.com-20081116113045-227pcjcb3afe5izz) (version source revid:hky@sun.com-20081127084516-nbu7693932vcz2st) (pib:5)
[13 Dec 2008 10:02] MC Brown
A note has been added to the 6.0.9 changelog: 

Starting MySQL with FALCON support when MySQL has not been compiled with a compiler supporting exceptions would lead to strange errors and results. MySQL will now fail to initialize if you have compiled without exceptions enabled with the following message:

081116 12:21:12 [ERROR] Falcon must be compiled with C++ exceptions enabled to work. Please adjust your compile flags.
[Falcon] Error: Falcon exiting process