-
-
Notifications
You must be signed in to change notification settings - Fork 6
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 at line 756 of ngx_http_ubus_module.c #2
Comments
Yep I didn't implement the file logic stuff because normally you should never use ubus for very big request... wonder how uhttpd handles that... Can you check this? |
uhttpd seem to work in a complete different way, see code snippet below. As far as I have seen uh_ubus_data_send is called for each chunk of data, so it does not have this kind of problem. Probably there are very few users running into this problem, so as said before for me the best and simplest solution would be just throwing and error message case in->buf->pos == 0 suggesting to increase client_body_buffer_size. That would save to the time to identify the root cause for others
|
I'm using OpenWRT with nginx and luci_statistics on one of my devices and I am collecting data for quite a lot of other devices.
After adding another device the statistics overview page stopped working and I found messages in the syslog about signal 11 (SIGSEV) for nginx worker processes.
After compiling nginx with debug symbols and installing libc with debug symbols I was able to identify the origin with valgrind in line 756 of ngx_http_ubus_module.c, by the looks because in->buf->pos = 0.
After reading a little bit through the nginx API for ngx_http_read_client_request_body I figured out that this is related to client_body_buffer_size, which defaults on my device to 8192. If the request is bigger (in my case 11520) then it is stored in a temp file rather than in buffers.
From http://nginx.org/en/docs/dev/development_guide.html
"The body can be saved in memory buffers or file buffers, if the capacity specified by the client_body_buffer_size directive is not enough to fit the entire body in memory."
As a workaround I increased client_body_buffer_size to 128k, which solved the problem for me.
Probably it is not worth implementing the file read logic, as usually UBUS requests are pretty small. But I would suggest throwing an error message if in->buf->pos == 0, saying that client_body_buffer_size should be increased.
The text was updated successfully, but these errors were encountered: