[Cppcms-users] Segmentation fault
Brought to you by:
artyom-beilis
|
From: Mario P. <mp...@us...> - 2010-10-20 17:40:25
|
Hello,
I'm starting to use CppCMS ("cppcms-0.99.3.tar.bz2" downloaded from
SourceForge), and noticed that when generating very long responses, the
executable ends with a segfault. I am using the built-in server, and I reduced
the code to the following:
______________________________________________________________________________
/*
bench.cpp
*/
#include <cppcms/application.h>
#include <cppcms/applications_pool.h>
#include <cppcms/service.h>
#include <cppcms/http_response.h>
#include <iostream>
class bench : public cppcms::application
{
public:
bench(cppcms::service &srv) : cppcms::application(srv) { }
virtual void main(std::string url)
{
for (int i=0; i < 100000; ++i) {
response().out() << i << "\n";
}
}//main
};//class bench
int main(int argc, char *argv[])
{
try {
cppcms::service srv(argc, argv);
srv.applications_pool().mount(cppcms::applications_factory<bench>());
srv.run();
}
catch (const std::exception &e) {
std::cerr << e.what() << std::endl;
}
return 0;
}//main
______________________________________________________________________________
______________________________________________________________________________
/*
config.js
*/
{
"service": {
"api": "http",
"port": 8080,
},
"http": {
"script_names": [ "/bench" ],
},
}
______________________________________________________________________________
I start the application:
$ ./bench -c config.js
Then, I use "curl" to make a request:
$ curl http://localhost:8080/bench
And the application ("bench") terminates with a segmentation fault.
A backtrace shows that the last statement that is executed is the line 476 of
file "cgi_api.cpp" ('write_some()' in function 'connection::write()'), but so
far I have not gotten more information.
Can anyone else reproduce the problem? Can be solved if I use the latest
version in SVN? (I'll try to test soon with the latest version of the code).
Thank you for creating something as awesome as CppCMS. Regards,
Mario
|