You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Henrik Nordberg (JIRA)" <ax...@ws.apache.org> on 2005/07/05 20:15:13 UTC

[jira] Created: (AXISCPP-731) extern "C" functions throw exceptions

extern "C" functions throw exceptions
-------------------------------------

         Key: AXISCPP-731
         URL: http://issues.apache.org/jira/browse/AXISCPP-731
     Project: Axis-C++
        Type: Bug
  Components: Server - Apache module  
    Versions: current (nightly)    
    Reporter: Henrik Nordberg


The following functions defined as extern "C" throw exceptions:

In Axis.cpp:

int initialize_module (int bServer);
int uninitialize_module ();

Can these throws be changed to log to the Apache error_log and return a failure code?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (AXISCPP-731) extern "C" functions throw exceptions

Posted by "Chinthana Danapala (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXISCPP-731?page=all ]

Chinthana Danapala reassigned AXISCPP-731:
------------------------------------------

    Assign To: Chinthana Danapala

> extern "C" functions throw exceptions
> -------------------------------------
>
>          Key: AXISCPP-731
>          URL: http://issues.apache.org/jira/browse/AXISCPP-731
>      Project: Axis-C++
>         Type: Bug
>   Components: Server - Apache module
>     Versions: current (nightly)
>     Reporter: Henrik Nordberg
>     Assignee: Chinthana Danapala

>
> The following functions defined as extern "C" throw exceptions:
> In Axis.cpp:
> int initialize_module (int bServer);
> int uninitialize_module ();
> Can these throws be changed to log to the Apache error_log and return a failure code?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXISCPP-731) extern "C" functions throw exceptions

Posted by "John Hawkins (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-731?page=comments#action_12323266 ] 

John Hawkins commented on AXISCPP-731:
--------------------------------------

I think I've asked this question before but why is this a extern C function at all? Would it help if this were a CPP class?

> extern "C" functions throw exceptions
> -------------------------------------
>
>          Key: AXISCPP-731
>          URL: http://issues.apache.org/jira/browse/AXISCPP-731
>      Project: Axis-C++
>         Type: Bug
>   Components: Server - Apache module
>     Versions: current (nightly)
>     Reporter: Henrik Nordberg

>
> The following functions defined as extern "C" throw exceptions:
> In Axis.cpp:
> int initialize_module (int bServer);
> int uninitialize_module ();
> Can these throws be changed to log to the Apache error_log and return a failure code?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (AXISCPP-731) extern "C" functions throw exceptions

Posted by "Fred Preston (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXISCPP-731?page=all ]
     
Fred Preston closed AXISCPP-731:
--------------------------------


> extern "C" functions throw exceptions
> -------------------------------------
>
>          Key: AXISCPP-731
>          URL: http://issues.apache.org/jira/browse/AXISCPP-731
>      Project: Axis-C++
>         Type: Bug

>   Components: Server - Apache module
>     Versions: current (nightly)
>     Reporter: Henrik Nordberg
>     Assignee: Chinthana Danapala

>
> The following functions defined as extern "C" throw exceptions:
> In Axis.cpp:
> int initialize_module (int bServer);
> int uninitialize_module ();
> Can these throws be changed to log to the Apache error_log and return a failure code?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXISCPP-731) extern "C" functions throw exceptions

Posted by "Henrik Nordberg (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-731?page=comments#action_12324490 ] 

Henrik Nordberg commented on AXISCPP-731:
-----------------------------------------

Just wanted to add something here that I wrote to the list.

John Hawkins wrote:
> We really need to sort out this whole problem resolution thing. How any times have we seen emails like this !? 
> Any one got any clues as to what we can do ? 
 
Yes, I have some suggestions:
 
1. Solve http://issues.apache.org/jira/browse/AXISCPP-731 (this explains why "Apache crashes") by wrapping the code in 
 
int axis_handler_helper(request_rec* req_rec)
and
static void module_init(apr_pool_t* p, server_rec* svr_rec)
 
in mod_axis2.cpp (and correspondingly for the other "servers", but my guess is mod_axis2 is by far the most commenly used one), with try and catch, where the catch should look like this:

} catch(AxisException& e) {
    std::cerr << "An error occurred while Axis was initializing: " << e.what() << std::endl;
} catch(...) {
    std::cerr << "An unkown error occurred while Axis was initializing: " << e.what() << std::endl;
}
 
You will need to add two lines at the top of the file:
 
#include <iostream>
#include <axis/AxisException.hpp>

This will result in errors being written to Apache's access.log. There are other methods you can use to write to the error.log file too. But writing to stderr is convenient, and the main point is that we see the error message instead of a crash.
 
