SOLVED: Searx 500 Internal Server Error

Solution

add the following line to /etc/uwsgi/apps-available/searx.ini

buffer-size = 5120

Reference

uWSGI Options [uwsgi-docs.readthedocs.io]

Root Cause

searx preference changes made from the seax web page may create a request which exceeds the uwsgi buffer size. If the problem comes back you can check the request size in /var/log/uwsgi/app/searx.log filtering for error messages similar to this:

at May 6 09:36:14 2023 - invalid request block size: 4604 (max 4096)…skip

You would then add a bit more to than 4604 to estimate a new buffer size to allow that searx request. I am going up from the default of 4096 in steps of 125% (4096 to 5120). The uwsgi documentation suggest that this approach is more sensible than just maxing-out the request size.

update 6 may: adding UWSGI_BUFFER_SIZE=5120 did not solve the problem. Here is a log entry for request block size <5120 and uwsgi logging max of 4096 rather than 5120.

  • added UWSGI_BUFFER_SIZE=5120 to /etc/init.d/uwsgi
  • stopped searx, radicale, and bepasty services
  • stopped uwsgi service
  • started uwsgi service
  • started searx service

at May 6 09:36:14 2023 - invalid request block size: 4604 (max 4096)…skip

quick workaround: delete your freedombox cookies from your browser to revert to default searx client configuration for your browser.

point of suspicion: error in /var/log/uwsgi/app/searx.log:

Sun Apr 30 20:10:00 2023 - invalid request block size: 4612 (max 4096)…skip

perhaps the uwsgi buffer is undersized?

Problem Description
When setting search engines for searx using the client web GUI (my.freedombox.rocks/searx) I will receive a 500 error.

Steps to Reproduce

  1. log in to freedombox
  2. go to the searx application shortcut
  3. select the searx preferences link in the upper right corner
  4. select the engines tab
  5. selecting all video search providers seems to be a reliable way to generate this error.

Expected Results
After a successful configuration change is saved the browser returns to the searx query page.

Actual results
I receive a 500 error in the web browser

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.


Apache/2.4.56 (Debian) Server at

Error in /var/log/uwsgi/app/searx.log:

Sun Apr 30 20:10:00 2023 - invalid request block size: 4612 (max 4096)…skip

Screenshot

Information

  • FreedomBox version:

You are running Debian GNU/Linux 11 (bullseye) and FreedomBox version 23.6. FreedomBox is up to date.

  • Hardware: Supermicro A2SDi-2C-HLN4F board with Intel Atom C3338, intel chipset
  • How did you install FreedomBox?:
  1. debian stable net-inst
  2. DEBIAN_FRONTEND=noninteractive apt-get install -y freedombox (more than a year ago)

Analysis:

I’m willing to try setting the buffer to a larger size, say 8192. I have memory to spare and I think my FreedomBox can could deal with doubling this size to eliminate this as a source of the problem. It appears that uwsgi uses a global configuration in /etc/init.d/uwsgi where I see no explicit UWSGI_BUFFER_SIZE set. I’m not sure if this will wreck my server, though.

Might be related to this report?

I think that is a separate issue. The error @ciamx describes is shown on the searX results page…

**Actual results:
Error! Engines cannot retrieve results.
bing (HTTP error), wikipedia (HTTP error), google (HTTP error), wikidata (HTTP error)
Please, try again later or find another searx instance.

In the issue I’m describing there is an HTTP 500 error before this page gets generated. I think in the error message quoted above here it looks like there are no results because the FreedomBox can’t communicate to a server which has a search result. HTTP error communicating to google sounds like a search query could not have been sent for some reason.

Yep. What I get for perusing the forums before my first cup.