Re: [Cppcms-users] Q&A: async gzip and mount
Brought to you by:
artyom-beilis
|
From: Markus R. <us...@ma...> - 2013-03-11 20:17:13
|
Hello!
Btw, this code (also seen in many other examples floating around):
> booster::intrusive_ptr<async> c (new async(app));
> app.applications_pool().mount(c, cppcms::mount_point("/async(/(.*))?",
> 1));
typically crashes here at shutdown because intrusive_ptr holds the async
object longer then the app itself which may lead to shutdown crashes like:
#0 0x00007f5028e9e624 in cppcms::application::root() () from
/usr/lib/libcppcms.so.1
#1 0x00007f5028e9ea93 in
booster::intrusive_ptr_release(cppcms::application*) () from
/usr/lib/libcppcms.so.1
#2 0x0000000000404a1d in booster::intrusive_ptr<async>::~intrusive_ptr() ()
#3 0x000000000040263b in main ()
or
#0 0xb7a71587 in cppcms::applications_pool::put(cppcms::application*) ()
from /usr/lib/libcppcms.so.1
#1 0xb7a73c4e in booster::intrusive_ptr_release(cppcms::application*) ()
from /usr/lib/libcppcms.so.1
#2 0x08494f40 in
booster::intrusive_ptr<LVDC_service::Scan_data_service>::~intrusive_ptr
(this=0xb4f2c21c, __in_chrg=<optimized out>) at
/home/markus/LVDC/dev/lvdc/lvdc_pp/../../libs/booster/include/booster/intrusive_ptr.h:68
also wrong would be to put above two lines in a scope, or having
booster::intrusive_ptr<async> c (new async(app));
because then the application would not be mounted correctly and it would
lead to a 404 Not found.
Intrusive ptr is hardly documented (neither in booster nor in boost),
so here would be a (imho) correct version:
145 cppcms::service app(argc,argv);
146 {
147
app.applications_pool().mount(cppcms::applications_factory<myapp>(),
cppcms::mount_point("/myapp(/(.*))?", 1));
148
app.applications_pool().mount(cppcms::applications_factory<numbers>(),
cppcms::mount_point("/numbers(/(.*))?", 1));
149
app.applications_pool().mount(cppcms::applications_factory<letters>(),
cppcms::mount_point("/letters(/(.*))?", 1));
150
151 booster::intrusive_ptr<async> c (new async(app));
152 app.applications_pool().mount(c,
cppcms::mount_point("/async(/(.*))?", 1));
153
app.applications_pool().mount(cppcms::applications_factory<sync>(),
cppcms::mount_point("/sync(/(.*))?", 1));
154 app.run();
155 }
That would terminate the async object after app.run() but before service is
deallocated. Please correct me if I am wrong.
best regards
Markus Raab
P.s. sorry for missing debug symbols, I could not find a libcppcms-dbg
debian package?
And what is http://apt.cppcms.com/dists/squeezy? Do you mean wheezy?
|