Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation Fault: 11 for static file over 100KB? #72

Open
harishletsgo opened this issue Apr 17, 2021 · 4 comments
Open

Segmentation Fault: 11 for static file over 100KB? #72

harishletsgo opened this issue Apr 17, 2021 · 4 comments

Comments

@harishletsgo
Copy link

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);
}
@matt-42
Copy link
Owner

matt-42 commented Apr 21, 2021

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.

@harishletsgo
Copy link
Author

@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

@matt-42
Copy link
Owner

matt-42 commented Jun 1, 2021

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.

@matt-42
Copy link
Owner

matt-42 commented Jun 2, 2021

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants