searxng-docker icon indicating copy to clipboard operation
searxng-docker copied to clipboard

ERROR:searx.shared: uwsgi.ini configuration error

Open selhandesu opened this issue 2 years ago • 15 comments

Starting caddy ... done Starting searxng ... done Starting redis ... done Attaching to caddy, searxng, redis caddy | {"level":"info","ts":1656935488.7660024,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"} caddy | {"level":"warn","ts":1656935488.9061089,"logger":"caddyfile","msg":"Unnecessary header_up X-Forwarded-Proto: the reverse proxy's default behavior is to pass headers to the upstream"} caddy | {"level":"warn","ts":1656935488.933248,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2} caddy | {"level":"warn","ts":1656935488.9543805,"logger":"admin","msg":"admin endpoint disabled"} caddy | {"level":"warn","ts":1656935488.9673502,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80} caddy | {"level":"info","ts":1656935488.967129,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x25d94a0"} caddy | {"level":"info","ts":1656935489.0762522,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"} caddy | {"level":"info","ts":1656935489.0766792,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0x25d94a0"} caddy | run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: address already in use caddy exited with code 1 redis | 1:C 04 Jul 2022 11:51:46.580 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo redis | 1:C 04 Jul 2022 11:51:46.580 # Redis version=7.0.2, bits=32, commit=00000000, modified=0, pid=1, just started redis | 1:C 04 Jul 2022 11:51:46.580 # Configuration loaded redis | 1:M 04 Jul 2022 11:51:46.589 * monotonic clock: POSIX clock_gettime redis | 1:M 04 Jul 2022 11:51:46.591 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now. redis | 1:M 04 Jul 2022 11:51:46.598 * Running mode=standalone, port=6379. redis | 1:M 04 Jul 2022 11:51:46.599 # Server initialized redis | 1:M 04 Jul 2022 11:51:46.602 * Ready to accept connections searxng | SearXNG version 2022.07.02-4ef62637 searxng | Use existing /etc/searxng/uwsgi.ini searxng | Use existing /etc/searxng/settings.yml searxng | Listen on 0.0.0.0:8080 searxng | [uWSGI] getting INI configuration from /etc/searxng/uwsgi.ini searxng | [uwsgi-static] added mapping for /static => /usr/local/searxng/searx/static searxng | *** Starting uWSGI 2.0.20 (32bit) on [Mon Jul 4 11:51:49 2022] *** searxng | compiled with version: 11.2.1 20220219 on 21 December 2021 13:20:05 searxng | os: Linux-5.15.32-v7+ #1538 SMP Thu Mar 31 19:38:48 BST 2022 searxng | nodename: 64b995ef1690 searxng | machine: armv7l searxng | clock source: unix searxng | pcre jit disabled searxng | detected number of CPU cores: 4 searxng | current working directory: /usr/local/searxng searxng | detected binary path: /usr/sbin/uwsgi searxng | chdir() to /usr/local/searxng/searx/ searxng | your memory page size is 4096 bytes searxng | detected max file descriptor number: 1048576 searxng | building mime-types dictionary from file /etc/mime.types...1323 entry found searxng | lock engine: pthread robust mutexes searxng | thunder lock: disabled (you can enable it with --thunder-lock) searxng | *** Cache "searxngcache" initialized: 11MB (key: 2136 bytes, keys: 4272000 bytes, data: 8192000 bytes, bitmap: 250 bytes) preallocated *** searxng | uwsgi socket 0 bound to TCP address 0.0.0.0:8080 fd 4 searxng | Python version: 3.10.4 (main, Apr 30 2022, 16:49:16) [GCC 11.2.1 20220219] searxng | Python main interpreter initialized at 0x7691b7f0 searxng | python threads support enabled searxng | your server socket listen backlog is limited to 100 connections searxng | your mercy for graceful operations on workers is 60 seconds searxng | mapped 523040 bytes (510 KB) for 16 cores searxng | *** Operational MODE: preforking+threaded *** searxng | added /usr/local/searxng/ to pythonpath. searxng | spawned uWSGI master process (pid: 7) searxng | spawned uWSGI worker 1 (pid: 10, cores: 4) searxng | spawned uWSGI worker 2 (pid: 11, cores: 4) searxng | spawned 4 offload threads for uWSGI worker 1 searxng | spawned uWSGI worker 3 (pid: 17, cores: 4) searxng | spawned 4 offload threads for uWSGI worker 2 searxng | spawned uWSGI worker 4 (pid: 21, cores: 4) searxng | cache sweeper thread enabled searxng | spawned 4 offload threads for uWSGI worker 3 searxng | spawned 4 offload threads for uWSGI worker 4 searxng | 2022-07-04 11:52:00,403 ERROR:searx.shared: uwsgi.ini configuration error, add this line to your uwsgi.ini searxng | cache2 = name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1 searxng | 2022-07-04 11:52:00,403 ERROR:searx.shared: uwsgi.ini configuration error, add this line to your uwsgi.ini searxng | cache2 = name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1 searxng | 2022-07-04 11:52:00,403 ERROR:searx.shared: uwsgi.ini configuration error, add this line to your uwsgi.ini searxng | cache2 = name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1 searxng | 2022-07-04 11:52:00,403 ERROR:searx.shared: uwsgi.ini configuration error, add this line to your uwsgi.ini searxng | cache2 = name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1

selhandesu avatar Jul 04 '22 11:07 selhandesu

Same here

SebastianHanz avatar Jul 04 '22 15:07 SebastianHanz

i added env settings on setting.yml and error gone + using sudo

but now one more problem here i cant see anything localhost on my browser

limiter: true # can be disabled for a private instance image_proxy: true env = LANG=C.UTF-8 env = LANGUAGE=C.UTF-8 env = LC_ALL=C.UTF-8

selhandesu avatar Jul 04 '22 18:07 selhandesu

i added env settings on setting.yml and error gone + using sudo

but now one more problem here i cant see anything localhost on my browser

limiter: true # can be disabled for a private instance image_proxy: true env = LANG=C.UTF-8 env = LANGUAGE=C.UTF-8 env = LC_ALL=C.UTF-8

Can you clarify what change you made for it to work? Seeing the same error as you

ERROR:searx.shared: uwsgi.ini configuration error, add this line to your uwsgi.ini
searxng | cache2 = name=searxcache,items=2000,blocks=2000,blocksize=4096,bitmap=1

Adding the provided line to uwsgi.ini does not resolve it

adatamonk avatar Jul 05 '22 15:07 adatamonk

Is this problem resolved? Im having the same issue and none of the solutions here or in other threads seems to be working. Am I missing something?

sookis avatar Jul 07 '22 10:07 sookis

Adding the provided line to uwsgi.ini does not resolve it

Just to leave a hint: For what ever reasons, the uwsgi cache can't be used by SearXNG --> read https://github.com/searxng/searxng/issues/1399#issuecomment-1176632287

return42 avatar Jul 07 '22 10:07 return42

I have the same issue. Just a guess - sorry if this is dumb question - but is it possible that there is some kind of mismatch of the cache name somewhere in the code? Should it be searxcache, or searxngcache?

jacdyb avatar Jul 07 '22 10:07 jacdyb

Thanks for pointing out, we use https://docs.searxng.org/admin/installation-uwsgi.html#alltogether

cache2 = name=searxngcache,items=2000,blocks=2000,blocksize=4096,bitmap=1

TBH the source code does not select a named cache:

https://github.com/searxng/searxng/blob/df837d8b1b45d7386a1ab81f9b5da04baedc6274/searx/shared/init.py#L16-L17

The docs says: cache_name – The name of the cache in multiple cache mode is optional.

Please give it a try / even I think it would not help, it is worth to try ..

TBH I don't know what happens when in multiple cache mode .. @dalf do you have a clue?


OT: may be it is the time we move stats to the redis DB :-) .. (AFIAK there is also an issue with the cache and multiple workers)

