cppcms-users Mailing List for CppCMS C++ Web Framework (Page 17)
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
|
From: mawan s. <ma...@gm...> - 2016-06-27 10:59:01
|
sometimes we found 0 parameters ( message board example), what is it mean (espescially for 0 parameters, not 1)? On Jun 27, 2016 5:40 PM, "Vinicius Pavanelli" <ds...@ha...> wrote: > It's regular expressions. > > When you say "/number/(\\d+)" you mean to check for strings starting with > /number/ and capture all numbers following it "(\\d+)", the 1 after is to > pass this parameter. > > When you say ".*" it means every strings, as "." match every char and * > means any number of it, the 0 means it will not pass arguments as it don't > capture nothing. > > If you are still lost, look for a tutorial on regexp or regular expression > on the net. > > The pointer is the &hello::number part, a pointer to a function, and you > must pass this as it's a function of a class. > > Hope this helps, > Vinicius > > On 26-06-2016 06:57, mawan sugiyanto wrote: > > Dear All > > what is different between : > some time we meet example : > > dispatcher().assign("/number/(\\d+)",&hello::number,this,1); > > and > > dispatcher().assign(".*",&dashboard::prepare,this,0); > > is 0 or 1 is pointer only or we have too fill with parameters start from 1? > > thankyou > > > mawan > > > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today.http://sdm.link/attshape <https://u3143608.ct.sendgrid.net/wf/click?upn=XKgXTBnynYc51QNK-2FVhLWGHEVgnlGmLptX1YaZ-2FDzWM-3D_QqpctyXzj3McV7nyWd3l9m7lCO1pRhWOf-2FT5RqYYs597RjT9wvGhEJXv4m7jZD-2BEYUwavzgRUkWhGzCT6bHX2aUYfDFcqGqm2Ube6mhSkTXYnfrP7bSWUz9kg-2F9Wc3NS6LXQ-2Bg-2FnU3OgAaWNnAPZOQtzRu6Qh6-2BI6mHLs3hF8-2FfLcUUbXQ0nwpRTe2zPUuTFLWtxJngNofzZJ-2FYufz6OAsmMHOTBYZ2Ji3-2B62MEMpTM-3D> > > > > _______________________________________________ > Cppcms-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/cppcms-users <https://u3143608.ct.sendgrid.net/wf/click?upn=-2F8o2SEPnO8o0gkz01Z4rS-2BVz-2BkzajgLQzAoqRKlFQZMZV23PrrGQX1Y-2FnO6KyV7Cg6qnA3jfnwVVC-2BvfFaL4kRlo5qTOuSuNLjAJ4aI-2BCTA-3D_QqpctyXzj3McV7nyWd3l9m7lCO1pRhWOf-2FT5RqYYs597RjT9wvGhEJXv4m7jZD-2BEYUwavzgRUkWhGzCT6bHX2d8AA67eJHjVzt2yeIO8pS1b0GQNMv-2FZnHWi1C42hwT9DyfI48AtiAUdI7EMIxEqGuvso2CoI32GvyIPnV3hEwgOtM8a2fV-2BdACJ-2FtMf4kkTM9RvYbBDMje22zuX2JxBhZlYBJ1b1TfFeyt1ZFxrYd4-3D> > > > > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
From: Vinicius P. <ds...@ha...> - 2016-06-27 10:39:47
|
It's regular expressions. When you say "/number/(\\d+)" you mean to check for strings starting with /number/ and capture all numbers following it "(\\d+)", the 1 after is to pass this parameter. When you say ".*" it means every strings, as "." match every char and * means any number of it, the 0 means it will not pass arguments as it don't capture nothing. If you are still lost, look for a tutorial on regexp or regular expression on the net. The pointer is the &hello::number part, a pointer to a function, and you must pass this as it's a function of a class. Hope this helps, Vinicius On 26-06-2016 06:57, mawan sugiyanto wrote: > Dear All > > what is different between : > some time we meet example : > > dispatcher().assign("/number/(\\d+)",&hello::number,this,1); > > and > > dispatcher().assign(".*",&dashboard::prepare,this,0); > > is 0 or 1 is pointer only or we have too fill with parameters start > from 1? > > thankyou > > > mawan > > > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > https://u3143608.ct.sendgrid.net/wf/click?upn=XKgXTBnynYc51QNK-2FVhLWGHEVgnlGmLptX1YaZ-2FDzWM-3D_QqpctyXzj3McV7nyWd3l9m7lCO1pRhWOf-2FT5RqYYs597RjT9wvGhEJXv4m7jZD-2BEYUwavzgRUkWhGzCT6bHX2avlwELJiO4J-2F8Wce4FtF4yjkGc8v1dpODy45dtaeV7e4UO5au2zqxvxtkil9WiSEv86Sx7EFbv-2F3T6TfxhzCIhGPYlnooyzu4hDLBdCVq6JtLCTbI7AeuTySNxqsicrwHrL-2FDvF3ClGwFgqYHKT9C8-3D > > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://u3143608.ct.sendgrid.net/wf/click?upn=-2F8o2SEPnO8o0gkz01Z4rS-2BVz-2BkzajgLQzAoqRKlFQZMZV23PrrGQX1Y-2FnO6KyV7Cg6qnA3jfnwVVC-2BvfFaL4kRlo5qTOuSuNLjAJ4aI-2BCTA-3D_QqpctyXzj3McV7nyWd3l9m7lCO1pRhWOf-2FT5RqYYs597RjT9wvGhEJXv4m7jZD-2BEYUwavzgRUkWhGzCT6bHX2bzxuxXLfwDyW4vs-2FZtMNalxPj9Q2ODwEvr6HIQIkcay24pZ9U8MSCL-2FlTIm4WzViS0jPOvqjscqCV5fku4z1imy6c2WQt6bDElcn5HDBFiZc-2BFheNOAQ4r-2FG2-2FxQlLa1G6Np3GvWtqqRP08ifal6M0-3D |
From: CN <cn...@fa...> - 2016-06-26 14:19:06
|
On Sat, Jun 25, 2016, at 09:36 PM, Artyom Beilis wrote: > Does it happen in production? Or on your own tests. It happened to my own tests - both browsers and server ran in localhost. > > Can it be that you switched from signed to encrypted and signed > cookies without changing the signature key only added AES key? If I remember correctly, I have been always using both "hmac" and "cbc" like so: "session":{ "location":"client", "client":{ "hmac":"sha512", "hmac_key":"my-hmac-key", "cbc":"aes192", "cbc_key":"my-cbc-key" } } Besides, I remember that I always changed both values every time I did rather than only one of them. The fact that my two browsers never cause server to log that weird errors probably proves my memory being working properly. However, I am not sure which values have been changed for "hmac" and/or "cbc" since the third browser in question was told by server to save the (obsolete?) cookie. > > If it happens on your own tests just give me the cookie in the browser > and the keys. It was my fault - I restarted server after I saw the error log without first making sure whether the server was dead or not. Then I accessed the same URL from the third browser in question and successfully logged in. Those steps caused server to tell the third browser to reset the cookie. So I no longer have the suspected cookie in my third browser now. Next time if that same errors happen again, I will backup my browsers' cookie first. > If it happens in production it is different story. Also it must not > happen as invalid data should not come through the signature. > Than contact me in private and I'll see how can we debug it because it > is serious. Best Regards, CN -- http://www.fastmail.com - Email service worth paying for. Try it for free |
From: mawan s. <ma...@gm...> - 2016-06-26 09:57:49
|
Dear All what is different between : some time we meet example : dispatcher().assign("/number/(\\d+)",&hello::number,this,1); and dispatcher().assign(".*",&dashboard::prepare,this,0); is 0 or 1 is pointer only or we have too fill with parameters start from 1? thankyou mawan |
From: Artyom B. <art...@gm...> - 2016-06-25 13:36:40
|
Does it happen in production? Or on your own tests. Can it be that you switched from signed to encrypted and signed cookies without changing the signature key only added AES key? If it happens on your own tests just give me the cookie in the browser and the keys. If it happens in production it is different story. Also it must not happen as invalid data should not come through the signature. Than contact me in private and I'll see how can we debug it because it is serious. Artyom On Tue, Jun 21, 2016 at 12:57 PM, CN <cn...@fa...> wrote: > On Sun, Jun 19, 2016, at 02:00 PM, Artyom Beilis wrote: >> What type of session have you been using? >> >> Note session content is protected with either digital signature or it >> is stored on server so it may be either (a) file/db for server side >> storage corrupted (b) there is a bug >> >> If you getting this problem please provide the cookie that creates the >> issue, if you are using client side storage I also need the keys, for >> server side storage the data. >> > > I use client side storage. > Server reset the cookie so fast that I failed to retain the cookie in > question in time. Next time I will try to grab it if the same problem > happens again. > > Please pardon me for the dumb question - how do I retain the cookie in > question? > Am I supposed to write it to file in server or I can export cookies from > browsers to file? > > Best Regards, > CN > > -- > http://www.fastmail.com - Faster than the air-speed velocity of an > unladen european swallow > > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Artyom B. <art...@gm...> - 2016-06-25 13:29:02
|
Because when you call submit_to_pool you provide already parsed path - you don't submit it to general selection as you already know what pool you submit too. So you give the value that should be given to application::main so you need to call ctx->submit_to_pool(poo,"abc"); > > I am attaching new sample program. Hopefully it is the correct version I > intend to use to illustrate my remaining question: > > Why > part2::main(std::string url) > gets string "up2/abc" instead of "abc"? > > It appears that regex group catching mechanism > cppcms::mount_point("/up2/(.+)",1) > is not invoked. > > Best Regards, > CN > > if(!request().is_ready()){ > //Do some pre-verification. > } > else{ > booster::shared_ptr<cppcms::application_specific_pool> > pool=app_specific_pool.lock(); > if(pool){ > booster::shared_ptr<cppcms::http::context> > ctx=release_context(); > ctx->submit_to_pool(pool,"up2/abc"); > } > } |
From: CN <cn...@fa...> - 2016-06-21 09:58:01
|
On Sun, Jun 19, 2016, at 02:00 PM, Artyom Beilis wrote: > What type of session have you been using? > > Note session content is protected with either digital signature or it > is stored on server so it may be either (a) file/db for server side > storage corrupted (b) there is a bug > > If you getting this problem please provide the cookie that creates the > issue, if you are using client side storage I also need the keys, for > server side storage the data. > I use client side storage. Server reset the cookie so fast that I failed to retain the cookie in question in time. Next time I will try to grab it if the same problem happens again. Please pardon me for the dumb question - how do I retain the cookie in question? Am I supposed to write it to file in server or I can export cookies from browsers to file? Best Regards, CN -- http://www.fastmail.com - Faster than the air-speed velocity of an unladen european swallow |
From: CN <cn...@fa...> - 2016-06-21 09:47:42
|
On Sun, Jun 19, 2016, at 01:57 PM, Artyom Beilis wrote: > 1st of all sorry for delayed reply - was offline for a while. I am very happy to know that you are back online, and much appreciate your kind helps! > > Regarding your error - you had probably missed the concept of filter. > Filter works BEFORE the data was uploaded processed. > So you can do some stuff on the fly instead of downloading big content > and discoverting an issue. > > You need to check if request().is_ready() and only than you can use > it/forward it. I understood its usage (finally). It was just because I somehow posted the wrong redacted sample program again (due to long-hour working?)! > Also JSON-RPC class does not support filer handling it is also not > really needed. Many thanks for the explanation! I am attaching new sample program. Hopefully it is the correct version I intend to use to illustrate my remaining question: Why part2::main(std::string url) gets string "up2/abc" instead of "abc"? It appears that regex group catching mechanism cppcms::mount_point("/up2/(.+)",1) is not invoked. Best Regards, CN ---------- int main(int argc,char ** argv) { cppcms::service sv(argc,argv); booster::shared_ptr<cppcms::application_specific_pool> p2=cppcms::create_pool<part2>(); sv.applications_pool().mount(p2,cppcms::mount_point("/up2/(.+)",1),cppcms::app::synchronous); booster::weak_ptr<cppcms::application_specific_pool> p_p2(p2); sv.applications_pool().mount(cppcms::create_pool<part1>(p_p2),cppcms::mount_point("/up1",1),cppcms::app::asynchronous | cppcms::app::content_filter); ... } class part2 : public cppcms::application { private: void part2::main(std::string url) { //QESTION: Why "up2/abc" instead of "abc" is logged? BOOSTER_DEBUG("url") << url; } public: part2(cppcms::service &s) : cppcms::application(s){} }; class part1 : public cppcms::application { private: booster::weak_ptr<cppcms::application_specific_pool> app_specific_pool; void main(std::string url) { if(!request().is_ready()){ //Do some pre-verification. } else{ booster::shared_ptr<cppcms::application_specific_pool> pool=app_specific_pool.lock(); if(pool){ booster::shared_ptr<cppcms::http::context> ctx=release_context(); ctx->submit_to_pool(pool,"up2/abc"); } } } public: part1(cppcms::service &s,booster::weak_ptr<cppcms::application_specific_pool> app_specific_pool) : cppcms::application(s){} }; -- http://www.fastmail.com - A no graphics, no pop-ups email service |
From: Artyom B. <art...@gm...> - 2016-06-19 06:00:32
|
What type of session have you been using? Note session content is protected with either digital signature or it is stored on server so it may be either (a) file/db for server side storage corrupted (b) there is a bug If you getting this problem please provide the cookie that creates the issue, if you are using client side storage I also need the keys, for server side storage the data. Artyom On Wed, Jun 1, 2016 at 6:09 PM, CN <cn...@fa...> wrote: > Hi! > > Three browsers made the same requests to the same URL but the third one > causes the following errors: > > > 2016-06-01 22:37:20; cppcms, error: Caught exception [sessions::format > violation data] > 0x7fac3f2edc13: > cppcms::session_interface::load_data(std::map<std::string, > cppcms::session_interface::entry, std::less<std::string>, > std::allocator<std::pair<std::string const, > cppcms::session_interface::entry> > >&, std::string const&) + 0x653 in > /usr/local/lib/libcppcms.so.1 > 0x7fac3f2edf8e: cppcms::session_interface::load() + 0x13e in > /usr/local/lib/libcppcms.so.1 > 0x7fac3f272908: > cppcms::http::context::dispatch(booster::intrusive_ptr<cppcms::application> > const&, std::string const&, bool) + 0x188 in > /usr/local/lib/libcppcms.so.1 > 0x7fac3f27378e: > cppcms::http::context::dispatch(booster::shared_ptr<cppcms::application_specific_pool> > const&, booster::shared_ptr<cppcms::http::context> const&, std::string > const&) + 0x7e in /usr/local/lib/libcppcms.so.1 > 0x7fac3f2756c3: cppcms::impl::thread_pool::worker() + 0xc3 in > /usr/local/lib/libcppcms.so.1 > 0x7fac3f66a52a: booster_thread_func + 0x1a in > /usr/local/lib/libbooster.so.0 > 0x7fac3d8f50a4: ??? + 0x3d8f50a4 in > /lib/x86_64-linux-gnu/libpthread.so.0 > 0x7fac3dbf287d: clone + 0x6d in /lib/x86_64-linux-gnu/libc.so.6 > (http_context.cpp:336) > > The first possible cause coming to my mind is that the third browser > sends cookie to server, and that cookie is either broken or created by > server with outdated keys. > > If my guess is correct, is it possible to stop such exception by > enclosing the code in question with "try{...}"? > > Best Regards, > CN > > -- > http://www.fastmail.com - Send your email first class > > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic > patterns at an interface-level. Reveals which users, apps, and protocols are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity > planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Artyom B. <art...@gm...> - 2016-06-19 05:57:10
|
1st of all sorry for delayed reply - was offline for a while. Regarding your error - you had probably missed the concept of filter. Filter works BEFORE the data was uploaded processed. So you can do some stuff on the fly instead of downloading big content and discoverting an issue. You need to check if request().is_ready() and only than you can use it/forward it. Also JSON-RPC class does not support filer handling it is also not really needed. Artyom On Wed, Jun 8, 2016 at 1:08 PM, CN <cn...@fa...> wrote: > Hi! > > Take "Resubmitting Context" in > http://cppcms.com/wikipp/en/page/cppcms_1_2_filtering > as an example. I encounter two issues as shown in the comments in "class > part2". > > int main(int argc,char ** argv) > { > cppcms::service sv(argc,argv); > booster::shared_ptr<cppcms::application_specific_pool> > post_processor=cppcms::create_pool<part2>(); > sv.applications_pool().mount(post_processor,cppcms::mount_point("/up2/(.+)",1),cppcms::app::synchronous); > booster::weak_ptr<cppcms::application_specific_pool> > p_post_processor(post_processor); > sv.applications_pool().mount(cppcms::create_pool<part1>(p_post_processor),cppcms::mount_point("/up1",1),cppcms::app::asynchronous > | cppcms::app::content_filter); > > ... > } > > class part2 : public cppcms::rpc::json_rpc_server > { > private: > void part2::main(std::string url) > { > //"up2/abc" instead of "abc" is logged: > BOOSTER_DEBUG("url") << url; > /* > return_error() raises exception from > cppcms::rpc::json_rpc_server::check_call() > as follows: > > cppcms, error: Caught exception [JSON-RPC > Request is not assigned to class] > > This error seems to not occur to this version: > > class part2 : public cppcms::application{} > */ > return_error(""); > } > public: > part2(cppcms::service &s) > : cppcms::rpc::json_rpc_server(s){} > }; > > > class part1 : public cppcms::application > { > private: > booster::weak_ptr<cppcms::application_specific_pool> > app_specific_pool; > void main(std::string url); > public: > part1(cppcms::service > &s,booster::weak_ptr<cppcms::application_specific_pool> > app_specific_pool) > : cppcms::rpc::json_rpc_server(s) > { > booster::shared_ptr<cppcms::application_specific_pool> > pool=app_specific_pool.lock(); > if(pool){ > booster::shared_ptr<cppcms::http::context> > ctx=release_context(); > ctx->submit_to_pool(pool,"up2/abc"); > } > } > }; > > > A better formatted file is attached for your reference. > Helps will be much appreciated. > > Best Regards, > CN > > -- > http://www.fastmail.com - mmm... Fastmail... > > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic > patterns at an interface-level. Reveals which users, apps, and protocols are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity > planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: CN <cn...@fa...> - 2016-06-08 10:09:03
|
Hi! Take "Resubmitting Context" in http://cppcms.com/wikipp/en/page/cppcms_1_2_filtering as an example. I encounter two issues as shown in the comments in "class part2". int main(int argc,char ** argv) { cppcms::service sv(argc,argv); booster::shared_ptr<cppcms::application_specific_pool> post_processor=cppcms::create_pool<part2>(); sv.applications_pool().mount(post_processor,cppcms::mount_point("/up2/(.+)",1),cppcms::app::synchronous); booster::weak_ptr<cppcms::application_specific_pool> p_post_processor(post_processor); sv.applications_pool().mount(cppcms::create_pool<part1>(p_post_processor),cppcms::mount_point("/up1",1),cppcms::app::asynchronous | cppcms::app::content_filter); ... } class part2 : public cppcms::rpc::json_rpc_server { private: void part2::main(std::string url) { //"up2/abc" instead of "abc" is logged: BOOSTER_DEBUG("url") << url; /* return_error() raises exception from cppcms::rpc::json_rpc_server::check_call() as follows: cppcms, error: Caught exception [JSON-RPC Request is not assigned to class] This error seems to not occur to this version: class part2 : public cppcms::application{} */ return_error(""); } public: part2(cppcms::service &s) : cppcms::rpc::json_rpc_server(s){} }; class part1 : public cppcms::application { private: booster::weak_ptr<cppcms::application_specific_pool> app_specific_pool; void main(std::string url); public: part1(cppcms::service &s,booster::weak_ptr<cppcms::application_specific_pool> app_specific_pool) : cppcms::rpc::json_rpc_server(s) { booster::shared_ptr<cppcms::application_specific_pool> pool=app_specific_pool.lock(); if(pool){ booster::shared_ptr<cppcms::http::context> ctx=release_context(); ctx->submit_to_pool(pool,"up2/abc"); } } }; A better formatted file is attached for your reference. Helps will be much appreciated. Best Regards, CN -- http://www.fastmail.com - mmm... Fastmail... |
From: CN <cn...@fa...> - 2016-06-01 15:09:27
|
Hi! Three browsers made the same requests to the same URL but the third one causes the following errors: 2016-06-01 22:37:20; cppcms, error: Caught exception [sessions::format violation data] 0x7fac3f2edc13: cppcms::session_interface::load_data(std::map<std::string, cppcms::session_interface::entry, std::less<std::string>, std::allocator<std::pair<std::string const, cppcms::session_interface::entry> > >&, std::string const&) + 0x653 in /usr/local/lib/libcppcms.so.1 0x7fac3f2edf8e: cppcms::session_interface::load() + 0x13e in /usr/local/lib/libcppcms.so.1 0x7fac3f272908: cppcms::http::context::dispatch(booster::intrusive_ptr<cppcms::application> const&, std::string const&, bool) + 0x188 in /usr/local/lib/libcppcms.so.1 0x7fac3f27378e: cppcms::http::context::dispatch(booster::shared_ptr<cppcms::application_specific_pool> const&, booster::shared_ptr<cppcms::http::context> const&, std::string const&) + 0x7e in /usr/local/lib/libcppcms.so.1 0x7fac3f2756c3: cppcms::impl::thread_pool::worker() + 0xc3 in /usr/local/lib/libcppcms.so.1 0x7fac3f66a52a: booster_thread_func + 0x1a in /usr/local/lib/libbooster.so.0 0x7fac3d8f50a4: ??? + 0x3d8f50a4 in /lib/x86_64-linux-gnu/libpthread.so.0 0x7fac3dbf287d: clone + 0x6d in /lib/x86_64-linux-gnu/libc.so.6 (http_context.cpp:336) The first possible cause coming to my mind is that the third browser sends cookie to server, and that cookie is either broken or created by server with outdated keys. If my guess is correct, is it possible to stop such exception by enclosing the code in question with "try{...}"? Best Regards, CN -- http://www.fastmail.com - Send your email first class |
From: CN <cn...@fa...> - 2016-05-10 09:17:24
|
> The program no longer causes segmentation fault after signals arrive if > parameter "daemon.enable" in file "t.js" is set to "false" and launched > by this shell script: > > ========= > #!/bin/sh > ### BEGIN INIT INFO > # Provides: t > # Default-Start: 2 3 4 5 > # Default-Stop: 0 1 6 > # Short-Description: My Program > # Description: Test signals. > ### END INIT INFO > > > PATH=/sbin:/bin:/usr/sbin:/usr/bin > DAEMON=/tmp/a.out > NAME=t > CONFIGFILE="-c /tmp/t.js" > DESC="My Program" > SCRIPTNAME=/etc/init.d/$NAME > PIDFILE=/tmp/t.pid > > test -x $DAEMON || exit 0 > > . /lib/lsb/init-functions > > case "$1" in > start) > log_daemon_msg "Starting $DESC" $NAME > start-stop-daemon --start --oknodo --quiet --pidfile $PIDFILE > --exec $DAEMON -b -m -- $CONFIGFILE > log_end_msg $? > ;; > stop) > log_daemon_msg "Stopping $DESC" $NAME > start-stop-daemon --stop --retry TERM/10 --quiet --pidfile > $PIDFILE --exec $DAEMON --remove-pidfile > log_end_msg $? > ;; > reload|force-reload) > log_daemon_msg "Reloading $DESC" $NAME > start-stop-daemon --stop --signal HUP --retry 10 --quiet > --pidfile $PIDFILE --exec $DAEMON > log_end_msg $? > ;; > restart) > log_daemon_msg "Restarting $DESC" $NAME > $0 stop > $0 start > ;; > status) > status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit > $? > ;; > *) > echo "Usage: $SCRIPTNAME > {start|stop|restart|reload|force-reload|status}" >&2 > exit 1 > ;; > esac > > exit 0 > > ========= > > Please note the "-b -m" options under "start)", in case this script is > *generally correct* and also useful to anyone in this community. I do not understand the effects coming from "reload|force-reload)" in the shell script: unknown symptom (1): reload|force-reload) start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --exec $DAEMON These are the commands I issued: /tmp/t.sh start /tmp/t.sh reload Here is its log: May 10 16:55:49 host t: ==1==: (t.cpp:51) May 10 16:56:20 host t: begin handler: (t.cpp:12) May 10 16:56:20 host t: end handler: (t.cpp:15) May 10 16:56:20 host t: ==2==: (t.cpp:53) May 10 16:56:20 host t: ==3==: (t.cpp:55) May 10 16:56:20 host t: ==4==: (t.cpp:58) May 10 16:56:20 host t: ==1==: (t.cpp:51) May 10 16:56:20 host t: ==1==: (t.cpp:51) My understanding is that since parameter "daemon.enable" in "t.js" is set to "false", process forking is then not involved. Why t.cpp:51 appears twice? unknown symptom (2): After "--retry 5" is added to make the script look so: reload|force-reload) start-stop-daemon --stop --signal HUP --retry 5 --quiet --pidfile $PIDFILE --exec $DAEMON , command "/tmp/t.sh reload" does not return until 5 seconds pass. Besides, there is no process running for "a.out" after the command returns. Why is that? Best regards, CN -- http://www.fastmail.com - mmm... Fastmail... |
From: CN <cn...@fa...> - 2016-05-10 06:47:48
|
Dear Artyom, Thanks for taking time answering! The program no longer causes segmentation fault after signals arrive if parameter "daemon.enable" in file "t.js" is set to "false" and launched by this shell script: ========= #!/bin/sh ### BEGIN INIT INFO # Provides: t # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: My Program # Description: Test signals. ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/tmp/a.out NAME=t CONFIGFILE="-c /tmp/t.js" DESC="My Program" SCRIPTNAME=/etc/init.d/$NAME PIDFILE=/tmp/t.pid test -x $DAEMON || exit 0 . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting $DESC" $NAME start-stop-daemon --start --oknodo --quiet --pidfile $PIDFILE --exec $DAEMON -b -m -- $CONFIGFILE log_end_msg $? ;; stop) log_daemon_msg "Stopping $DESC" $NAME start-stop-daemon --stop --retry TERM/10 --quiet --pidfile $PIDFILE --exec $DAEMON --remove-pidfile log_end_msg $? ;; reload|force-reload) log_daemon_msg "Reloading $DESC" $NAME start-stop-daemon --stop --signal HUP --retry 10 --quiet --pidfile $PIDFILE --exec $DAEMON log_end_msg $? ;; restart) log_daemon_msg "Restarting $DESC" $NAME $0 stop $0 start ;; status) status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $? ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2 exit 1 ;; esac exit 0 ========= Please note the "-b -m" options under "start)", in case this script is *generally correct* and also useful to anyone in this community. Best regards, CN On Tue, May 10, 2016, at 01:43 PM, Artyom Beilis wrote: > Ok I got what is the problem: > > Few things: > > I've run your code and it indeed crashes **when it runs as daemon > using its internal tool** > I still don't know why exactly it crashes but I assume it is related to > forking. > > Note that threads do not go well through forking (that is required to > create a daemon), actually they all become suspended and you need to > wake them up - but in general it is very bad practice. > IF you want to run your threads AND use daemonization services > (regarding restarting of the process) you need to start your threads > in cppcms::service::after_fork callback - otherwise > they'll be suspended after fork. > > On the side note: I think cppcms needs something like daemonize that > can be called prior to service::run().... something to add to feature > requests. > > Additional problem currently unsolved: > > Essentially cppcms service daemonization is intended to use when > cppcms::service is master loop and responsible on the application life > time. For example it can even start several independent processes in > prefork mode. > See when you can service::run() it performs daemonization if it isn't > already a daemon and in service::~service() it removes the lock file. > So it is problematic to start/stop the service several times (but I > think this is at least fixable) > > If you want to restart the service on your own - which is very > legitimate requirement, for example for creating web interfaces for > existing services than you can't use the internal daemonization tool. > You need to fork-off and run as daemon before you start your threads & > run the service. > > Regards, > > Artyom -- http://www.fastmail.com - Same, same, but different... |
From: Artyom B. <art...@gm...> - 2016-05-10 05:43:52
|
Ok I got what is the problem: Few things: I've run your code and it indeed crashes **when it runs as daemon using its internal tool** I still don't know why exactly it crashes but I assume it is related to forking. Note that threads do not go well through forking (that is required to create a daemon), actually they all become suspended and you need to wake them up - but in general it is very bad practice. IF you want to run your threads AND use daemonization services (regarding restarting of the process) you need to start your threads in cppcms::service::after_fork callback - otherwise they'll be suspended after fork. On the side note: I think cppcms needs something like daemonize that can be called prior to service::run().... something to add to feature requests. Additional problem currently unsolved: Essentially cppcms service daemonization is intended to use when cppcms::service is master loop and responsible on the application life time. For example it can even start several independent processes in prefork mode. See when you can service::run() it performs daemonization if it isn't already a daemon and in service::~service() it removes the lock file. So it is problematic to start/stop the service several times (but I think this is at least fixable) If you want to restart the service on your own - which is very legitimate requirement, for example for creating web interfaces for existing services than you can't use the internal daemonization tool. You need to fork-off and run as daemon before you start your threads & run the service. Regards, Artyom |
From: CN <cn...@fa...> - 2016-05-09 16:16:43
|
On Mon, May 9, 2016, at 11:35 PM, CN wrote: > I seem to have encountered big trouble! How can it be pthread_join > that is buggy? > Any thought? > Meanwhile, I am going to run this program in different machine to > find more... This program also causes segfault in libthread-2.19.so running in different machine with different architecture (AMD64) and newer version of Linux. -- http://www.fastmail.com - The way an email service should be |
From: CN <cn...@fa...> - 2016-05-09 15:35:52
|
On Mon, May 9, 2016, at 09:01 PM, CN wrote: > > Regarding the log of gdb backtrace, I seem to have encountered some > trouble - upon the arrival of signal HUP, the process straightly > disappears from gdb's control without trace leaving command > "backtrace" useless. > I am still trying to figure out how. I will post it as soon as I > have it. > I am unable to get useful result from gdb: (gdb) run [Here the program stops at cppcms::service::run()] [Find the running process id in another terminal.] (gdb) attach 5343 [A lot messages appear here] [Type command "kill -HUP 5343" in another terminal] (gdb) c Continuing. Program received signal SIGHUP. Hangup. 0xb7fdfce2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 (gdb) Continuing. Cannot get thread event message: debugger service failed (gdb) Continuing. Cannot execute this command while the selected thread is running. ---- This is the related ouput from valgrind: ==6206== Invalid read of size 4 ==6206== at 0x462105E: pthread_join (pthread_join.c:47) ==6206== by 0x4121897: booster::thread::join() (pthread.cpp:85) ==6206== by 0x8049799: main (t.cpp:54) ==6206== Address 0x6821ba8 is not stack'd, malloc'd or ==(recently) free'd ==6206== ==6206== ==6206== Process terminating with default action of signal 11 (SIGSEGV) ==6206== Access not within mapped region at address 0x6821BA8 ==6206== at 0x462105E: pthread_join (pthread_join.c:47) ==6206== by 0x4121897: booster::thread::join() (pthread.cpp:85) ==6206== by 0x8049799: main (t.cpp:54) I seem to have encountered big trouble! How can it be pthread_join that is buggy? Any thought? Meanwhile, I am going to run this program in different machine to find more... Regards, CN -- http://www.fastmail.com - IMAP accessible web-mail |
From: CN <cn...@fa...> - 2016-05-09 13:01:45
|
I am trying to implement a mechanism so that the program catches SIGHUP signal and accordingly reloads configuration file as suggested here: http://cppcms.com/wikipp/en/page/cppcms_1x_reload_application The signals handler installed by void service::setup_exit_handling() in file "service.cpp" simply calls cppcms::service::shutdown(). I therefore have to roll my own. Regarding the log of gdb backtrace, I seem to have encountered some trouble - upon the arrival of signal HUP, the process straightly disappears from gdb's control without trace leaving command "backtrace" useless. I am still trying to figure out how. I will post it as soon as I have it. Best regards, CN On Mon, May 9, 2016, at 06:36 PM, Artyom Beilis wrote: > 1st why are you using your own signal handler instead of one used > by CppCMS? > On segfault - can you show the backtrace of the stack from gdb when it > happens. > > > Artyom > >> **From:** CN <cn...@fa...> **To:** cppcms- >> us...@li... **Sent:** Sunday, May 8, 2016 5:04 PM >> **Subject:** [Cppcms-users] Segmentaion fault occurs to >> booster::aio::io_service running in booster::thread >> >> File "t.cpp": >> >> #include <booster/aio/io_service.h> >> #include <cppcms/service.h> >> #include <boost/bind.hpp> >> #include <booster/shared_ptr.h> >> #include <booster/log.h> >> #include <signal.h> >> booster::shared_ptr<cppcms::service> this_cppcms_service; >> static int caught_signal=-1; >> >> void signal_handler(int signal_number) >> { >> BOOSTER_DEBUG("begin handler"); >> caught_signal=signal_number; >> this_cppcms_service->shutdown(); >> BOOSTER_DEBUG("end handler"); >> } >> >> class my_class { >> private: >> booster::aio::io_service io_service; >> public: >> void start(){ >> io_service.run(); >> } >> void stop(){ >> io_service.stop(); >> } >> }; >> >> >> int main(int argc,char ** argv) >> { >> while(true){ >> try{ >> this_cppcms_service.reset(new >> cppcms::service(argc,argv)); >> //Install signals catchers. >> struct sigaction actions; >> memset(&actions,0,sizeof(actions)); >> actions.sa_handler=signal_handler; >> int result; >> if( >> (result=sigaction(SIGTERM,&actions,NULL)) >> != 0 >> || >> (result=sigaction(SIGHUP,&actions,NULL)) >> != 0 >> ){ >> BOOSTER_ERROR("") << "sigaction() >> failed"; >> exit(EXIT_FAILURE); >> } >> my_class mc; >> booster::thread >> mc_thread(boost::bind(&my_class::start,&mc)); >> >> BOOSTER_DEBUG("==1=="); >> this_cppcms_service->run(); >> BOOSTER_DEBUG("==2=="); >> mc.stop(); mc_thread.join(); >> BOOSTER_DEBUG("==3=="); >> if(caught_signal == SIGTERM) >> return 0; >> BOOSTER_DEBUG("==4=="); >> //SIGHUP to reload configurations >> } >> catch(std::exception const &e){ >> BOOSTER_ERROR("") << e.what(); >> return 1; >> } >> } >> return 0; >> } >> >> ---------- >> >> File "t.js": >> >> { >> "service" : { >> "api" : "fastcgi", >> "socket" : "/tmp/t.sock", >> "disable_global_exit_handling":true >> }, >> "daemon":{ >> "enable":true, >> "lock":"/tmp/t.pid" >> }, >> "logging" : { >> "level" : "debug", >> "stderr" : false, >> "syslog" : { >> "enable":true, >> "id" : "t" >> } >> } >> } >> >> -------- >> >> Commands issued: >> >> cd /tmp >> g++ -lbooster -lcppcms -lboost_system t.cpp >> ./a.out -c t.js >> kill -TERM `cat t.pid` >> >> -------- >> >> File "/var/log/syslog": >> >> May 8 21:36:13 host t: ==1==: (t.cpp:51) >> May 8 21:36:36 host t: begin handler: (t.cpp:12) >> May 8 21:36:36 host t: end handler: (t.cpp:15) >> May 8 21:36:36 host t: ==2==: (t.cpp:53) >> May 8 21:36:36 host kernel: a.out[5146]: segfault at b5b5dba8 ip >> b715205e sp bfad0620 error 4 in libpthread-2.19.so[b714a000+18000] >> >> >> With this simple code, I get segfault at "mc.stop(); >> mc_thread.join();" >> after issuing command "kill -TERM <pid>". Would someone please >> enlighten >> me why? >> >> Best regards, >> CN >> >> -- >> http://www.fastmail.com [1]- Accessible with your email software >> or over the web >> >> >> --------------------------------------------------------------------- >> --------- >> Find and fix application performance issues faster with Applications >> Manager >> Applications Manager provides deep performance insights into multiple >> tiers of >> your business applications. It resolves application problems >> quickly and >> reduces your MTTR. Get your free trial! >> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > ---------------------------------------------------------------------- > -------- > Find and fix application performance issues faster with > Applications Manager > Applications Manager provides deep performance insights into multiple > tiers of > your business applications. It resolves application problems > quickly and > reduces your MTTR. Get your free trial! > https://ad.doubleclick.net/ddm/clk/302982198;130105516;z[2] > _________________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users Links: 1. http://www.fastmail.com/ 2. https://ad.doubleclick.net/ddm/clk/302982198%3B130105516%3Bz -- http://www.fastmail.com - IMAP accessible web-mail |
From: Artyom B. <art...@ya...> - 2016-05-09 10:39:10
|
1st why are you using your own signal handler instead of one used by CppCMS?On segfault - can you show the backtrace of the stack from gdb when it happens. Artyom From: CN <cn...@fa...> To: cpp...@li... Sent: Sunday, May 8, 2016 5:04 PM Subject: [Cppcms-users] Segmentaion fault occurs to booster::aio::io_service running in booster::thread File "t.cpp": #include <booster/aio/io_service.h> #include <cppcms/service.h> #include <boost/bind.hpp> #include <booster/shared_ptr.h> #include <booster/log.h> #include <signal.h> booster::shared_ptr<cppcms::service> this_cppcms_service; static int caught_signal=-1; void signal_handler(int signal_number) { BOOSTER_DEBUG("begin handler"); caught_signal=signal_number; this_cppcms_service->shutdown(); BOOSTER_DEBUG("end handler"); } class my_class { private: booster::aio::io_service io_service; public: void start(){ io_service.run(); } void stop(){ io_service.stop(); } }; int main(int argc,char ** argv) { while(true){ try{ this_cppcms_service.reset(new cppcms::service(argc,argv)); //Install signals catchers. struct sigaction actions; memset(&actions,0,sizeof(actions)); actions.sa_handler=signal_handler; int result; if( (result=sigaction(SIGTERM,&actions,NULL)) != 0 || (result=sigaction(SIGHUP,&actions,NULL)) != 0 ){ BOOSTER_ERROR("") << "sigaction() failed"; exit(EXIT_FAILURE); } my_class mc; booster::thread mc_thread(boost::bind(&my_class::start,&mc)); BOOSTER_DEBUG("==1=="); this_cppcms_service->run(); BOOSTER_DEBUG("==2=="); mc.stop(); mc_thread.join(); BOOSTER_DEBUG("==3=="); if(caught_signal == SIGTERM) return 0; BOOSTER_DEBUG("==4=="); //SIGHUP to reload configurations } catch(std::exception const &e){ BOOSTER_ERROR("") << e.what(); return 1; } } return 0; } ---------- File "t.js": { "service" : { "api" : "fastcgi", "socket" : "/tmp/t.sock", "disable_global_exit_handling":true }, "daemon":{ "enable":true, "lock":"/tmp/t.pid" }, "logging" : { "level" : "debug", "stderr" : false, "syslog" : { "enable":true, "id" : "t" } } } -------- Commands issued: cd /tmp g++ -lbooster -lcppcms -lboost_system t.cpp ./a.out -c t.js kill -TERM `cat t.pid` -------- File "/var/log/syslog": May 8 21:36:13 host t: ==1==: (t.cpp:51) May 8 21:36:36 host t: begin handler: (t.cpp:12) May 8 21:36:36 host t: end handler: (t.cpp:15) May 8 21:36:36 host t: ==2==: (t.cpp:53) May 8 21:36:36 host kernel: a.out[5146]: segfault at b5b5dba8 ip b715205e sp bfad0620 error 4 in libpthread-2.19.so[b714a000+18000] With this simple code, I get segfault at "mc.stop(); mc_thread.join();" after issuing command "kill -TERM <pid>". Would someone please enlighten me why? Best regards, CN -- http://www.fastmail.com - Accessible with your email software or over the web ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ Cppcms-users mailing list Cpp...@li... https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: Artyom B. <art...@gm...> - 2016-05-09 10:37:39
|
1st why are you using your own signal handler instead of one used by CppCMS it looks like doing the same stuff. On segfault - can you show the backtrace of the stack from gdb when it happens. Artyom > May 8 21:36:13 host t: ==1==: (t.cpp:51) > May 8 21:36:36 host t: begin handler: (t.cpp:12) > May 8 21:36:36 host t: end handler: (t.cpp:15) > May 8 21:36:36 host t: ==2==: (t.cpp:53) > May 8 21:36:36 host kernel: a.out[5146]: segfault at b5b5dba8 ip > b715205e sp bfad0620 error 4 in libpthread-2.19.so[b714a000+18000] > > > With this simple code, I get segfault at "mc.stop(); mc_thread.join();" > after issuing command "kill -TERM <pid>". Would someone please enlighten > me why? > |
From: CN <cn...@fa...> - 2016-05-09 08:11:17
|
File "~/booster/lib/src/thread/pthread.cpp" already includes "pthread.h". Nevertheless, I have just tried as you suggested but got the same segmentation fault from the executable compiled with option "-pthread" added: g++ -lbooster -lcppcms -lboost_system -pthread t.cpp On Mon, May 9, 2016, at 02:20 PM, Marcel Hellwig wrote: > I'm not entirely sure, but don't you need something like '-pthread' to > use threads in a unix environment. Try that out. -- http://www.fastmail.com - mmm... Fastmail... |
From: Marcel H. <ke...@co...> - 2016-05-09 06:38:22
|
I'm not entirely sure, but don't you need something like '-pthread' to use threads in a unix environment. Try that out. On 05/08/2016 04:04 PM, CN wrote: > File "t.cpp": > > #include <booster/aio/io_service.h> > #include <cppcms/service.h> > #include <boost/bind.hpp> > #include <booster/shared_ptr.h> > #include <booster/log.h> > #include <signal.h> > booster::shared_ptr<cppcms::service> this_cppcms_service; > static int caught_signal=-1; > > void signal_handler(int signal_number) > { > BOOSTER_DEBUG("begin handler"); > caught_signal=signal_number; > this_cppcms_service->shutdown(); > BOOSTER_DEBUG("end handler"); > } > > class my_class { > private: > booster::aio::io_service io_service; > public: > void start(){ > io_service.run(); > } > void stop(){ > io_service.stop(); > } > }; > > > int main(int argc,char ** argv) > { > while(true){ > try{ > this_cppcms_service.reset(new > cppcms::service(argc,argv)); > //Install signals catchers. > struct sigaction actions; > memset(&actions,0,sizeof(actions)); > actions.sa_handler=signal_handler; > int result; > if( > (result=sigaction(SIGTERM,&actions,NULL)) > != 0 > || > (result=sigaction(SIGHUP,&actions,NULL)) > != 0 > ){ > BOOSTER_ERROR("") << "sigaction() > failed"; > exit(EXIT_FAILURE); > } > my_class mc; > booster::thread > mc_thread(boost::bind(&my_class::start,&mc)); > > BOOSTER_DEBUG("==1=="); > this_cppcms_service->run(); > BOOSTER_DEBUG("==2=="); > mc.stop(); mc_thread.join(); > BOOSTER_DEBUG("==3=="); > if(caught_signal == SIGTERM) > return 0; > BOOSTER_DEBUG("==4=="); > //SIGHUP to reload configurations > } > catch(std::exception const &e){ > BOOSTER_ERROR("") << e.what(); > return 1; > } > } > return 0; > } > > ---------- > > File "t.js": > > { > "service" : { > "api" : "fastcgi", > "socket" : "/tmp/t.sock", > "disable_global_exit_handling":true > }, > "daemon":{ > "enable":true, > "lock":"/tmp/t.pid" > }, > "logging" : { > "level" : "debug", > "stderr" : false, > "syslog" : { > "enable":true, > "id" : "t" > } > } > } > > -------- > > Commands issued: > > cd /tmp > g++ -lbooster -lcppcms -lboost_system t.cpp > ./a.out -c t.js > kill -TERM `cat t.pid` > > -------- > > File "/var/log/syslog": > > May 8 21:36:13 host t: ==1==: (t.cpp:51) > May 8 21:36:36 host t: begin handler: (t.cpp:12) > May 8 21:36:36 host t: end handler: (t.cpp:15) > May 8 21:36:36 host t: ==2==: (t.cpp:53) > May 8 21:36:36 host kernel: a.out[5146]: segfault at b5b5dba8 ip > b715205e sp bfad0620 error 4 in libpthread-2.19.so[b714a000+18000] > > > With this simple code, I get segfault at "mc.stop(); mc_thread.join();" > after issuing command "kill -TERM <pid>". Would someone please enlighten > me why? > > Best regards, > CN > |
From: CN <cn...@fa...> - 2016-05-08 14:04:36
|
File "t.cpp": #include <booster/aio/io_service.h> #include <cppcms/service.h> #include <boost/bind.hpp> #include <booster/shared_ptr.h> #include <booster/log.h> #include <signal.h> booster::shared_ptr<cppcms::service> this_cppcms_service; static int caught_signal=-1; void signal_handler(int signal_number) { BOOSTER_DEBUG("begin handler"); caught_signal=signal_number; this_cppcms_service->shutdown(); BOOSTER_DEBUG("end handler"); } class my_class { private: booster::aio::io_service io_service; public: void start(){ io_service.run(); } void stop(){ io_service.stop(); } }; int main(int argc,char ** argv) { while(true){ try{ this_cppcms_service.reset(new cppcms::service(argc,argv)); //Install signals catchers. struct sigaction actions; memset(&actions,0,sizeof(actions)); actions.sa_handler=signal_handler; int result; if( (result=sigaction(SIGTERM,&actions,NULL)) != 0 || (result=sigaction(SIGHUP,&actions,NULL)) != 0 ){ BOOSTER_ERROR("") << "sigaction() failed"; exit(EXIT_FAILURE); } my_class mc; booster::thread mc_thread(boost::bind(&my_class::start,&mc)); BOOSTER_DEBUG("==1=="); this_cppcms_service->run(); BOOSTER_DEBUG("==2=="); mc.stop(); mc_thread.join(); BOOSTER_DEBUG("==3=="); if(caught_signal == SIGTERM) return 0; BOOSTER_DEBUG("==4=="); //SIGHUP to reload configurations } catch(std::exception const &e){ BOOSTER_ERROR("") << e.what(); return 1; } } return 0; } ---------- File "t.js": { "service" : { "api" : "fastcgi", "socket" : "/tmp/t.sock", "disable_global_exit_handling":true }, "daemon":{ "enable":true, "lock":"/tmp/t.pid" }, "logging" : { "level" : "debug", "stderr" : false, "syslog" : { "enable":true, "id" : "t" } } } -------- Commands issued: cd /tmp g++ -lbooster -lcppcms -lboost_system t.cpp ./a.out -c t.js kill -TERM `cat t.pid` -------- File "/var/log/syslog": May 8 21:36:13 host t: ==1==: (t.cpp:51) May 8 21:36:36 host t: begin handler: (t.cpp:12) May 8 21:36:36 host t: end handler: (t.cpp:15) May 8 21:36:36 host t: ==2==: (t.cpp:53) May 8 21:36:36 host kernel: a.out[5146]: segfault at b5b5dba8 ip b715205e sp bfad0620 error 4 in libpthread-2.19.so[b714a000+18000] With this simple code, I get segfault at "mc.stop(); mc_thread.join();" after issuing command "kill -TERM <pid>". Would someone please enlighten me why? Best regards, CN -- http://www.fastmail.com - Accessible with your email software or over the web |
From: Artyom B. <art...@gm...> - 2016-04-17 14:01:12
|
I suggest read the documentation of CGI https://en.wikipedia.org/wiki/Common_Gateway_Interface it is good place to start. Short explanation /foo/bar.php/do/it/or+not?f=c Than /foo/bar.php - is script name "/do/it/or not" - is path info f=c is query string. The rest is up to you. They way you configure web server. On Fri, Apr 15, 2016 at 10:57 AM, CN <cn...@fa...> wrote: > Hi! > > Please ignore this question for this moment so that nobody's precious > time will be wasted. > I am responding to my own question before I have finished my study. > > My study so far on lighttpd's fcgi configuration makes me feel that > script_name and path_info involves more lighttpd than CppCMS as shown > here: > > http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI > > This helps myself a lot find out the answers for my own question - > catching everything in cppcms::mount_point() like so: > > my_cppcms_service.applications_pool().mount(cppcms::create_pool<my_app>(),cppcms::mount_point(cppcms::mount_point::match_script_name,"(.*)",1),cppcms::app::synchronous) > > and print the environment variables in question here: > > my_app::main(std::string url) > { > BOOSTER_DEBUG("") << "SCRIPT_NAME=" << request().script_name() > << ", PATH_INFO=" << request().path_info(); > } > > By sending request "localhost:8080" from browser, what I get from > request().script_name() now is "my_program" which I guess is either the > socket name or the program name awaiting for me to investigate more... > > Cheers, > CN > > > On Thu, Apr 14, 2016, at 03:51 PM, CN wrote: >> Hi! >> >> I am not quite sure this question is a generic one or specific to >> CppCMS, HTTP servers, or fastcgi. Being a lazy man, I simply resort to >> CppCMS community as the short cut. >> >> I have carefully read this article before raising this question: >> http://cppcms.com/wikipp/en/page/cppcms_1x_tut_url_mapping >> >> What still unclear to me is what will the respective script_name and >> path_info be when a client might request for the following possible >> URL's: >> >> /hello/number/10/ >> /hello/number/10 >> hello/number/10/ >> hello/number/10 >> >> Will the leading and trailing slashes be trimmed off or integrally >> preserved? Will a leading slash be automatically prepended to >> script_name? >> >> I think clarification of its behavior is crucial if we want to correctly >> catch or ignore requests when calling cppcms::mount_point(), >> cppcms::url_dispatcher::assign(), cppcms::application::attach(), >> cppcms::application::add(),.. etc. >> >> Best regards, >> CN >> >> -- >> http://www.fastmail.com - The professional email service >> >> >> ------------------------------------------------------------------------------ >> Find and fix application performance issues faster with Applications >> Manager >> Applications Manager provides deep performance insights into multiple >> tiers of >> your business applications. It resolves application problems quickly and >> reduces your MTTR. Get your free trial! >> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users > > -- > http://www.fastmail.com - The way an email service should be > > > ------------------------------------------------------------------------------ > Find and fix application performance issues faster with Applications Manager > Applications Manager provides deep performance insights into multiple tiers of > your business applications. It resolves application problems quickly and > reduces your MTTR. Get your free trial! > https://ad.doubleclick.net/ddm/clk/302982198;130105516;z > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |