CMK version: 2.1.0p38
OS version: SLES15.4 and Ubuntu 22
Error message: Currently indexing, please try again shortly.
Output of “cmk --debug -vvn hostname”: n/a
I write lots of own plugins and recently I switched to the function _l()
instead of _()
for translation purposes because that seems the new (since 2.x) way to go for strings that are to be translated.
I use the _l()
function in my metrics and WATO plugins.
Since that time every now and then the search function in the setup menu ceases working and shows “Currently indexing, please try again shortly.” instead:
In ~/var/log/web.log
the following exception about an unexpected LazyString
appears:
2024-02-27 10:42:59,712 [40] [cmk.web.background-job 224677] Exception in background function
Traceback (most recent call last):
File "/omd/sites/testsite/lib/python3/cmk/gui/background_job.py", line 246, in _execute_function
func_ptr(*args, **kwargs)
File "/omd/sites/testsite/lib/python3/cmk/gui/watolib/search.py", line 496, in _build_index_background
IndexBuilder(match_item_generator_registry).build_full_index()
File "/omd/sites/testsite/lib/python3/cmk/gui/watolib/search.py", line 244, in build_full_index
self._build_index(self._registry.values())
File "/omd/sites/testsite/lib/python3/cmk/gui/watolib/search.py", line 129, in _build_index
self._do_build_index(match_item_generators)
File "/omd/sites/testsite/lib/python3/cmk/gui/watolib/search.py", line 156, in _do_build_index
pipeline.execute()
File "/omd/sites/testsite/lib/python3.9/site-packages/redis/client.py", line 2120, in execute
return conn.retry.call_with_retry(
File "/omd/sites/testsite/lib/python3.9/site-packages/redis/retry.py", line 46, in call_with_retry
return do()
File "/omd/sites/testsite/lib/python3.9/site-packages/redis/client.py", line 2121, in <lambda>
lambda: execute(conn, stack, raise_on_error),
File "/omd/sites/testsite/lib/python3.9/site-packages/redis/client.py", line 1964, in _execute_transaction
all_cmds = connection.pack_commands(
File "/omd/sites/testsite/lib/python3.9/site-packages/redis/connection.py", line 920, in pack_commands
for chunk in self._command_packer.pack(*cmd):
File "/omd/sites/testsite/lib/python3.9/site-packages/redis/connection.py", line 560, in pack
for arg in map(self.encode, args):
File "/omd/sites/testsite/lib/python3.9/site-packages/redis/connection.py", line 116, in encode
raise DataError(
redis.exceptions.DataError: Invalid input of type: 'LazyString'. Convert to a bytes, string, int or float first.
I tried to increase the loglevel but that didn’t help. Maybe I picked the wrong loglevel or debug setting because there are so many of them.
The other posts here (e.g. Search Index in Setup is not working) didn’t help either because they say it was a broken MKP and the exception is a different one.
Strange thing is: if I switch back to an older version of my MKP (without the _l()
function) and then again switch back to my latest MKP (with _l()
), then the search function works again.
Is this a known problem?