return42 avatar Jul 07 '22 11:07 return42

I am having the same issue still. Has anyone found any solution to this? tried fresh installs multiple times, but no dice

panikedpineapple avatar Jul 15 '22 07:07 panikedpineapple

I am having the same issue still. Has anyone found any solution to this? tried fresh installs multiple times, but no dice

If your instance do work, don't care about this error message (its only used by the engine-checker and there is no need to run this checker on your instance) .. our plan is to remove the uwsgi cache and to use redis DB instead.

return42 avatar Jul 15 '22 08:07 return42

If your instance do work, don't care about this error message

My instance works, so I will stop caring about the error message ;) I also think that replacing uwsgi by redis DB is a very good decision. Thanks!

jacdyb avatar Jul 15 '22 17:07 jacdyb

my instance doesnt seem to work. when i try to connect, all i get a blank page. same issue as #27. Tried disabling the limiter but that doesnt seems to do anything. The instance is hosted on a aws instance and if i make any changes to .env file and generate the key, it just stops me from connecting completely. Reseting the changes to the .env file then does not fix this issue, neither does regenerating the key. it only gets fixed if i do a full reinstall.

panikedpineapple avatar Jul 16 '22 08:07 panikedpineapple

@selhandesu did you get your issue resolved? I've just followed NetworkChucks guide on youtube for private search engine which seems similar to your setup and although it worked at first, once I brought it down, I then received this error when bringing back up.

