** Reference **
- Refer to this support post for additional details and documentation of this solution for users while a permanent correction such as this is not available.
- searx bug report on github
- searx bug report is moved to discussion
Summary
A user should be able to select search engines in searx preferences, up to and including every search engine, without causing an error. searx preference changes made from the UI may create a request which is larger than uwsgi is configured to accept.
Problem
You may recreate this problem by:
- Remove all of your Freedombox cookies set in your web browser.
- Log in to Freedombox
- Use the searx application shortcut to browse to the searx page (this app may need to be enabled first).
- Select the preferences link.
- Select the Engines option.
- Click the Allow All button to select all search engines in the General section. Do not select save.
- Proceeding through each category of engines click the Allow All button without saving.
- By now you have enabled every search engine configured for use with Searx.
- Now press the Save button at the bottom of the preferences page.
- You will likely get a 500 error from Searx.
- Subsequent visits to the Searx app page will result in a 500 error until your Freedombox cookies are removed.
You will see an error logged in /var/log/uwsgi/app/searx.log which indicates a request has been ignored because of the request size being over the configured limit:
at May 6 09:36:14 2023 - invalid request block size: 4604 (max 4096)…skip
This error indicates that uwsgi has ignored a request of 4604 bytes because it is larger than the default maximum of 4096 bytes. Larger values may be configured to allow such a request. A reasonable upper limit should be determined as indicated in the [uSWGI Options documentation(uWSGI Options — uWSGI 2.0 documentation).
The unfortunate user encountering this problem will continue to see 500 errors with their search page until they delete their web browser cookie containing the searx preference configuration. Deleting the cookie will reset the searx preferences to the defaults causing them to lose any improvements made to their searx experience up to the moment that they trigger a request of greather than 4096 bytes.
Solution
Modify the contents of /etc/uwsgi/apps-available/searx.init to allow a larger request size. I am having initial success by adding this line to searx.ini
buffer-size = 5120
This is an increase of 25% over the default and is about 8% larger than my largest logged request. Without understanding the maximum request size possible to generate from preferences this value would at least reduce the frequency of the 500 error for users enabling every search engine if not correct the issue completely. There is an increasing risk as the buffer-size is increased beyond the necessary amount as indicated in the linked uWSGI documentation.
Screenshots/Layouts
Error message saving preferences before the uwsgi buffer-size change…
https://discuss.freedombox.org/uploads/default/original/2X/8/8fb453ef41300ed78b8f87545294820ac88272d1.png
Success after setting uwsgi buffer-size as described above:
Alternatives
Setting the UWSGI_BUFFER_SIZE=5120 environment variable in /etc/init.d/uwsgi did not correct the issue for searx in my case.
Tasks
- determine an acceptable upper limit to searx preference request size for uwsgi to allow
- update the /etc/uwsgi/apps-available/searx.ini file in the package adding a
buffer-size
option sufficient to allow the upper limit searx preference change request
Diffs
===================================================================
RCS file: RCS/searx.ini,v
retrieving revision 1.1
diff -r1.1 searx.ini
11a12,14
> # increase buffer size from 4096 for larger searx requests
> buffer-size = 5120
>