Re: [Cppcms-users] Unmount asynchronous application from application pool
Brought to you by:
artyom-beilis
|
From: Lee E. <lee...@gm...> - 2013-11-18 20:01:25
|
i placed some comments in your original code according to artyom's comments let me know if this helps http://pastie.org/8490586 also bear in mind that placing io calls inside destructors is also a door to unexplained crashes - since if an exception is thrown that causes a destructor call, and that destructor generates another exception - your life of finding what went wrong are a lot smaller if you want to place IO inside your destructor, at least wrap them in try catch so that you will be able to find the original error more easily On Mon, Nov 18, 2013 at 7:35 PM, DieterM75 . <die...@gm...> wrote: > Well thanks for the really helpful reply (not). > > What about telling me what i CAN do instead and maybe putting it somewhere > on the wiki? > Would be helpful to others, too I guess. > > > On Sun, Nov 17, 2013 at 10:10 PM, Artyom Beilis <art...@ya...>wrote: > >> I can't just tell that you did something wrong. You did almost everything >> wrong >> >> YOU CAN NOT PUT ANY FUNCTION IN SIGNAL HANDLER, your function must be >> SIGNAL SAFE >> You can only call service->shutdown() as it is expicitly defined and >> SIGNAL SAFE. >> >> You can't throw exceptions from signal handlers >> you can't do I/O via iostream. and much just call shutdown and handle all >> you need when service::run() exits... >> >> >> Artyom Beilis >> -------------- >> CppCMS - C++ Web Framework: http://cppcms.com/ >> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> -------------------------------------------- >> On Fri, 11/15/13, DieterM75 . <die...@gm...> wrote: >> >> Subject: Re: [Cppcms-users] Unmount asynchronous application from >> application pool >> To: cpp...@li... >> Date: Friday, November 15, 2013, 8:11 PM >> >> Hey, >> >> I tried the following code: >> >> http://pastie.org/8483126 >> >> Output is as follows: >> >> >> >> 2013-11-15 >> 18:31:25; Activator, debug: Created service! >> (main.cpp:70) >> 2013-11-15 >> 18:31:25; App, debug: ctor (main.cpp:36) >> Exception! >> 2013-11-15 >> 18:31:28; App, debug: dtor (main.cpp:39) >> 2013-11-15 >> 18:31:48; main, debug: Restarting service! >> (main.cpp:106) >> 2013-11-15 >> 18:34:43; Activator, debug: Created service! >> (main.cpp:70) >> 2013-11-15 >> 18:34:43; Activator, debug: Created service! >> (main.cpp:70) >> 2013-11-15 >> 18:34:43; App, debug: ctor (main.cpp:36) >> 2013-11-15 >> 18:34:43; App, debug: ctor (main.cpp:36) >> Exception! >> 2013-11-15 >> 18:35:33; App, debug: dtor (main.cpp:39) >> 2013-11-15 >> 18:35:33; App, debug: dtor (main.cpp:39) >> 2013-11-15 >> 18:35:40; main, debug: Restarting service! >> (main.cpp:106) >> 2013-11-15 >> 18:35:40; main, debug: Restarting service! >> (main.cpp:106) >> 2013-11-15 >> 18:41:44; Activator, debug: Created service! >> (main.cpp:70) >> 2013-11-15 >> 18:41:44; Activator, debug: Created service! >> (main.cpp:70) >> 2013-11-15 >> 18:41:44; Activator, debug: Created service! >> (main.cpp:70) >> 2013-11-15 >> 18:41:44; App, debug: ctor (main.cpp:36) >> 2013-11-15 >> 18:41:44; App, debug: ctor (main.cpp:36) >> 2013-11-15 >> 18:41:44; App, debug: ctor (main.cpp:36) >> Exception! >> 2013-11-15 >> 18:41:58; App, debug: dtor (main.cpp:39) >> 2013-11-15 >> 18:41:58; App, debug: dtor (main.cpp:39) >> 2013-11-15 >> 18:41:58; App, debug: dtor (main.cpp:39) >> 2013-11-15 >> 18:43:16; main, debug: Restarting service! >> (main.cpp:106) >> 2013-11-15 >> 18:43:16; main, debug: Restarting service! >> (main.cpp:106) >> 2013-11-15 >> 18:43:16; main, debug: Restarting service! >> (main.cpp:106) >> 2013-11-15 >> 18:43:22; Activator, debug: Created service! >> (main.cpp:70) >> 2013-11-15 >> 18:43:22; Activator, debug: Created service! >> (main.cpp:70) >> 2013-11-15 >> 18:43:22; Activator, debug: Created service! >> (main.cpp:70) >> 2013-11-15 >> 18:43:22; Activator, debug: Created service! >> (main.cpp:70) >> 2013-11-15 >> 18:43:22; App, debug: ctor (main.cpp:36) >> 2013-11-15 >> 18:43:22; App, debug: ctor (main.cpp:36) >> 2013-11-15 >> 18:43:22; App, debug: ctor (main.cpp:36) >> 2013-11-15 >> 18:43:22; App, debug: ctor (main.cpp:36) >> Maybe someone sees the error in my code, I clearly >> dont :) >> >> >> >> Sincerely >> Dieter >> >> ---------- Forwarded >> message ---------- >> From: Artyom >> Beilis <art...@ya...> >> >> >> Date: Sat, Nov 9, 2013 at 12:54 PM >> Subject: Re: [Cppcms-users] Unmount asynchronous application >> from application pool >> To: cpp...@li... >> >> >> >> >> There two things. >> >> >> >> - The tutorial describes the situation were the ENTIRE >> cppcms service is reloaded. In case of pointers to >> asynchronous applications, you can reset them withing >> if(got_sighup) { ... } section. >> >> >> >> Additionally you can remove the asynchronous application by >> simply expiring its pointer. Once all the references (for >> example kept in callbacks) and your reference are expired it >> would be deleted. Asynchronous applications can be removed >> and added dynamically (unlike synchronous ones that only can >> be added) >> >> >> >> >> >> >> >> Artyom Beilis >> >> -------------- >> >> CppCMS - C++ Web Framework: http://cppcms.com/ >> >> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >> -------------------------------------------- >> >> On Fri, 11/8/13, DieterM75 . <die...@gm...> >> wrote: >> >> >> >> Subject: [Cppcms-users] Unmount asynchronous application >> from application pool >> >> To: cpp...@li... >> >> Date: Friday, November 8, 2013, 9:58 AM >> >> >> >> Hello, >> >> >> >> I mount my application via the >> mount(booster::intrusive_ptr) >> >> method of the application pool class. >> >> I also try to implement some kind of reload mechanism, >> >> so that the service can start over again after certain >> >> errors. >> >> >> >> The example "reload the application" ( >> http://cppcms.com/wikipp/en/page/cppcms_1x_reload_application) >> >> does not cover how to deal with asynchronous >> applications. >> >> If I pass an anonymous intrusive_ptr reference to the >> >> method, it gets created and destroyed immediately. Now if >> >> the signal gets handled and the service shutdown, the >> >> mounted application gets constructed and destroyed twice. >> >> Basically every time the signal is processed, the >> >> application pool does not automatically destroy the long >> >> running apps. >> >> >> >> Is there a way to avoid this problem? >> >> >> >> Sincerely >> >> Müller >> >> >> >> >> >> -----Inline Attachment Follows----- >> >> >> >> >> ------------------------------------------------------------------------------ >> >> November Webinars for C, C++, Fortran Developers >> >> Accelerate application performance with scalable >> programming >> >> models. Explore >> >> techniques for threading, error checking, porting, and >> >> tuning. Get the most >> >> from the latest Intel processors and coprocessors. See >> >> abstracts and register >> >> >> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk >> >> -----Inline Attachment Follows----- >> >> >> >> _______________________________________________ >> >> Cppcms-users mailing list >> >> Cpp...@li... >> >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> November Webinars for C, C++, Fortran Developers >> >> Accelerate application performance with scalable programming >> models. Explore >> >> techniques for threading, error checking, porting, and >> tuning. Get the most >> >> from the latest Intel processors and coprocessors. See >> abstracts and register >> >> >> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk >> >> _______________________________________________ >> >> Cppcms-users mailing list >> >> Cpp...@li... >> >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> >> >> -----Inline Attachment Follows----- >> >> >> ------------------------------------------------------------------------------ >> DreamFactory - Open Source REST & JSON Services for >> HTML5 & Native Apps >> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External >> API Access >> Free app hosting. Or install the open source package on any >> LAMP server. >> Sign up and see examples for AngularJS, jQuery, Sencha Touch >> and Native! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk >> -----Inline Attachment Follows----- >> >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> >> ------------------------------------------------------------------------------ >> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps >> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access >> Free app hosting. Or install the open source package on any LAMP server. >> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > > > ------------------------------------------------------------------------------ > Shape the Mobile Experience: Free Subscription > Software experts and developers: Be at the forefront of tech innovation. > Intel(R) Software Adrenaline delivers strategic insight and game-changing > conversations that shape the rapidly evolving mobile landscape. Sign up > now. > http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > -- -- lee Lee Elenbaas lee...@gm... |