2. But wait, there is more! It turns out that the error messages for the common library loading problems that many have happening, do not include the name of the library being loaded. This can fixed this way:
Search the code for the string "Load lib error='%s' \n". Add to this string "Lib = '%s'", and make sure you include the path of the library after PLATFORM_LOADLIB_ERROR in the sprintf arg list. (Oh, and while you are at it you can replace sprintf() with std::string. And why is PLATFORM_GET_ERROR_MESSAGE() returning string* instead of string ??!!)
 
I did this at work and it works fine (I keep getting an error saying it can't find the xml parser lib, even though I have Xerces in the path). This code was from memory, but it should compile.
 
 - Henrik


> extern "C" functions throw exceptions
> -------------------------------------
>
>          Key: AXISCPP-731
>          URL: http://issues.apache.org/jira/browse/AXISCPP-731
>      Project: Axis-C++
>         Type: Bug
>   Components: Server - Apache module
>     Versions: current (nightly)
>     Reporter: Henrik Nordberg

>
> The following functions defined as extern "C" throw exceptions:
> In Axis.cpp:
> int initialize_module (int bServer);
> int uninitialize_module ();
> Can these throws be changed to log to the Apache error_log and return a failure code?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXISCPP-731) extern "C" functions throw exceptions

Posted by "Henrik Nordberg (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-731?page=comments#action_12318519 ] 

Henrik Nordberg commented on AXISCPP-731:
-----------------------------------------

Yes, returning a failure code on the server sounds good. But also, since the function is defined as extern "C", I don't know if you should throw exceptions at all (even on the client side).

Also, I wish the actual error string from the exception will reach the Apache error log.

> extern "C" functions throw exceptions
> -------------------------------------
>
>          Key: AXISCPP-731
>          URL: http://issues.apache.org/jira/browse/AXISCPP-731
>      Project: Axis-C++
>         Type: Bug
>   Components: Server - Apache module
>     Versions: current (nightly)
>     Reporter: Henrik Nordberg

>
> The following functions defined as extern "C" throw exceptions:
> In Axis.cpp:
> int initialize_module (int bServer);
> int uninitialize_module ();
> Can these throws be changed to log to the Apache error_log and return a failure code?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (AXISCPP-731) extern "C" functions throw exceptions

Posted by "Chinthana Danapala (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXISCPP-731?page=all ]
     
Chinthana Danapala resolved AXISCPP-731:
----------------------------------------

    Resolution: Fixed

Made the changes to captured errors being written to Apache's error.log.

> extern "C" functions throw exceptions
> -------------------------------------
>
>          Key: AXISCPP-731
>          URL: http://issues.apache.org/jira/browse/AXISCPP-731
>      Project: Axis-C++
>         Type: Bug
>   Components: Server - Apache module
>     Versions: current (nightly)
>     Reporter: Henrik Nordberg
>     Assignee: Chinthana Danapala

>
> The following functions defined as extern "C" throw exceptions:
> In Axis.cpp:
> int initialize_module (int bServer);
> int uninitialize_module ();
> Can these throws be changed to log to the Apache error_log and return a failure code?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXISCPP-731) extern "C" functions throw exceptions

Posted by "Samisa Abeysinghe (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-731?page=comments#action_12316835 ] 

Samisa Abeysinghe commented on AXISCPP-731:
-------------------------------------------

The functions
int initialize_module (int bServer);
int uninitialize_module (); 
are use by both client side as well as server side. The server side includes SimpleAxisServer. Hence writing to Apache error log is not sensible within these methods.

We could throw an exception if it is client side to be captured by the clinet implementation, and return a failure code if it is server side. The returned failure code could be captured by the Apache module and write to Apache error log

> extern "C" functions throw exceptions
> -------------------------------------
>
>          Key: AXISCPP-731
>          URL: http://issues.apache.org/jira/browse/AXISCPP-731
>      Project: Axis-C++
>         Type: Bug
>   Components: Server - Apache module
>     Versions: current (nightly)
>     Reporter: Henrik Nordberg

>
> The following functions defined as extern "C" throw exceptions:
> In Axis.cpp:
> int initialize_module (int bServer);
> int uninitialize_module ();
> Can these throws be changed to log to the Apache error_log and return a failure code?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXISCPP-731) extern "C" functions throw exceptions

Posted by "Henrik Nordberg (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-731?page=comments#action_12323268 ] 

Henrik Nordberg commented on AXISCPP-731:
-----------------------------------------

Those functions are called by Apache HTTPd, which specifies the funtion signatures.

> extern "C" functions throw exceptions
> -------------------------------------
>
>          Key: AXISCPP-731
>          URL: http://issues.apache.org/jira/browse/AXISCPP-731
>      Project: Axis-C++
>         Type: Bug
>   Components: Server - Apache module
>     Versions: current (nightly)
>     Reporter: Henrik Nordberg

>
> The following functions defined as extern "C" throw exceptions:
> In Axis.cpp:
> int initialize_module (int bServer);
> int uninitialize_module ();
> Can these throws be changed to log to the Apache error_log and return a failure code?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira