cppcms-users Mailing List for CppCMS C++ Web Framework (Page 18)
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: CN <cn...@fa...> - 2016-04-15 07:57:51
|
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 |
From: CN <cn...@fa...> - 2016-04-14 07:51:16
|
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 |
From: CN <cn...@fa...> - 2016-04-13 16:21:45
|
On Wed, Apr 13, 2016, at 06:24 PM, Artyom Beilis wrote: > Ok got your problem... > > See, resubmitting the context is to take a context from an application > in one pool and move to another, > for example to do filter in async application and move the context to > sync application for processing. > > The idea is following: > > You create one pool - lets say synchronous and keep a week_ptr on it. > Than you create a new asynchronous filtering pool and pass it to the > filtering pool: > > shared_ptr processor = cppcms::create_pool<myprcessor>(); > srv.applications_pool().mount(processor,...) > weak_ptr weak_pool = processor; > srv.applications_pool().mount(cppcms::create_pool<myfilter>(weak_pool),asynchronous|filter) > > So the weak reference to the pool is reference to another pool not my own > pool. > I think I finally have learned how to send asynchronous jobs to synchronously run in applications pool. Many thanks for your patience! Best regards, CN -- http://www.fastmail.com - A no graphics, no pop-ups email service |
From: Artyom B. <art...@gm...> - 2016-04-13 10:24:16
|
Ok got your problem... See, resubmitting the context is to take a context from an application in one pool and move to another, for example to do filter in async application and move the context to sync application for processing. The idea is following: You create one pool - lets say synchronous and keep a week_ptr on it. Than you create a new asynchronous filtering pool and pass it to the filtering pool: shared_ptr processor = cppcms::create_pool<myprcessor>(); srv.applications_pool().mount(processor,...) weak_ptr weak_pool = processor; srv.applications_pool().mount(cppcms::create_pool<myfilter>(weak_pool),asynchronous|filter) So the weak reference to the pool is reference to another pool not my own pool. The code I shown is how to get __my own__ pool rather than another one because without a tutorial context you wanted to get your own pool. In general you don't resubmit context to yourself > pool_ptr pool = get_pool().lock(); /* note here! */ > if(pool) { > shared_ptr<context> ctx = release_context(); > // now this context goes to another > // application to be run. > ctx->submit_to_pool(pool,path); > > } Would create an infinite loop. So if you want the reference to the pool you need to keep one from the beginning. Artyom |
From: CN <cn...@fa...> - 2016-04-13 08:18:45
|
On Wed, Apr 13, 2016, at 03:37 AM, Artyom Beilis wrote: > Currently there is private member function application::get_pool() I > can create a public version of one or make it public. > I don't recall right now why I have made it private. > I moved application::get_pool() from private to public just now and this much cleaner version than the orginal one http://cppcms.com/wikipp/en/page/cppcms_1_2_filtering compiles: void main(std::sting path) { if(!request().is_ready()) { // handle all filtering stuff } else { pool_ptr pool = get_pool().lock(); /* note here! */ if(pool) { shared_ptr<context> ctx = release_context(); // now this context goes to another // application to be run. ctx->submit_to_pool(pool,path); } } } Best regards, CN -- http://www.fastmail.com - Access all of your messages and folders wherever you are |
From: CN <cn...@fa...> - 2016-04-13 04:51:09
|
On Wed, Apr 13, 2016, at 11:32 AM, CN wrote: > Before we have a public application::get_pool(), maybe the last > statement is supposed to look like this? > srv.applications_pool().mount(tmp,proxy...) Please ignore this incorrect part! Best regards, CN -- http://www.fastmail.com - Accessible with your email software or over the web |
From: CN <cn...@fa...> - 2016-04-13 03:32:55
|
On Wed, Apr 13, 2016, at 03:37 AM, Artyom Beilis wrote: > Currently there is private member function application::get_pool() I > can create a public version of one or make it public. > I don't recall right now why I have made it private. > > The question is what are you trying to do, when do you need your own > pool? > i.e. I want to know the scenario you are trying to implement so I can > adjust the API accordingly. Oops! I wanted to include this URL in my original message but forgot to do so: http://cppcms.com/wikipp/en/page/cppcms_1_2_filtering Please refer to the tutorial illustrated in "Resubmitting Context". > > Of course you can create some pool_proxy object that you pass to the > constructor of your own application > that keeps the reference to the pool. > > Something like that > > myfilter(cppcms::service &srv, booster::shared_ptr<weak_pool_ptr> ptr)... > > And than use it this way: > > booster::shared_ptr<weak_pool_ptr> proxy(new weak_pool_ptr()); > shared_pool_ptr tmp = cppcms::create_pool<myfilter>(proxy), > (*proxy) = tmp; > srv.applications_pool().mount(tmp,...) > > Also it is quite ugly. It is difficult to read, indeed. I am trying very hard now to understand this example... Before we have a public application::get_pool(), maybe the last statement is supposed to look like this? srv.applications_pool().mount(tmp,proxy...) Thanks a lot! Best regards, CN -- http://www.fastmail.com - Faster than the air-speed velocity of an unladen european swallow |
From: Artyom B. <art...@gm...> - 2016-04-12 19:37:26
|
Currently there is private member function application::get_pool() I can create a public version of one or make it public. I don't recall right now why I have made it private. The question is what are you trying to do, when do you need your own pool? i.e. I want to know the scenario you are trying to implement so I can adjust the API accordingly. Of course you can create some pool_proxy object that you pass to the constructor of your own application that keeps the reference to the pool. Something like that myfilter(cppcms::service &srv, booster::shared_ptr<weak_pool_ptr> ptr)... And than use it this way: booster::shared_ptr<weak_pool_ptr> proxy(new weak_pool_ptr()); shared_pool_ptr tmp = cppcms::create_pool<myfilter>(proxy), (*proxy) = tmp; srv.applications_pool().mount(tmp,...) Also it is quite ugly. Artyom On Tue, Apr 12, 2016 at 7:13 PM, CN <cn...@fa...> wrote: > Greetings, > > I can imagine we might be able to put something like this > > my_cppcms_service.applications_pool().mount(cppcms::create_pool<myfilter>(),cppcms::mount_point("(.*)",1),cppcms::app::asynchronous > | cppcms::app::content_filter); > > in > > int main(int,char**){ //here } > > , but I have trouble figuring out how to pass > booster::weak_ptr<cppcms::application_specific_pool> > or > booster::shared_ptr<cppcms::application_specific_pool> > as the argument to the constructor of myfilter: > > myfilter(cppcms::service &srv, weak_pool_ptr ptr): > cppcms::application(srv), > wpool_(ptr) > { > .. > } > > I will much appreciate if some kind soul will provide me an example in > int main(int,char**){ //here } > > 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: CN <cn...@fa...> - 2016-04-12 16:13:33
|
Greetings, I can imagine we might be able to put something like this my_cppcms_service.applications_pool().mount(cppcms::create_pool<myfilter>(),cppcms::mount_point("(.*)",1),cppcms::app::asynchronous | cppcms::app::content_filter); in int main(int,char**){ //here } , but I have trouble figuring out how to pass booster::weak_ptr<cppcms::application_specific_pool> or booster::shared_ptr<cppcms::application_specific_pool> as the argument to the constructor of myfilter: myfilter(cppcms::service &srv, weak_pool_ptr ptr): cppcms::application(srv), wpool_(ptr) { .. } I will much appreciate if some kind soul will provide me an example in int main(int,char**){ //here } Best regards, CN -- http://www.fastmail.com - Accessible with your email software or over the web |
From: Artyom B. <art...@gm...> - 2016-04-04 11:48:17
|
>> Full sample would help me to check the issue. > > I have run out my wisdom. > Is it OK with you if I send the actual source files in private directly > to your e-mail box? Yes, no problem Artyom |
From: CN <cn...@fa...> - 2016-04-04 11:41:13
|
On Mon, Apr 4, 2016, at 06:59 PM, Artyom Beilis wrote: > Do you provide a full sample that reproduces the issue? For example in > m2 below you can't call ja.push_back(a) as ja is const. > > According to the crash it looks like you are derefenecing deleted > object, i.e. something passed by reference and out of stack > or something like that. > > Full sample would help me to check the issue. I have run out my wisdom. Is it OK with you if I send the actual source files in private directly to your e-mail box? Best regards, CN -- http://www.fastmail.com - Accessible with your email software or over the web |
From: Artyom B. <art...@gm...> - 2016-04-04 10:59:15
|
Do you provide a full sample that reproduces the issue? For example in m2 below you can't call ja.push_back(a) as ja is const. According to the crash it looks like you are derefenecing deleted object, i.e. something passed by reference and out of stack or something like that. Full sample would help me to check the issue. Artyom On Mon, Apr 4, 2016 at 1:14 PM, CN <cn...@fa...> wrote: > The actual json::array passed to boost::bind() is a nested "deep" > object, like so: > > void m2(booster::shared_ptr<cppcms::rpc::json_call> requester > ,int size,const cppcms::json::array &ja) > { > cppcms::json::array a; > a.resize(3); > a[0]=cppcms::json::array(); > a[0].array().push_back("a"); > a[0].array().push_back(1); > a[1]=cppcms::json::array(); > a[1].array().push_back("b"); > a[2]=cppcms::json::array(); > a[2].array().push_back("c"); > ja.push_back(a); > io_service.post(boost::bind(&report_service::m1,this,requester,size,ja)); > } > > After restructuring my code, gdb now reports the location of segment > fault at line# 280 in json.cpp: > > memset(&m,0,sizeof(m)); > > If I comment out this line, my progam does not crash here any more. > > My question now is: > > With the line > static_cast<array *>(ptr())->~array(); > in place, is it necessary to call memset()? > > Best regards, > CN > > -- > http://www.fastmail.com - Or how I learned to stop worrying and > love email again > > > ------------------------------------------------------------------------------ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |
From: CN <cn...@fa...> - 2016-04-04 10:14:30
|
The actual json::array passed to boost::bind() is a nested "deep" object, like so: void m2(booster::shared_ptr<cppcms::rpc::json_call> requester ,int size,const cppcms::json::array &ja) { cppcms::json::array a; a.resize(3); a[0]=cppcms::json::array(); a[0].array().push_back("a"); a[0].array().push_back(1); a[1]=cppcms::json::array(); a[1].array().push_back("b"); a[2]=cppcms::json::array(); a[2].array().push_back("c"); ja.push_back(a); io_service.post(boost::bind(&report_service::m1,this,requester,size,ja)); } After restructuring my code, gdb now reports the location of segment fault at line# 280 in json.cpp: memset(&m,0,sizeof(m)); If I comment out this line, my progam does not crash here any more. My question now is: With the line static_cast<array *>(ptr())->~array(); in place, is it necessary to call memset()? Best regards, CN -- http://www.fastmail.com - Or how I learned to stop worrying and love email again |
From: val s. <v_...@ya...> - 2016-04-01 05:21:43
|
I try to deploy without success the sample "hello" on debian server 8 "Jessie"( NGINX 1.62, FastCGI and cppcms 1.0.5 are installed correctly) in an Oracle Virtual Box on my Macosx 10.11.4 . After starting the script file 'hello' and accessing server, the error 403 Forbidden was shown. Other test examples, where I did not use cppcms, work fine without such error while accessing server. I guess something wrong with permission access to the cppcms files. If anybody solved such problem, please give me a hand. Val Newbie in cppcms |
From: CN <cn...@fa...> - 2016-03-30 14:12:54
|
Hi! I have been calling cppcms::rpc::json_rpc_server::return_result(cppcms::json::array()); without any problem for a long time until the call is performed in the thread that runs booster::aio::io_service::run(). I have been stuck here for a week. Please help! Below is the simplified program in question. A vim formatted .cpp file is also attached to this message. class report_service { private: booster::aio::io_service io_service; void m1(booster::shared_ptr<cppcms::rpc::json_call> requester ,int size,cppcms::json::array ja) { requester->return_result(cppcms::json::array()); /* This crashes too: requester->return_result(ja); This doesn't crash: requester->return_result(cppcms::json::value()); */ } //Program silently terminates here. public: void start(){ io_service.run(); } void stop(){ io_service.stop(); } void m2(booster::shared_ptr<cppcms::rpc::json_call> requester ,int size,const cppcms::json::array &ja) { io_service.post(boost::bind(&report_service::m1,this,requester,size,ja)); /* This doesn't crash: requester->return_result(cppcms::json::array()); */ } }; class json_app : public cppcms::rpc::json_rpc_server { private: report_service *p_rs; void json_app::doit() { p_rs->m2(release_call(),2,cppcms::json::array()); /* This crashes too: p_rs->m2(release_call(),2,cppcms::json::value()); This doesn't crash: return_result(cppcms::json::array()); */ } public: json_app(cppcms::service &s,report_service *prs) : cppcms::rpc::json_rpc_server(s) ,p_rs(prs) { bind("doit",cppcms::rpc::json_method(&json_app::doit,this),method_role); } }; int main(int argc,char **argv) { cppcms::service *s=new cppcms::service(argc,argv); report_service rs; booster::thread t(boost::bind(&report_service::start,&rs)); s->applications_pool().mount(cppcms::create_pool<my_class>() ,cppcms::mount_point("(.*)",1) ,cppcms::app::synchronous | cppcms::app::prepopulated); s->run(); rs.stop(); t.join(); } Both gdb and valgrind reports that segmentation fault occurs at line# 264 in json.cpp. Below is part of the output from valgrind: ==22832== Invalid read of size 4 ==22832== at 0x4212B0D: destroy (json.cpp:264) ==22832== by 0x4212B0D: ~variant (json.cpp:135) ==22832== by 0x4212B0D: ~_data (json.cpp:286) ==22832== by 0x4212B0D: ~copy_ptr (copy_ptr.h:40) ==22832== by 0x4212B0D: cppcms::json::value::copyable::~copyable() (json.cpp:307) ==22832== by 0x807285B: ~value (json.h:538) ==22832== by 0x807285B: _Destroy<cppcms::json::value> (stl_construct.h:93) ==22832== by 0x807285B: __destroy<cppcms::json::value*> (stl_construct.h:103) ==22832== by 0x807285B: _Destroy<cppcms::json::value*> (stl_construct.h:126) ==22832== by 0x807285B: _Destroy<cppcms::json::value*, cppcms::json::value> (stl_construct.h:151) ==22832== by 0x807285B: std::vector<cppcms::json::value, std::allocator<cppcms::json::value> >::~vector() (stl_vector.h:424) ==22832== by 0x80B861B: booster::callback<void ()>::callable_impl<void, boost::_bi::bind_t<std::vector<cppcms::json::value, std::allocator<cppcms::json::value> >, boost::_mfi::mf3<std::vector<cppcms::json::value, std::allocator<cppcms::json::value> >, report_service, booster::shared_ptr<cppcms::rpc::json_call>, int, std::vector<cppcms::json::value, std::allocator<cppcms::json::value> > >, boost::_bi::list4<boost::_bi::value<report_service*>, boost::_bi::value<booster::shared_ptr<cppcms::rpc::json_call> >, boost::_bi::value<int>, boost::_bi::value<std::vector<cppcms::json::value, std::allocator<cppcms::json::value> > > > > >::operator()() (callback.h:219) ==22832== by 0x407CADE: booster::aio::event_loop_impl::completion_handler::op_handler(booster::aio::event_loop_impl::completion_handler*) (io_service.cpp:179) ==22832== by 0x407EE09: operator() (io_service.cpp:171) ==22832== by 0x407EE09: booster::aio::event_loop_impl::run_one(booster::aio::reactor::event*, unsigned int) (io_service.cpp:555) ==22832== by 0x407BC9E: run (io_service.cpp:232) ==22832== by 0x407BC9E: booster::aio::io_service::run() (io_service.cpp:722) ==22832== by 0x80B660F: report_service::listen_to_report_server() (report_service.cpp:305) ==22832== by 0x4109E84: operator() (function.h:168) ==22832== by 0x4109E84: booster_thread_func (pthread.cpp:48) ==22832== by 0x43DBEFA: start_thread (pthread_create.c:309) ==22832== by 0x4691DFD: clone (clone.S:129) ==22832== Address 0x387d0a1 is not stack'd, malloc'd or (recently) free'd ==22832== ==22832== ==22832== Process terminating with default action of signal 11 (SIGSEGV) ==22832== Access not within mapped region at address 0x387D0A1 ==22832== at 0x4212B0D: destroy (json.cpp:264) ==22832== by 0x4212B0D: ~variant (json.cpp:135) ==22832== by 0x4212B0D: ~_data (json.cpp:286) ==22832== by 0x4212B0D: ~copy_ptr (copy_ptr.h:40) ==22832== by 0x4212B0D: cppcms::json::value::copyable::~copyable() (json.cpp:307) ==22832== by 0x807285B: ~value (json.h:538) ==22832== by 0x807285B: _Destroy<cppcms::json::value> (stl_construct.h:93) ==22832== by 0x807285B: __destroy<cppcms::json::value*> (stl_construct.h:103) ==22832== by 0x807285B: _Destroy<cppcms::json::value*> (stl_construct.h:126) ==22832== by 0x807285B: _Destroy<cppcms::json::value*, cppcms::json::value> (stl_construct.h:151) ==22832== by 0x807285B: std::vector<cppcms::json::value, std::allocator<cppcms::json::value> >::~vector() (stl_vector.h:424) ==22832== by 0x80B861B: booster::callback<void ()>::callable_impl<void, boost::_bi::bind_t<std::vector<cppcms::json::value, std::allocator<cppcms::json::value> >, boost::_mfi::mf3<std::vector<cppcms::json::value, std::allocator<cppcms::json::value> >, report_service, booster::shared_ptr<cppcms::rpc::json_call>, int, std::vector<cppcms::json::value, std::allocator<cppcms::json::value> > >, boost::_bi::list4<boost::_bi::value<report_service*>, boost::_bi::value<booster::shared_ptr<cppcms::rpc::json_call> >, boost::_bi::value<int>, boost::_bi::value<std::vector<cppcms::json::value, std::allocator<cppcms::json::value> > > > > >::operator()() (callback.h:219) ==22832== by 0x407CADE: booster::aio::event_loop_impl::completion_handler::op_handler(booster::aio::event_loop_impl::completion_handler*) (io_service.cpp:179) ==22832== by 0x407EE09: operator() (io_service.cpp:171) ==22832== by 0x407EE09: booster::aio::event_loop_impl::run_one(booster::aio::reactor::event*, unsigned int) (io_service.cpp:555) ==22832== by 0x407BC9E: run (io_service.cpp:232) ==22832== by 0x407BC9E: booster::aio::io_service::run() (io_service.cpp:722) ==22832== by 0x80B660F: report_service::listen_to_report_server() (report_service.cpp:305) ==22832== by 0x4109E84: operator() (function.h:168) ==22832== by 0x4109E84: booster_thread_func (pthread.cpp:48) ==22832== by 0x43DBEFA: start_thread (pthread_create.c:309) ==22832== by 0x4691DFD: clone (clone.S:129) ==22832== If you believe this happened as a result of a stack ==22832== overflow in your program's main thread (unlikely but ==22832== possible), you can try to increase the size of the ==22832== main thread stack using the --main-stacksize= flag. ==22832== The main thread stack size used in this run was 8388608. Thank you in advance! Best regards, CN -- http://www.fastmail.com - A no graphics, no pop-ups email service |
From: mawan s. <ma...@gm...> - 2016-03-30 03:55:53
|
Dear All I want to capture array data from submited form via POST method. I get code like this .. cppcms::http::request::form_type data_post; std::pair <std::multimap<std::string,std::string>::iterator, std::multimap<std::string,std::string>::iterator> return_x; std::string field_name; field_name = "assigned_users_id"; data_post = request().post_or_get(); return_x = data_post.equal_range(field_name); for (std::multimap<std::string,std::string>::iterator it=return_x.first; it!=return_x.second; ++it) { response().out() << it->first << " is " << it->second << "<br/>"; } this is used for capture multiple select without mapping data from widget. For example, i want use select2 jquery to build tags. is this valid method? Thankyou |
From: mawan s. <ma...@gm...> - 2016-03-29 06:18:19
|
this is PHP method to download file step by step with limited speed. how to write in cppcms? $file1 = @fopen($filename,"rb"); $start = microtime (TRUE); if ($file1) { while(!feof($file1)) { print(fread($file1, 1024)); flush(); $now = microtime (TRUE); $count++; $ms = (($count/$speed) - ($now-$start))*1000; if (intval($ms)<10) { $ms = 50; } ob_flush(); if (connection_status()!=0) { ob_flush(); @fclose($file1); die(); } usleep ($ms); } @fclose($file1); } ob_flush(); die(); Thankyou On Sun, Mar 27, 2016 at 6:38 PM, Shiv Shankar Dayal < shi...@gm...> wrote: > I think that I will start with a synchronous application with thread > per connection and also have another version of asynchronous. I will > let both run and decide after serious testing and real world usage. > > The answer to the questions varies. We will have to try combinations > in real world before arriving at the solution. I think I will use FUSE > so that I can do X-Send-File which seems to be optimal for me. But > without real testing it is hard to say what approach will be final. > > Thanks a lot for all the help you have provided. I really appreciate it. > > On Sun, Mar 27, 2016 at 3:25 PM, Artyom Beilis <art...@gm...> > wrote: > >> The problem is that individual file will have rare downloads(usually > >> one file will be downloaded once a month or two) > >> and no. of downloads are large. So caching will not help. > >> They have to be read asynchronously and concurrently. I am not sure > >> that should I create booster::io::service or cppcms::service. Also, > >> I find it hard to create booster::io::service as its example is not > >> exhaustive. Even if I create booster::io::service the filesystem > >> calls may block. I will be using GlusterFS for storage. But that is > >> something not within CppCMS's domain so I will take care of > >> that. > > > > Got it, sorry I was mislead by previous question regarding the uploads. > > > > Regarding downloads. > > > > 1st if you run behind lighttpd or nginx web server (which you probably > > should do) I suggest > > to use X-Send-File stuff > > http://cppcms.com/wikipp/en/page/cppcms_1x_serving_static_files > > > > Also in such case you may need to mount GlusterFS via FUSE or NFS or > > use a special plugin > > (I've seen one for lighttpd) > > > > They do the best they can in serving static files - but you probably > > check the solution explicitly > > because maybe lighttpd or nginx are not optimized for GlusterFS as > > normal file system. > > > > --------------------------------------------------- > > > > If you use CppCMS's internal file server it can work in both sync and > async mode > > starting from CppCMS 1.2 but you'll need to use stuff like FUSE or NFS > > to mount file system. > > > > But in async mode if GlusterFS hangs in opening/reading file you may > block > > entire event loop. > > > > You can write your own application that does the job. > > > > Also note - if you don't have lots of concurrent downloads it may be > > simpler just to use thread per connection - in standard synchronous > > application as it would deal with both concurrency and "io optimization" > > > > if you do it asynchronously it can be tricky as if GlusterFS API may > block > > and it would stall entire event loop. So you need to handle it someway, > > i.e. use booster::aio::io_service to handle such and events (I assyme > > glusterfs API has some event driven handling) > > > > Also you should note that web server may read the request > > faster than it sends it to the client - lighttpd in such a case would > > put it into memory and nginx create its own temporary file > > so it can be tricky stuff - neither of them would block you from > > writing to client (AFAIR) - which can be bad for huge files. > > > > Bottom line several questions you need to answer: > > > > 1. Do you work with GlusterFS via FUSE/NFS or its own API? > > 2. What concurrency level do you expect? > > 3. What web server does when client does not read in same speed as you > send? > > > > > > Artyom > > > > > ------------------------------------------------------------------------------ > > Transform Data into Opportunity. > > Accelerate data analysis in your applications with > > Intel Data Analytics Acceleration Library. > > Click to learn more. > > http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140 > > _______________________________________________ > > Cppcms-users mailing list > > Cpp...@li... > > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > -- > Respect, > Shiv Shankar Dayal > > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |
From: Shiv S. D. <shi...@gm...> - 2016-03-27 11:38:09
|
I think that I will start with a synchronous application with thread per connection and also have another version of asynchronous. I will let both run and decide after serious testing and real world usage. The answer to the questions varies. We will have to try combinations in real world before arriving at the solution. I think I will use FUSE so that I can do X-Send-File which seems to be optimal for me. But without real testing it is hard to say what approach will be final. Thanks a lot for all the help you have provided. I really appreciate it. On Sun, Mar 27, 2016 at 3:25 PM, Artyom Beilis <art...@gm...> wrote: >> The problem is that individual file will have rare downloads(usually >> one file will be downloaded once a month or two) >> and no. of downloads are large. So caching will not help. >> They have to be read asynchronously and concurrently. I am not sure >> that should I create booster::io::service or cppcms::service. Also, >> I find it hard to create booster::io::service as its example is not >> exhaustive. Even if I create booster::io::service the filesystem >> calls may block. I will be using GlusterFS for storage. But that is >> something not within CppCMS's domain so I will take care of >> that. > > Got it, sorry I was mislead by previous question regarding the uploads. > > Regarding downloads. > > 1st if you run behind lighttpd or nginx web server (which you probably > should do) I suggest > to use X-Send-File stuff > http://cppcms.com/wikipp/en/page/cppcms_1x_serving_static_files > > Also in such case you may need to mount GlusterFS via FUSE or NFS or > use a special plugin > (I've seen one for lighttpd) > > They do the best they can in serving static files - but you probably > check the solution explicitly > because maybe lighttpd or nginx are not optimized for GlusterFS as > normal file system. > > --------------------------------------------------- > > If you use CppCMS's internal file server it can work in both sync and async mode > starting from CppCMS 1.2 but you'll need to use stuff like FUSE or NFS > to mount file system. > > But in async mode if GlusterFS hangs in opening/reading file you may block > entire event loop. > > You can write your own application that does the job. > > Also note - if you don't have lots of concurrent downloads it may be > simpler just to use thread per connection - in standard synchronous > application as it would deal with both concurrency and "io optimization" > > if you do it asynchronously it can be tricky as if GlusterFS API may block > and it would stall entire event loop. So you need to handle it someway, > i.e. use booster::aio::io_service to handle such and events (I assyme > glusterfs API has some event driven handling) > > Also you should note that web server may read the request > faster than it sends it to the client - lighttpd in such a case would > put it into memory and nginx create its own temporary file > so it can be tricky stuff - neither of them would block you from > writing to client (AFAIR) - which can be bad for huge files. > > Bottom line several questions you need to answer: > > 1. Do you work with GlusterFS via FUSE/NFS or its own API? > 2. What concurrency level do you expect? > 3. What web server does when client does not read in same speed as you send? > > > Artyom > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users -- Respect, Shiv Shankar Dayal |
From: Artyom B. <art...@gm...> - 2016-03-27 09:55:40
|
> The problem is that individual file will have rare downloads(usually > one file will be downloaded once a month or two) > and no. of downloads are large. So caching will not help. > They have to be read asynchronously and concurrently. I am not sure > that should I create booster::io::service or cppcms::service. Also, > I find it hard to create booster::io::service as its example is not > exhaustive. Even if I create booster::io::service the filesystem > calls may block. I will be using GlusterFS for storage. But that is > something not within CppCMS's domain so I will take care of > that. Got it, sorry I was mislead by previous question regarding the uploads. Regarding downloads. 1st if you run behind lighttpd or nginx web server (which you probably should do) I suggest to use X-Send-File stuff http://cppcms.com/wikipp/en/page/cppcms_1x_serving_static_files Also in such case you may need to mount GlusterFS via FUSE or NFS or use a special plugin (I've seen one for lighttpd) They do the best they can in serving static files - but you probably check the solution explicitly because maybe lighttpd or nginx are not optimized for GlusterFS as normal file system. --------------------------------------------------- If you use CppCMS's internal file server it can work in both sync and async mode starting from CppCMS 1.2 but you'll need to use stuff like FUSE or NFS to mount file system. But in async mode if GlusterFS hangs in opening/reading file you may block entire event loop. You can write your own application that does the job. Also note - if you don't have lots of concurrent downloads it may be simpler just to use thread per connection - in standard synchronous application as it would deal with both concurrency and "io optimization" if you do it asynchronously it can be tricky as if GlusterFS API may block and it would stall entire event loop. So you need to handle it someway, i.e. use booster::aio::io_service to handle such and events (I assyme glusterfs API has some event driven handling) Also you should note that web server may read the request faster than it sends it to the client - lighttpd in such a case would put it into memory and nginx create its own temporary file so it can be tricky stuff - neither of them would block you from writing to client (AFAIR) - which can be bad for huge files. Bottom line several questions you need to answer: 1. Do you work with GlusterFS via FUSE/NFS or its own API? 2. What concurrency level do you expect? 3. What web server does when client does not read in same speed as you send? Artyom |
From: Shiv S. D. <shi...@gm...> - 2016-03-27 08:18:37
|
The problem is that individual file will have rare downloads(usually one file will be downloaded once a month or two) and no. of downloads are large. So caching will not help. They have to be read asynchronously and concurrently. I am not sure that should I create booster::io::service or cppcms::service. Also, I find it hard to create booster::io::service as its example is not exhaustive. Even if I create booster::io::service the filesystem calls may block. I will be using GlusterFS for storage. But that is something not within CppCMS's domain so I will take care of that. Individual sizes will be ~200-300KB and few can be as large as ~20MB. Very rarely they can also be huge say ~1GB or more. I care about the small ones not the large ones. Also, how can I stream very large files i.e. serve as they are read in chunks before loading entirely in memory and support resumption of download in case of interruption. If you could provide a small example that would be a mighty help. On Sun, Mar 27, 2016 at 12:21 PM, Artyom Beilis <art...@gm...> wrote: >> The files are on filesystem. How should I do IO to ensure maximum >> concurrency? Is there any example available for this? I would be >> grateful for any help. >> > > Can you explain what exactly the issue you are having or problem you expect? > > In general CppCMS saves the files if they are big enough > using file system otherwise keeps them in memory > you can control the thresholds via config or dynamically in CppCMS 1.2. > > So what exactly the problem you expect? > > Artyom > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users -- Respect, Shiv Shankar Dayal |
From: Artyom B. <art...@gm...> - 2016-03-27 06:51:53
|
> The files are on filesystem. How should I do IO to ensure maximum > concurrency? Is there any example available for this? I would be > grateful for any help. > Can you explain what exactly the issue you are having or problem you expect? In general CppCMS saves the files if they are big enough using file system otherwise keeps them in memory you can control the thresholds via config or dynamically in CppCMS 1.2. So what exactly the problem you expect? Artyom |
From: Artyom B. <art...@gm...> - 2016-03-27 06:48:48
|
Thanks, it indeed looks like the issue that caused the test to fail in some cases. I'll fix it ASAP. Artyom On Fri, Mar 25, 2016 at 5:50 PM, Juergen Gleiss <jue...@gm...> wrote: > Hi, > > I've just upgraded my cppcms version to trunk (Rev. 2411), The test > plugin_test failed. I think I've found the error: > > Index: src/plugin.cpp > =================================================================== > --- src/plugin.cpp (Revision 2411) > +++ src/plugin.cpp (Arbeitskopie) > @@ -239,7 +239,7 @@ > path = so_name; > else > path = path + "/" + so_name; > - if(obj->open(so_name,dlflags)) > + if(obj->open(path,dlflags)) > break; > } > if(!obj->is_open()) { > > > Thanks for your work > > Jürgen |
From: Shiv S. D. <shi...@gm...> - 2016-03-26 17:30:20
|
Say I have lots of downloads coming in my server. The urls may look like http://localhost/uid/filename The files are on filesystem. How should I do IO to ensure maximum concurrency? Is there any example available for this? I would be grateful for any help. -- Respect, Shiv Shankar Dayal |
From: Juergen G. <jue...@gm...> - 2016-03-25 14:50:54
|
Hi, I've just upgraded my cppcms version to trunk (Rev. 2411), The test plugin_test failed. I think I've found the error: Index: src/plugin.cpp =================================================================== --- src/plugin.cpp (Revision 2411) +++ src/plugin.cpp (Arbeitskopie) @@ -239,7 +239,7 @@ path = so_name; else path = path + "/" + so_name; - if(obj->open(so_name,dlflags)) + if(obj->open(path,dlflags)) break; } if(!obj->is_open()) { Thanks for your work Jürgen |
From: Shiv S. D. <shi...@gm...> - 2016-03-24 21:59:01
|
Sorry about not reading your answer on last question carefully where you have explicitly said that file uploading is done in central event loop asynchronously. On Fri, Mar 25, 2016 at 3:03 AM, Shiv Shankar Dayal <shi...@gm...> wrote: > Hi, > > Say I am running cppcms with 8 worker process and worker threads set > to 1. Now let us say multiple uploads are coming which are large. Do I > need to handle that in CppCMS worker processes specifically or IO is > asynchronous in worker process sockets by default? Because if sockets > are read by worker processes then for large uploads only 8 concurrent > transfers would be possible in such configuration. > > -- > Respect, > Shiv Shankar Dayal -- Respect, Shiv Shankar Dayal |