cppcms-users Mailing List for CppCMS C++ Web Framework (Page 45)
Brought to you by:
artyom-beilis
You can subscribe to this list here.
| 2009 |
Jan
|
Feb
(22) |
Mar
|
Apr
(3) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(15) |
Nov
(16) |
Dec
(13) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(4) |
Feb
|
Mar
(8) |
Apr
(8) |
May
(8) |
Jun
(36) |
Jul
(63) |
Aug
(126) |
Sep
(47) |
Oct
(66) |
Nov
(46) |
Dec
(42) |
| 2011 |
Jan
(87) |
Feb
(24) |
Mar
(54) |
Apr
(21) |
May
(22) |
Jun
(18) |
Jul
(22) |
Aug
(101) |
Sep
(57) |
Oct
(33) |
Nov
(34) |
Dec
(66) |
| 2012 |
Jan
(64) |
Feb
(76) |
Mar
(73) |
Apr
(105) |
May
(93) |
Jun
(83) |
Jul
(84) |
Aug
(88) |
Sep
(57) |
Oct
(59) |
Nov
(35) |
Dec
(49) |
| 2013 |
Jan
(67) |
Feb
(17) |
Mar
(49) |
Apr
(64) |
May
(87) |
Jun
(64) |
Jul
(93) |
Aug
(23) |
Sep
(15) |
Oct
(16) |
Nov
(62) |
Dec
(73) |
| 2014 |
Jan
(5) |
Feb
(23) |
Mar
(21) |
Apr
(11) |
May
(1) |
Jun
(19) |
Jul
(27) |
Aug
(16) |
Sep
(5) |
Oct
(37) |
Nov
(12) |
Dec
(9) |
| 2015 |
Jan
(7) |
Feb
(7) |
Mar
(44) |
Apr
(28) |
May
(5) |
Jun
(12) |
Jul
(8) |
Aug
|
Sep
(39) |
Oct
(34) |
Nov
(30) |
Dec
(34) |
| 2016 |
Jan
(66) |
Feb
(23) |
Mar
(33) |
Apr
(15) |
May
(11) |
Jun
(15) |
Jul
(26) |
Aug
(4) |
Sep
(1) |
Oct
(30) |
Nov
(10) |
Dec
|
| 2017 |
Jan
(52) |
Feb
(9) |
Mar
(24) |
Apr
(16) |
May
(9) |
Jun
(12) |
Jul
(33) |
Aug
(8) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
(6) |
| 2018 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(14) |
Jun
(1) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(8) |
Nov
(2) |
Dec
(2) |
| 2019 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
(6) |
Aug
(25) |
Sep
(10) |
Oct
(10) |
Nov
(6) |
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
(7) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(9) |
Oct
(1) |
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
|
From: CN <cn...@fa...> - 2013-11-23 04:16:09
|
Thank you for your patience explaining all my questions! Here I have one minor feedback regarding wording. Excerpt from [1]http://cppcms.com/wikipp/en/page/cppcms_1x_application_lifetime follows: "asynchronous applications are designed to handle multiple connections simultaneously, and thus instead of being called in the thread pool per each request, they run exclusively in the main [2]CppCMS Event Loop" Since asynchronous applications run in main thread and are event driven, shouldn't the word "simultaneously" be written as "sequentially" instead? Because asynchronous applications do not accept and process requests concurrently, requests must wait in line for processing. Asynchronous applications run in main thread and thus can never handle multiple connections simultaneously. They handle one connection at a time. If I do not understand this framework correctly, corrections are welcome and appreciated! Regards, CN On Fri, Nov 22, 2013, at 10:02 PM, Artyom Beilis wrote: (1) It is not a recursive call, the error: is function that eventually calls read_data. It is callback/lambda expression it is not collected on the stacl (2) The client can't "reset connection" between these calls. The event of "connection reset" is detected in the event loop. It is not "multi-threading" it is event driven programming. The reset connection can be called only once we exit this code snippet. (3) As I mentioned before it is not multithreaded program. Async-application run in the thread of the event loop. I suggest read following sections: [3]http://cppcms.com/wikipp/en/page/cppcms_1x_event_loop [4]http://cppcms.com/wikipp/en/page/cppcms_1x_application_lifetime [5]http://cppcms.com/wikipp/en/page/thread_safety Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ On Wednesday, November 20, 2013 3:04 PM, CN <cn...@fa...> wrote: (1) ~/examples/chat/the_chat.html: Lines 30 and 34 recursively call read_data(). Will these recursive calls eventually eat up stack memory? If they will, how to improve the code? ~/examples/chat/chat.cpp: (2) Line 64: waiters_.insert(); context->async_on_peer_reset() If the client resets connection between the above two calls, will it cause memory leak (although the leak is not serious because broadcast() will call waiters_.clear() eventually)? If it will, does swapping the orders of these two lines help? context->async_on_peer_reset() waiters_.insert(); (3) waiters_ manipulates its elements in get(), remove_context(), and broadcast(). Do we need to implement lock mechanism on waiters_ to ensure the code thread safe? If we do, how? I would appreciate your understanding that I am absolutely not finding fault with the example code. Rather, I am trying to learn as many as I can from it. Regards, CN -- [6]http://www.fastmail.fm - The way an email service should be ----------------------------------------------------------------------- ------- 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. [7]http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg .clktrk _______________________________________________ Cppcms-users mailing list [8]Cpp...@li... [9]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. [10]http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ost g.clktrk _______________________________________________ Cppcms-users mailing list [11]Cpp...@li... [12]https://lists.sourceforge.net/lists/listinfo/cppcms-users References 1. http://cppcms.com/wikipp/en/page/cppcms_1x_application_lifetime 2. http://cppcms.com/wikipp/en/page/cppcms_1x_event_loop 3. http://cppcms.com/wikipp/en/page/cppcms_1x_event_loop 4. http://cppcms.com/wikipp/en/page/cppcms_1x_application_lifetime 5. http://cppcms.com/wikipp/en/page/thread_safety 6. http://www.fastmail.fm/ 7. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk 8. mailto:Cpp...@li... 9. https://lists.sourceforge.net/lists/listinfo/cppcms-users 10. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk 11. mailto:Cpp...@li... 12. https://lists.sourceforge.net/lists/listinfo/cppcms-users -- http://www.fastmail.fm - A no graphics, no pop-ups email service |
|
From: CN <cn...@fa...> - 2013-11-23 03:02:10
|
Applications my_hello_world and chat are mounted under different application tree branches, How does my_hello_world acquire the reference of chat instance? I'ts good to know that cppcms::service::post() is not required in such case! Nevertheless, an example code demonstrating the usage of cppcms::service::post() would be greatly appreciated - just in case I will need to call it some other day! Regards, CN On Fri, Nov 22, 2013, at 10:05 PM, Artyom Beilis wrote: Just create some thread safe object that can keep the data you need (i.e. member functions that access it protected with mutexes/rw-locks). Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ On Friday, November 22, 2013 8:12 AM, CN <cn...@fa...> wrote: Hello! Imagine I have both synchronous and asynchronous applications mounted: int main(int argc,char ** argv) { try { cppcms::service srv(argc,argv); srv.applications_pool().mount(cppcms::applications_factory<my_hello_wor ld>()); booster::intrusive_ptr<chat> c=new chat(srv); service.applications_pool().mount(c); srv.run(); } catch(std::exception const &e) { std::cerr<<e.what()<<std::endl; } } Assume that std::vector<cppcms::json::value> messages_; in [1]http://cppcms.com/wikipp/en/page/cppcms_1x_chat_json_rpc is public. If I understand the framework correctly, asynchronous applications run in main thread. Therefore, asynchronous applications are appropriate candidates to keep cross-application data, messages_ in our example, that is to be shared by synchronous applications. I would like to know how to access messages_ kept in chat application from my_hello_world. I have read both [2]http://cppcms.com/wikipp/en/page/cppcms_1x_event_loop and [3]http://cppcms.com/cppcms_ref/latest/classcppcms_1_1service.html#a294 10e26d78c56c3f22389db5828cd0c but still have no idea how. Helps will be greatly appreciated. Regards, CN -- [4]http://www.fastmail.fm - Or how I learned to stop worrying and love email again ----------------------------------------------------------------------- ------- 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. [5]http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg .clktrk _______________________________________________ Cppcms-users mailing list [6]Cpp...@li... [7]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. [8]http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg .clktrk _______________________________________________ Cppcms-users mailing list [9]Cpp...@li... [10]https://lists.sourceforge.net/lists/listinfo/cppcms-users References 1. http://cppcms.com/wikipp/en/page/cppcms_1x_chat_json_rpc 2. http://cppcms.com/wikipp/en/page/cppcms_1x_event_loop 3. http://cppcms.com/cppcms_ref/latest/classcppcms_1_1service.html#a29410e26d78c56c3f22389db5828cd0c 4. http://www.fastmail.fm/ 5. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk 6. mailto:Cpp...@li... 7. https://lists.sourceforge.net/lists/listinfo/cppcms-users 8. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk 9. mailto:Cpp...@li... 10. https://lists.sourceforge.net/lists/listinfo/cppcms-users -- http://www.fastmail.fm - Access all of your messages and folders wherever you are |
|
From: Artyom B. <art...@ya...> - 2013-11-22 14:05:16
|
Just create some thread safe object that can keep the data you need (i.e. member functions that access it protected with mutexes/rw-locks). Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ On Friday, November 22, 2013 8:12 AM, CN <cn...@fa...> wrote: Hello! > >Imagine I have both synchronous and asynchronous applications mounted: > >int main(int argc,char ** argv) >{ > try { > cppcms::service srv(argc,argv); > > srv.applications_pool().mount(cppcms::applications_factory<my_hello_world>()); > > booster::intrusive_ptr<chat> c=new chat(srv); > service.applications_pool().mount(c); > > srv.run(); > } > catch(std::exception const &e) { > std::cerr<<e.what()<<std::endl; > } >} > >Assume that >std::vector<cppcms::json::value> messages_; >in >http://cppcms.com/wikipp/en/page/cppcms_1x_chat_json_rpc >is public. > >If I understand the framework correctly, asynchronous applications run >in main thread. Therefore, asynchronous applications are appropriate >candidates to keep cross-application data, messages_ in our example, >that is to be shared by synchronous applications. > >I would like to know how to access messages_ kept in chat application >from my_hello_world. I have read both > >http://cppcms.com/wikipp/en/page/cppcms_1x_event_loop > >and > >http://cppcms.com/cppcms_ref/latest/classcppcms_1_1service.html#a29410e26d78c56c3f22389db5828cd0c > >but still have no idea how. Helps will be greatly appreciated. > >Regards, >CN > >-- >http://www.fastmail.fm - Or how I learned to stop worrying and > love email again > > >------------------------------------------------------------------------------ >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 > > > |
|
From: Artyom B. <art...@ya...> - 2013-11-22 14:02:38
|
(1) It is not a recursive call, the error: is function that eventually calls read_data. It is callback/lambda expression it is not collected on the stacl (2) The client can't "reset connection" between these calls. The event of "connection reset" is detected in the event loop. It is not "multi-threading" it is event driven programming. The reset connection can be called only once we exit this code snippet. (3) As I mentioned before it is not multithreaded program. Async-application run in the thread of the event loop. I suggest read following sections: http://cppcms.com/wikipp/en/page/cppcms_1x_event_loop http://cppcms.com/wikipp/en/page/cppcms_1x_application_lifetime http://cppcms.com/wikipp/en/page/thread_safety Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ On Wednesday, November 20, 2013 3:04 PM, CN <cn...@fa...> wrote: (1) ~/examples/chat/the_chat.html: >Lines 30 and 34 recursively call read_data(). Will these recursive calls >eventually eat up stack memory? If they will, how to improve the code? > >~/examples/chat/chat.cpp: > >(2) Line 64: >waiters_.insert(); >context->async_on_peer_reset() > >If the client resets connection between the above two calls, will it >cause memory leak (although the leak is not serious because broadcast() >will call waiters_.clear() eventually)? If it will, does swapping the >orders of these two lines help? > >context->async_on_peer_reset() >waiters_.insert(); > > > >(3) waiters_ manipulates its elements in get(), remove_context(), and >broadcast(). Do we need to implement lock mechanism on waiters_ to >ensure the code thread safe? If we do, how? > >I would appreciate your understanding that I am absolutely not finding >fault with the example code. Rather, I am trying to learn as many as I >can from it. > >Regards, >CN > >-- >http://www.fastmail.fm - The way an email service should be > > >------------------------------------------------------------------------------ >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 > > > |
|
From: Artyom B. <art...@ya...> - 2013-11-22 13:54:43
|
I don't really understand what are you trying to do.... Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ On Tuesday, November 19, 2013 11:01 PM, DieterM75 . <die...@gm...> wrote: Thanks, > >after reading some notes about signals and combining it with your snippets, it seems to work now. > >Would be grateful to get an opinion on the code from you (http://pastie.org/8493685). > > >Sincerely >Dieter > > > > >On Tue, Nov 19, 2013 at 9:13 AM, Artyom Beilis <art...@ya...> wrote: > > >> >>On Tuesday, November 19, 2013 10:05 AM, Artyom Beilis <art...@ya...> wrote: >> >>What handler to be called? >>> >>> >>>I assume you are working on linux. If you want to reload the application/system per SIGHUP you need >>>create appropriate singal handler. Signals are not just callbacks, they are very different. They do stuff differently. >>> >>> >>>Also I'm not even sure about what are you trying to do. >>> >>> >>>See this is the original code: >>> >>> >>> while(1) { >>> cppcms::service srv(...) >>> srv.run(); >>> if(got_sighup) { >>> got_sighup = false; >>> continue; >>> } >>> break; >>> } >>> >>> >>> >>> >>>Now lets say you want to add an async application: >>> >>> >>> while(1) { >>> booster::intrusive_ptr<myapp> p(new myapp) >>> cppcms::service srv(...) >>> srv.mount(p,...) >>> srv.run(); >>> p = 0; // reset there... >>> if(got_sighup) { >>> got_sighup = false; >>> continue; >>> >>> } >>> break; >>> } >>> >>> >>>Thats it... How hard can it be? >>> >>> >>>Artyom Beilis >>>-------------- >>>CppCMS - C++ Web Framework: http://cppcms.com/ >>>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >>> >>> >>> >>>On Monday, November 18, 2013 11:45 PM, DieterM75 . <die...@gm...> wrote: >>> >>> >>>>Thanks for your answers, I appreciate it! >>>> >>>>If you believe it or not, I have read every single page on the wiki and tried to understand the application pool and the service class. The thing is, most of it is written very minimalistic. And I can understand it, time is valuable. I am writing managed code for a living and I also want to learn, try things out and in the end understand the framework, but I sure get stuck without some input. >>>> >>>>For instance the handler code on page "Reload the application" cannot compile, because no return type is specified. Furthermore I had a look inside the application base class and there is no potential handler method that could be overridden. So how is it supposed to get called? >>>> >>>> >>>> >>>>Sincerely >>>> >>>> >>>> >>>> >>>>On Mon, Nov 18, 2013 at 10:04 PM, Artyom Beilis <art...@ya...> wrote: >>>> >>>>> Well thanks for the really helpful reply (not). >>>>> >>>>>First of all, instead of being sarcastic I'd suggest you to read... manual pages about signal handling and understand how the code in wiki works and why, also read about cppcms::service::shutdown, read about the event loop in the wiki and so on. >>>>> >>>>>As I told you, your pattern is wrong, you should be based on the pattern in wiki. >>>>> >>>>>What is wrong: >>>>> >>>>>- wrong signal handler >>>>>- wrong exception implementation >>>>>- wrong assumption about how exceptions are handled... etc >>>>> >>>>>Instead reinventing the wheel, do as I told you in the previous mails, all you need to reset the application pointer when the srv.run() exits, before you restart the service. >>>>> >>>>> >>>>> >>>>> >>>>>------------------------------------------------------------------------------ >>>>>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 >>>>> >>>> >>>> >>>>------------------------------------------------------------------------------ >>>>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 >>>> >>>> >>>> >>> >>> >>------------------------------------------------------------------------------ >>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 >> >> > > > |
|
From: CN <cn...@fa...> - 2013-11-22 06:12:15
|
Hello!
Imagine I have both synchronous and asynchronous applications mounted:
int main(int argc,char ** argv)
{
try {
cppcms::service srv(argc,argv);
srv.applications_pool().mount(cppcms::applications_factory<my_hello_world>());
booster::intrusive_ptr<chat> c=new chat(srv);
service.applications_pool().mount(c);
srv.run();
}
catch(std::exception const &e) {
std::cerr<<e.what()<<std::endl;
}
}
Assume that
std::vector<cppcms::json::value> messages_;
in
http://cppcms.com/wikipp/en/page/cppcms_1x_chat_json_rpc
is public.
If I understand the framework correctly, asynchronous applications run
in main thread. Therefore, asynchronous applications are appropriate
candidates to keep cross-application data, messages_ in our example,
that is to be shared by synchronous applications.
I would like to know how to access messages_ kept in chat application
from my_hello_world. I have read both
http://cppcms.com/wikipp/en/page/cppcms_1x_event_loop
and
http://cppcms.com/cppcms_ref/latest/classcppcms_1_1service.html#a29410e26d78c56c3f22389db5828cd0c
but still have no idea how. Helps will be greatly appreciated.
Regards,
CN
--
http://www.fastmail.fm - Or how I learned to stop worrying and
love email again
|
|
From: CN <cn...@fa...> - 2013-11-20 13:04:00
|
(1) ~/examples/chat/the_chat.html: Lines 30 and 34 recursively call read_data(). Will these recursive calls eventually eat up stack memory? If they will, how to improve the code? ~/examples/chat/chat.cpp: (2) Line 64: waiters_.insert(); context->async_on_peer_reset() If the client resets connection between the above two calls, will it cause memory leak (although the leak is not serious because broadcast() will call waiters_.clear() eventually)? If it will, does swapping the orders of these two lines help? context->async_on_peer_reset() waiters_.insert(); (3) waiters_ manipulates its elements in get(), remove_context(), and broadcast(). Do we need to implement lock mechanism on waiters_ to ensure the code thread safe? If we do, how? I would appreciate your understanding that I am absolutely not finding fault with the example code. Rather, I am trying to learn as many as I can from it. Regards, CN -- http://www.fastmail.fm - The way an email service should be |
|
From: DieterM75 . <die...@gm...> - 2013-11-19 21:02:00
|
Thanks, after reading some notes about signals and combining it with your snippets, it seems to work now. Would be grateful to get an opinion on the code from you ( http://pastie.org/8493685). Sincerely Dieter On Tue, Nov 19, 2013 at 9:13 AM, Artyom Beilis <art...@ya...> wrote: > > On Tuesday, November 19, 2013 10:05 AM, Artyom Beilis < > art...@ya...> wrote: > > What handler to be called? > > I assume you are working on linux. If you want to reload the > application/system per SIGHUP you need > create appropriate singal handler. Signals are not just callbacks, they > are very different. They do stuff differently. > > Also I'm not even sure about what are you trying to do. > > See this is the original code: > > while(1) { > cppcms::service srv(...) > srv.run(); > if(got_sighup) { > got_sighup = false; > continue; > } > break; > } > > > Now lets say you want to add an async application: > > while(1) { > booster::intrusive_ptr<myapp> p(new myapp) > cppcms::service srv(...) > srv.mount(p,...) > srv.run(); > p = 0; // reset there... > if(got_sighup) { > got_sighup = false; > continue; > } > break; > } > > Thats it... How hard can it be? > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com > /sql/cppdb/ > > > On Monday, November 18, 2013 11:45 PM, DieterM75 . <die...@gm...> > wrote: > > > Thanks for your answers, I appreciate it! > > If you believe it or not, I have read every single page on the wiki and > tried to understand the application pool and the service class. The thing > is, most of it is written very minimalistic. And I can understand it, time > is valuable. I am writing managed code for a living and I also want to > learn, try things out and in the end understand the framework, but I sure > get stuck without some input. > > For instance the handler code on page "Reload the application" cannot > compile, because no return type is specified. Furthermore I had a look > inside the application base class and there is no potential handler method > that could be overridden. So how is it supposed to get called? > > Sincerely > > > On Mon, Nov 18, 2013 at 10:04 PM, Artyom Beilis <art...@ya...>wrote: > > > Well thanks for the really helpful reply (not). > > First of all, instead of being sarcastic I'd suggest you to read... manual > pages about signal handling and understand how the code in wiki works and > why, also read about cppcms::service::shutdown, read about the event loop > in the wiki and so on. > > As I told you, your pattern is wrong, you should be based on the pattern > in wiki. > > What is wrong: > > - wrong signal handler > - wrong exception implementation > - wrong assumption about how exceptions are handled... etc > > Instead reinventing the wheel, do as I told you in the previous mails, all > you need to reset the application pointer when the srv.run() exits, before > you restart the service. > > > > > ------------------------------------------------------------------------------ > 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 > > > > > ------------------------------------------------------------------------------ > 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 > > > > > > > ------------------------------------------------------------------------------ > 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 > > |
|
From: Artyom B. <art...@ya...> - 2013-11-19 08:13:11
|
On Tuesday, November 19, 2013 10:05 AM, Artyom Beilis <art...@ya...> wrote:
What handler to be called?
>
>
>I assume you are working on linux. If you want to reload the application/system per SIGHUP you need
>create appropriate singal handler. Signals are not just callbacks, they are very different. They do stuff differently.
>
>
>Also I'm not even sure about what are you trying to do.
>
>
>See this is the original code:
>
>
> while(1) {
> cppcms::service srv(...)
> srv.run();
> if(got_sighup) {
> got_sighup = false;
> continue;
> }
> break;
> }
>
>
>
>
>Now lets say you want to add an async application:
>
>
> while(1) {
> booster::intrusive_ptr<myapp> p(new myapp)
> cppcms::service srv(...)
> srv.mount(p,...)
> srv.run();
> p = 0; // reset there...
> if(got_sighup) {
> got_sighup = false;
> continue;
>
> }
> break;
> }
>
>
>Thats it... How hard can it be?
>
>
>Artyom Beilis
>--------------
>CppCMS - C++ Web Framework: http://cppcms.com/
>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>
>
>
>On Monday, November 18, 2013 11:45 PM, DieterM75 . <die...@gm...> wrote:
>
>
>>Thanks for your answers, I appreciate it!
>>
>>If you believe it or not, I have read every single page on the wiki and tried to understand the application pool and the service class. The thing is, most of it is written very minimalistic. And I can understand it, time is valuable. I am writing managed code for a living and I also want to learn, try things out and in the end understand the framework, but I sure get stuck without some input.
>>
>>For instance the handler code on page "Reload the application" cannot compile, because no return type is specified. Furthermore I had a look inside the application base class and there is no potential handler method that could be overridden. So how is it supposed to get called?
>>
>>
>>
>>Sincerely
>>
>>
>>
>>
>>On Mon, Nov 18, 2013 at 10:04 PM, Artyom Beilis <art...@ya...> wrote:
>>
>>> Well thanks for the really helpful reply (not).
>>>
>>>First of all, instead of being sarcastic I'd suggest you to read... manual pages about signal handling and understand how the code in wiki works and why, also read about cppcms::service::shutdown, read about the event loop in the wiki and so on.
>>>
>>>As I told you, your pattern is wrong, you should be based on the pattern in wiki.
>>>
>>>What is wrong:
>>>
>>>- wrong signal handler
>>>- wrong exception implementation
>>>- wrong assumption about how exceptions are handled... etc
>>>
>>>Instead reinventing the wheel, do as I told you in the previous mails, all you need to reset the application pointer when the srv.run() exits, before you restart the service.
>>>
>>>
>>>
>>>
>>>------------------------------------------------------------------------------
>>>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
>>>
>>
>>
>>------------------------------------------------------------------------------
>>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
>>
>>
>>
>
> |
|
From: Artyom B. <art...@ya...> - 2013-11-19 08:05:59
|
What handler to be called?
I assume you are working on linux. If you want to reload the application/system per SIGHUP you need
create appropriate singal handler. Signals are not just callbacks, they are very different. They do stuff differently.
Also I'm not even sure about what are you trying to do.
See this is the original code:
while(1) {
cppcms::service srv(...)
srv.run();
if(got_sighup) {
got_sighup = false;
continue;
}
break;
}
Now lets say you want to add an async application:
while(1) {
booster::intrusive_ptr<myapp> p(new myapp)
cppcms::service srv(...)
srv.mount(p,...)
srv.run();
p = 0; // reset there...
if(got_sighup) {
got_sighup = false;
continue;
}
break;
}
Thats it... How hard can it be?
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
On Monday, November 18, 2013 11:45 PM, DieterM75 . <die...@gm...> wrote:
>Thanks for your answers, I appreciate it!
>
>If you believe it or not, I have read every single page on the wiki and tried to understand the application pool and the service class. The thing is, most of it is written very minimalistic. And I can understand it, time is valuable. I am writing managed code for a living and I also want to learn, try things out and in the end understand the framework, but I sure get stuck without some input.
>
>For instance the handler code on page "Reload the application" cannot compile, because no return type is specified. Furthermore I had a look inside the application base class and there is no potential handler method that could be overridden. So how is it supposed to get called?
>
>
>
>Sincerely
>
>
>
>
>On Mon, Nov 18, 2013 at 10:04 PM, Artyom Beilis <art...@ya...> wrote:
>
>> Well thanks for the really helpful reply (not).
>>
>>First of all, instead of being sarcastic I'd suggest you to read... manual pages about signal handling and understand how the code in wiki works and why, also read about cppcms::service::shutdown, read about the event loop in the wiki and so on.
>>
>>As I told you, your pattern is wrong, you should be based on the pattern in wiki.
>>
>>What is wrong:
>>
>>- wrong signal handler
>>- wrong exception implementation
>>- wrong assumption about how exceptions are handled... etc
>>
>>Instead reinventing the wheel, do as I told you in the previous mails, all you need to reset the application pointer when the srv.run() exits, before you restart the service.
>>
>>
>>
>>
>>------------------------------------------------------------------------------
>>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
>>
>
>
>------------------------------------------------------------------------------
>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
>
>
> |
|
From: DieterM75 . <die...@gm...> - 2013-11-18 21:45:36
|
Thanks for your answers, I appreciate it! If you believe it or not, I have read every single page on the wiki and tried to understand the application pool and the service class. The thing is, most of it is written very minimalistic. And I can understand it, time is valuable. I am writing managed code for a living and I also want to learn, try things out and in the end understand the framework, but I sure get stuck without some input. For instance the handler code on page "Reload the application" cannot compile, because no return type is specified. Furthermore I had a look inside the application base class and there is no potential handler method that could be overridden. So how is it supposed to get called? Sincerely On Mon, Nov 18, 2013 at 10:04 PM, Artyom Beilis <art...@ya...> wrote: > > Well thanks for the really helpful reply (not). > > First of all, instead of being sarcastic I'd suggest you to read... manual > pages about signal handling and understand how the code in wiki works and > why, also read about cppcms::service::shutdown, read about the event loop > in the wiki and so on. > > As I told you, your pattern is wrong, you should be based on the pattern > in wiki. > > What is wrong: > > - wrong signal handler > - wrong exception implementation > - wrong assumption about how exceptions are handled... etc > > Instead reinventing the wheel, do as I told you in the previous mails, all > you need to reset the application pointer when the srv.run() exits, before > you restart the service. > > > > > ------------------------------------------------------------------------------ > 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 > |
|
From: Artyom B. <art...@ya...> - 2013-11-18 21:04:11
|
> Well thanks for the really helpful reply (not). First of all, instead of being sarcastic I'd suggest you to read... manual pages about signal handling and understand how the code in wiki works and why, also read about cppcms::service::shutdown, read about the event loop in the wiki and so on. As I told you, your pattern is wrong, you should be based on the pattern in wiki. What is wrong: - wrong signal handler - wrong exception implementation - wrong assumption about how exceptions are handled... etc Instead reinventing the wheel, do as I told you in the previous mails, all you need to reset the application pointer when the srv.run() exits, before you restart the service. |
|
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... |
|
From: DieterM75 . <die...@gm...> - 2013-11-18 17:35:57
|
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 > |
|
From: Ronnie C. <ron...@db...> - 2013-11-18 09:35:05
|
Hi I'm trying to achieve the following piece of functionality. I have a std::map with some keys, and a 2nd map with more keys. If the 2nd map has a key from the first map then I want to iterate over the values. I've done the following which works but is a bit hackish. I created a tmp variable that's assigned per loop so that it can be accessed from the foreach. Ideally I'd want to get rid of the C++ section completely. I'm guessing there probably is a way but I've just missed it Any thoughts? My Content looks like // Fields std::map<std::string,std::vector<std::string>> rms_fields; std::map<std::string,std::vector<std::string>> xdb_fields; // Tmp needed for cppcms foreach std::vector<std::string> tmp_fields; And tmpl file <% foreach pair in rms_fields %> <% item %> <!-- If field is in both rms and xdb then display across --> <% if (content.xdb_fields.find(pair.first) == content.xdb_fields.end()) %> <tr><td><%= pair.first %> </td> <% foreach field in pair.second %> <% item %> <td><%= field %></td> <% end %> <% end %> <td>-></td> <td>XDB Trade</td> </tr> <% else %> <!-- Display the RMS fields first --> <tr><td><%= pair.first %> </td> <% foreach field in pair.second %> <% item %> <td><%= field %></td> <% end %> <% end %> <td>-></td> <!-- Then the XDB fields, I create a temporary variable in my content data structure in order to be able to access it here but really I was to use it as a value in the "in" statement of the foreach below. --> <% c++ content.tmp_fields = content.xdb_fields.find(pair.first)->second; %> <% foreach field in tmp_fields %> <% item %> <td><%= field %></td> <% end %> <% end %> </tr> <% end %> <% end %> <% end %> Thanks Kind Regards Ronnie |
|
From: Artyom B. <art...@ya...> - 2013-11-17 21:10:38
|
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 |
|
From: Le Ba <hma...@gm...> - 2013-11-17 15:38:35
|
Hi, I think when the reference goes null with app.release() normally all object are deleted but I don't know if the usage of applications_pool() is correct or not. Your opinion Artyom??? Sincerely. 2013/11/17 DieterM75 . <die...@gm...> > Thanks for the hint! > > I sure was calling service.run twice... > > Nontheless I removed the call in the while loop, but I still get multiple > messages written to the console. Is it possible that the service does not > get stopped properly and its threads keep on running? If so, how can I > securely delete my service object with all its threads? I thought > I could use it the 'RAII' way... > > Sincerely > Dieter > > > On Sun, Nov 17, 2013 at 11:39 AM, Le Ba <hma...@gm...> wrote: > >> Excuse my poor English. I mean: I assume that you no longer need call >> service.run () again in "while" block in "main". you have called >> service.run () in the Activator constructor >> >> >> 2013/11/15 DieterM75 . <die...@gm...> >> >>> 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 >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> 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 >>> >>> >> >> >> ------------------------------------------------------------------------------ >> 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 >> >> > > > ------------------------------------------------------------------------------ > 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 > > |
|
From: DieterM75 . <die...@gm...> - 2013-11-17 11:36:18
|
Thanks for the hint! I sure was calling service.run twice... Nontheless I removed the call in the while loop, but I still get multiple messages written to the console. Is it possible that the service does not get stopped properly and its threads keep on running? If so, how can I securely delete my service object with all its threads? I thought I could use it the 'RAII' way... Sincerely Dieter On Sun, Nov 17, 2013 at 11:39 AM, Le Ba <hma...@gm...> wrote: > Excuse my poor English. I mean: I assume that you no longer need call > service.run () again in "while" block in "main". you have called > service.run () in the Activator constructor > > > 2013/11/15 DieterM75 . <die...@gm...> > >> 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 >> >> >> >> ------------------------------------------------------------------------------ >> 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 >> >> > > > ------------------------------------------------------------------------------ > 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 > > |
|
From: Le Ba <hma...@gm...> - 2013-11-17 10:39:39
|
Excuse my poor English. I mean: I assume that you no longer need call service.run () again in "while" block in "main". you have called service.run () in the Activator constructor 2013/11/15 DieterM75 . <die...@gm...> > 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 > > > > ------------------------------------------------------------------------------ > 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 > > |
|
From: Le Ba <hma...@gm...> - 2013-11-17 10:36:57
|
Hi, I assume that you no longer need appaler service.run () again in "while" block in "main". I have called service.run () in the Activator constructor. Sincerely. 2013/11/15 DieterM75 . <die...@gm...> > 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 > > > > ------------------------------------------------------------------------------ > 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 > > |
|
From: DieterM75 . <die...@gm...> - 2013-11-15 18:11:44
|
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 |
|
From: Artyom B. <art...@ya...> - 2013-11-09 11:54:48
|
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
|
|
From: DieterM75 . <die...@gm...> - 2013-11-08 07:58:14
|
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 |
|
From: Artyom B. <art...@ya...> - 2013-10-24 19:27:25
|
Thanks... Good to know. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ -------------------------------------------- On Thu, 10/24/13, Sergei <ser...@gm...> wrote: Subject: Re: [Cppcms-users] async_flush_output and multipart/x_mixed_replace To: cpp...@li... Date: Thursday, October 24, 2013, 7:06 PM FastCGI buffering option is fixed. fastcgi_buffering off; http://trac.nginx.org/nginx/ticket/159 ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
|
From: Sergei <ser...@gm...> - 2013-10-24 17:06:45
|
FastCGI buffering option is fixed. fastcgi_buffering off; http://trac.nginx.org/nginx/ticket/159 |