[Cppcms-users] Strange bug on reading files to response().out()
Brought to you by:
artyom-beilis
|
From: Julian P. <ju...@wh...> - 2010-10-20 19:36:20
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hallo,
for testing purposes I implemented a (very) basic static file server.
This server works very well on 64bit-architectures, but on 32bit
architectures larger files are only sent incompletely to the client and
the thread the request had been assigned to is blocked.
This is the code I use for reading file to out:
void StaticFileServer::static(std::string path) {
/* Some checks to get real path and check whether path is in a
specified webroot etc.*/
/* ... */
std::ifstream ifile(path.c_str());
if(ifile.good()) {
response().out() << ifile.rdbuf();
}
std::cout << "Static serving completed." << std::endl; // This one is
shown, so this method completes successfully
}
On 64bit, this code will read the file specified by path to the browser
that requests it, as it seems without matters of size (or perhaps I did
not try to send a file which was large enough), on 32bit and with larger
files, like e.g. the jquery.js of the jQuery library, it sents only part
of the file (file is interrupted abruptly) and closes connection, but
the thread still keeps blocked by the request (testing with
worker_threads set to 1, no further requests are possible, I think
because there are no threads left which are not busy). Termination with
SIGINT is not possible, the server application has to be killed by
SIGKILL. valgrind shows no significant errors.
Sending out ad-hoc generated HTML of any length (at least, of quite big
sizes) works without problems.
The cppcms::application subclass is mounted with a factory as
synchronous application.
I'm sorry that I can't provide you with more information because I
simply don't know what other helpful information I could get beside the
valgrind outputs which show no errors related to this problem. Of course
I will provide more information on your request.
Thanks for your help,
Julian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJMv0SrAAoJENidYKvYQHlQPF0QAJ1VlHxyBzio/FW46bq+xe1F
5/PliULKo9Wie3WhdS5F322HGmqY5G0ZemjoD61Xe+HBxf0C04TD0gT12vh7mN9Z
gaqV31T/Q4QjreVles3SwetT4Oc577w07p3rUekHr05eMhV6dSDwyphY/BEAgbzd
q811E1P8r2vaTRdfns7HDRq8lXw5Jf/fN2qwALUG02UUV7vHyGNZtMsHv8JostG2
EuamIzZpVxrZf1hJPW1HiLRMsG1fTKbyqxYoMMXFhSYN/v7rlb9zOhgpJWBAFlBw
uodrLzKkKDL8M7OxpzujYFitOfvfjs73cJxl2W3goRs/FfEwdWPiSlxlhPGl0ejQ
u29C/DgyF+tcm25iuPdZndLpKPlIw4W65Oey6j6nxI/oSwu+w6XWssPHsPIGUhiz
Ga7dxEjVrwf2qwDRgm+Tln3zjslEde9GcLnoZ7BcwNZen5e1iXHuOljRviKXUwyb
MTxwCHksnd0y8uo47VrDfVkab3l3h0AxkBV0ZlzGcYjLB1iD9XNJxztjVpswQ5Mr
D0dXmPWWKp2c0fzCUXZZ9qewvU1huwb+Tm/A2FGG/vYjPzH2jfp6UNBZlq7VrQvy
/YCvcFt438WQVpQgTf7Wwoh691YraRwHuFbgB1d+YlLcYMykp0pVaHHGTjOaiWRQ
oxGvgyFerP0SIXM/pABL
=Sbkl
-----END PGP SIGNATURE-----
|