-
Notifications
You must be signed in to change notification settings - Fork 170
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
Remove the VLA from handle_connection() #109
base: master
Are you sure you want to change the base?
Conversation
I also now implemented the memory savings on glibc by requesting a reasonably small thread stack as proposed in #108. |
it only receives 8 bytes on f3c7a29 (tested on musl), no matter if
or it's still wip? @ me when you need me to test it. |
This fixes a segfault on musl libc with reasonable sized buffers, as musl's default thread stack size is quite small (128k since 1.1.21). A similar bug exists on glibc with large enough buffers (reproducable with e.g. 16MB on my test system). This commit fixes solusipse#108.
Returning from the start function of a thread is specified to implicitly call pthread_exit().
@dashezup: That was me missing that |
Nice 👍 , I've tested fcfcff9 on musl, it works properly, I can upload very huge text (like 1G, probably memory was full and can't add more in that case) |
// Cleanup | ||
free(c); | ||
free(slug); | ||
close(c->socket); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: This was broken before moving the cleanup to the exit
label because it called free(c)
before dereferencing c
.
This somewhat mitigates the problem that now the buffer is allocated in addition to the already allocated thread stack.
That was me changing the 16k of requested thread stack to the musl default of 128k. That should probably be safer and still less than the glibc default. |
This fixes a segfault on musl libc with reasonable sized buffers, as
musl's default thread stack size is quite small (128k since 1.1.21).
A similar bug exists on glibc with large enough buffers (reproducable
with e.g. 16MB on my test system).
This fixes #108.