lithium
lithium copied to clipboard
Segmentation Fault: 11 for static file over 100KB?
I have looked to the extent limited by my knowledge. But does anyone know why I get a segfault 11 when I try to access a file larger than 100KB? Perhaps with two extensions like scripts.bundle.js or widgets.min.css ?
Here is my code snippet
int main(int, char**) {
li::http_api api;
api.get("/{{path...}}") = [&](li::http_request& request, li::http_response& response){
response.write("hey it works");
};
api.add_subapi("/assets", li::serve_directory("./static/assets"));
li::http_serve(api, 8080);
}
File size should not be a problem as long as mmap accepts it. Probably a bug in extension handling. I'll check that. Thanks for the report.
@matt-42 Awesome project otherwise. I learnt a lot by just glancing through the library. There is absolutely no barriers to entry for anyone to kickstart using Lithium in their projects.
Also, the bug appears on MacOS Big Sur with the following compiler
clang version 11.1.0
Target: x86_64-apple-darwin20.3.0
Hi @harishperfect , Thanks for the feedback ! . It was probably a problem with files changing size while the server was running. I revamped the file serving code so there should not be any problems anymore. You can update to the last version of master.
@harishperfect actually just wait a bit before I merge the windows support into master (the fix is not in master yet). It will be done later this week.