Hi all.

From this snippet:

Wt::WApplication *createApplication(const Wt::WEnvironment& env) { Wt::WApplication* app = new Application(env); return app; } int main(int argc, char **argv) { _malloc_options = "X"; return Wt::WRun(argc, argv, &createApplication); }
where Application is derived from Wt::WApplication.


I've faced a problem when exception is thrown from Application constructor on undefined conditions and not easy reproducible.


Below is what Wt shows me:
[2009-May-09 14:11:57.795562] 15553 - [notice] "Wt: initializing built-in httpd" [2009-May-09 14:11:57.795937] 15553 - [notice] "Reading Wt config file: /usr/local/etc/wt_config.xml (location = '../build/gui/manager/manager')" [2009-May-09 14:11:57.797076] 15553 - [notice] "Starting server: http://0.0.0.0:8080"; [2009-May-09 14:12:03.306825] 15553 [/ GH5fhrq5J6wWgQe6] [notice] "Session created (#sessions = 1)" 127.0.0.1 - - [2009-May-09 14:12:03.308593] "GET /?wtd=4lsL HTTP/1.1" 200 1692 127.0.0.1 - - [2009-May-09 14:12:03.385447] "GET /?wtd=GH5fhrq5J6wWgQe6 HTTP/1.1" 200 1693 [2009-May-09 14:12:11.187771] 15553 [/ GH5fhrq5J6wWgQe6] [fatal] "std::bad_alloc" 127.0.0.1 - - [2009-May-09 14:12:11.189939] "GET /?wtd=GH5fhrq5J6wWgQe6&js=yes&ajax=yes&request=script&rand=2012640305 HTTP/1.1" 200 67 [2009-May-09 14:12:11.190813] 15553 [/ GH5fhrq5J6wWgQe6] [notice] "Session destroyed (#sessions = 0)"


There is some bad memory allocation (out of system memory), but Wt just catches exception and displays error.
For developer it's not much useful.

There should be a core dump to debug with GDB.
I propose to remove catching non-Wt exceptions.


--
Andrii Arsirii
Streamco
http://streamco.org.ua

Index: src/web/WebController.C
===================================================================
--- src/web/WebController.C	(revision 2880)
+++ src/web/WebController.C	(working copy)
@@ -805,17 +805,6 @@
     handler.killSession();
     session->renderer().serveError(*handler.request(), e, type);
 
-  } catch (std::exception& e) {
-    session->log("fatal") << e.what();
-
-    handler.killSession();
-    session->renderer().serveError(*handler.request(), e, type);
-  } catch (...) {
-    session->log("fatal") << "Unknown exception.";
-
-    handler.killSession();
-    session->renderer().serveError(*handler.request(),
-				   std::string("Unknown exception"), type);
   }
 
   if (handler.sessionDead()) {
Index: src/web/WebSession.C
===================================================================
--- src/web/WebSession.C	(revision 2880)
+++ src/web/WebSession.C	(working copy)
@@ -254,15 +254,8 @@
 
 bool WebSession::start(WApplication::ApplicationCreator createApplication)
 {
-  try {
-    app_ = createApplication(env_);
-  } catch (...) {
-    app_ = 0;
+  app_ = createApplication(env_);
 
-    kill();
-    throw;
-  }
-
   if (app_)
     app_->initialize();
 
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to