Creating network "searxng-docker_searxng" with the default driver
Creating searxng ... done
Creating caddy   ... done
Creating redis   ... done
Attaching to caddy, redis, searxng
caddy      | {"level":"info","ts":1660429113.541876,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
caddy      | {"level":"warn","ts":1660429113.5428343,"logger":"caddyfile","msg":"Unnecessary header_up X-Forwarded-Proto: the reverse proxy's default behavior is to pass headers to the upstream"}
caddy      | {"level":"warn","ts":1660429113.5437927,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
caddy      | {"level":"warn","ts":1660429113.544356,"logger":"admin","msg":"admin endpoint disabled"}
caddy      | {"level":"warn","ts":1660429113.544461,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
caddy      | {"level":"info","ts":1660429113.5559585,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
caddy      | {"level":"info","ts":1660429113.5559862,"msg":"serving initial configuration"}
caddy      | {"level":"info","ts":1660429113.5609725,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0001ace70"}
caddy      | {"level":"info","ts":1660429113.5610197,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}
caddy      | {"level":"info","ts":1660429113.561406,"logger":"tls","msg":"finished cleaning storage units"}
redis      | 1:C 13 Aug 2022 22:18:33.899 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis      | 1:C 13 Aug 2022 22:18:33.902 # Redis version=7.0.4, bits=64, commit=00000000, modified=0, pid=1, just started
redis      | 1:C 13 Aug 2022 22:18:33.902 # Configuration loaded
redis      | 1:M 13 Aug 2022 22:18:33.906 * monotonic clock: POSIX clock_gettime
redis      | 1:M 13 Aug 2022 22:18:33.907 * Running mode=standalone, port=6379.
redis      | 1:M 13 Aug 2022 22:18:33.907 # Server initialized
redis      | 1:M 13 Aug 2022 22:18:33.907 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis      | 1:M 13 Aug 2022 22:18:33.908 * Ready to accept connections
searxng    | SearXNG version 2022.08.13-e81c4581
searxng    | Use existing /etc/searxng/uwsgi.ini
searxng    | Use existing /etc/searxng/settings.yml
searxng    | Listen on 0.0.0.0:8080
searxng    | [uWSGI] getting INI configuration from /etc/searxng/uwsgi.ini
searxng    | [uwsgi-static] added mapping for /static => /usr/local/searxng/searx/static
searxng    | *** Starting uWSGI 2.0.20 (64bit) on [Sat Aug 13 22:18:34 2022] ***
searxng    | compiled with version: 11.2.1 20220219 on 21 December 2021 13:20:05
searxng    | os: Linux-5.15.0-43-generic #46-Ubuntu SMP Tue Jul 12 10:30:17 UTC 2022
searxng    | nodename: 66ea811f5208
searxng    | machine: x86_64
searxng    | clock source: unix
searxng    | pcre jit disabled
searxng    | detected number of CPU cores: 1
searxng    | current working directory: /usr/local/searxng
searxng    | detected binary path: /usr/sbin/uwsgi
searxng    | chdir() to /usr/local/searxng/searx/
searxng    | your memory page size is 4096 bytes
searxng    | detected max file descriptor number: 1048576
searxng    | building mime-types dictionary from file /etc/mime.types...1323 entry found
searxng    | lock engine: pthread robust mutexes
searxng    | thunder lock: disabled (you can enable it with --thunder-lock)
searxng    | *** Cache "searxngcache" initialized: 11MB (key: 2136 bytes, keys: 4272000 bytes, data: 8192000 bytes, bitmap: 250 bytes) preallocated ***
searxng    | uwsgi socket 0 bound to TCP address 0.0.0.0:8080 fd 4
searxng    | Python version: 3.10.5 (main, Jul 25 2022, 15:52:08) [GCC 11.2.1 20220219]
searxng    | Python main interpreter initialized at 0x7fd62f0fab50
searxng    | python threads support enabled
searxng    | your server socket listen backlog is limited to 100 connections
searxng    | your mercy for graceful operations on workers is 60 seconds
searxng    | mapped 241344 bytes (235 KB) for 4 cores
searxng    | *** Operational MODE: threaded ***
searxng    | added /usr/local/searxng/ to pythonpath.
searxng    | spawned uWSGI master process (pid: 6)
searxng    | spawned uWSGI worker 1 (pid: 9, cores: 4)
searxng    | cache sweeper thread enabled
searxng    | spawned 1 offload threads for uWSGI worker 1
searxng    | 2022-08-13 22:18:35,184 ERROR:searx.shared: uwsgi.ini configuration error, add this line to your uwsgi.ini
searxng    | cache2 = name=searxngcache,items=2000,blocks=2000,blocksize=4096,bitmap=1
searxng    | WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x7fd62f0fab50 pid: 9 (default app)
caddy      | {"level":"info","ts":1660429146.3335576,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"51.241.174.223","remote_port":"43718","proto":"HTTP/1.1","method":"GET","host":"avfunit.co.uk","uri":"/","headers":{"Dnt":["1"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (X11; CrOS x86_64 14816.99.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"],"Accept-Encoding":["gzip, deflate"],"Connection":["keep-alive"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Accept-Language":["en-GB,en;q=0.9"]}},"user_id":"","duration":0.00000409,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
caddy      | {"level":"info","ts":1660429146.4189067,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"51.241.174.223","remote_port":"43718","proto":"HTTP/1.1","method":"GET","host":"avfunit.co.uk","uri":"/favicon.ico","headers":{"Connection":["keep-alive"],"Dnt":["1"],"Accept":["image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"],"Referer":["http://avfunit.co.uk/"],"User-Agent":["Mozilla/5.0 (X11; CrOS x86_64 14816.99.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"],"Accept-Encoding":["gzip, deflate"],"Accept-Language":["en-GB,en;q=0.9"]}},"user_id":"","duration":0.000007581,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
caddy      | {"level":"error","ts":1660429321.4390032,"logger":"tls.issuance.acme","msg":"looking up info for HTTP challenge","host":"avfunit.co.uk","error":"no information found to solve challenge for identifier: avfunit.co.uk"}
caddy      | {"level":"error","ts":1660429321.4390645,"logger":"tls.issuance.acme","msg":"looking up info for HTTP challenge","host":"avfunit.co.uk","error":"no information found to solve challenge for identifier: avfunit.co.uk"}
caddy      | {"level":"info","ts":1660429321.43908,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"91.199.212.132","remote_port":"59212","proto":"HTTP/1.1","method":"GET","host":"avfunit.co.uk","uri":"/.well-known/acme-challenge/Ef4_rRLVcjINMxCZOHbMf30Cmn75MLoNSq4dj_ko-a0","headers":{"User-Agent":["acme.zerossl.com/v2/DV90"],"Cache-Control":["no-cache"],"Accept-Encoding":["gzip"],"Connection":["close"]}},"user_id":"","duration":0.000177326,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
caddy      | {"level":"info","ts":1660429683.2156134,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"51.241.174.223","remote_port":"43800","proto":"HTTP/1.1","method":"GET","host":"avfunit.co.uk","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (X11; CrOS x86_64 14816.99.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Connection":["keep-alive"],"Upgrade-Insecure-Requests":["1"],"Dnt":["1"],"Accept-Encoding":["gzip, deflate"],"Accept-Language":["en-GB,en;q=0.9"]}},"user_id":"","duration":0.000004321,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
caddy      | {"level":"info","ts":1660429683.2790196,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"51.241.174.223","remote_port":"43800","proto":"HTTP/1.1","method":"GET","host":"avfunit.co.uk","uri":"/favicon.ico","headers":{"Dnt":["1"],"Accept":["image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate"],"Accept-Language":["en-GB,en;q=0.9"],"Connection":["keep-alive"],"User-Agent":["Mozilla/5.0 (X11; CrOS x86_64 14816.99.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"],"Referer":["http://avfunit.co.uk/"]}},"user_id":"","duration":0.00000798,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
caddy      | {"level":"error","ts":1660429717.984809,"logger":"tls.issuance.acme","msg":"looking up info for HTTP challenge","host":"avfunit.co.uk","error":"no information found to solve challenge for identifier: avfunit.co.uk"}
caddy      | {"level":"error","ts":1660429717.984884,"logger":"tls.issuance.acme","msg":"looking up info for HTTP challenge","host":"avfunit.co.uk","error":"no information found to solve challenge for identifier: avfunit.co.uk"}
caddy      | {"level":"info","ts":1660429717.9848993,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"91.199.212.132","remote_port":"47906","proto":"HTTP/1.1","method":"GET","host":"avfunit.co.uk","uri":"/.well-known/acme-challenge/YE5Dp4QpHPMzjndNIxhYFF6wyypwQVcLXN9FhMMcJEE","headers":{"User-Agent":["acme.zerossl.com/v2/DV90"],"Cache-Control":["no-cache"],"Accept-Encoding":["gzip"],"Connection":["close"]}},"user_id":"","duration":0.000234137,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}

Murdo180 avatar Aug 13 '22 22:08 Murdo180

yes i follow the networkchuck's guide too. im already using openmedia vault and plex media server. i think there is a problem on web server port. the default web server port is 80. first open media vault takes 80, i think searxng try to get 80 port. i will change open media vault's port then i will change default web server port. After all this the 80 port is ready for searxng. but I haven't tried it yet, I'm lazy.

selhandesu avatar Aug 14 '22 06:08 selhandesu

I then received this error when bringing back up.

This error message can be safely ignored ...

searxng | 2022-08-13 22:18:35,184 ERROR:searx.shared: uwsgi.ini configuration error, add this line to your uwsgi.ini

return42 avatar Aug 14 '22 06:08 return42

Technical details:

The stacktrace:

Traceback (most recent call last):
  File "/usr/local/searxng/searx/shared/__init__.py", line 49, in initialize
    uwsgi.cache_update('dummy', b'dummy')
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

Detail of what is happening:

  • The docker image uses Alpine 3.16 which uses uwsgi version 2.0.20
  • uwsgi 2.0.20 does not support Python 3.10 : https://github.com/unbit/uwsgi/pull/2363
  • there is no newer version of uwsgi: https://pypi.org/project/uWSGI/#history

dalf avatar Aug 21 '22 08:08 dalf

uWSGI 2.0.21 is released. does it fix the issue?

ngosang avatar Oct 25 '22 17:10 ngosang

Yes, it was fixed since a long time with a patch I submitted on the uwsgi Arch Linux package that searxng-git was using. The uwsgi release definitely fixed the issue. This can be closed. On Arch Linux, the Trusted User maintaining the uwsgi package has removed the patch after the release.

HLFH avatar Nov 27 '22 16:11 HLFH