question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clear Cache Fails (redis error)

See original GitHub issue

Description of the issue

Throws a redis error while clearing cache This is after updating to the latest versions mentioned below I had to edit frappe.desk.notifications.get_notification_config to return the value bypassing redis to get it working for now

Output of bench version

erpnext 12.1.7
frappe 12.0.17

Steps to reproduce the issue

  1. Update to latest version
  2. bench --site all clear-cache and clearing cache from within frappe ui causes this to be thrown

Stacktrace / full error message

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/faztp12/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/faztp12/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/faztp12/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/faztp12/frappe-bench/apps/frappe/frappe/commands/utils.py", line 48, in clear_cache
    frappe.clear_cache()
  File "/home/faztp12/frappe-bench/apps/frappe/frappe/__init__.py", line 566, in clear_cache
    frappe.cache_manager.clear_user_cache()
  File "/home/faztp12/frappe-bench/apps/frappe/frappe/cache_manager.py", line 31, in clear_user_cache
    clear_notifications(user)
  File "/home/faztp12/frappe-bench/apps/frappe/frappe/desk/notifications.py", line 120, in clear_notifications
    config = get_notification_config()
  File "/home/faztp12/frappe-bench/apps/frappe/frappe/desk/notifications.py", line 198, in get_notification_config
    return frappe.cache().hget("notification_config", frappe.session.user, _get)
  File "/home/faztp12/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 172, in hget
    value = super(RedisWrapper, self).hget(_name, key)
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/redis/client.py", line 1963, in hget
    return self.execute_command('HGET', name, key)
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/redis/client.py", line 668, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/redis/client.py", line 680, in parse_response
    response = connection.read_response()
  File "/home/faztp12/frappe-bench/env/lib/python3.6/site-packages/redis/connection.py", line 629, in read_response
    raise response
redis.exceptions.ResponseError: WRONGTYPE Operation against a key holding the wrong kind of value

Additional information

Ubuntu 18.04 Frappe Manual Installation

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
Thunderbottomcommented, Oct 25, 2019

a workaround for this would be to flush the redis cache through the console for now:

frappe.cache().flushall()

1reaction
Thunderbottomcommented, Nov 27, 2019

Well, to be honest, it wont necessarily happen to all the servers. There’s one thing we can do to gracefully clear the cache. Let me look into it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: redis error with cache:clean - Magento Forums
Greetings,. How do I clear cache without Redis? Which directories are cleared with cache:clean? I restored a 2.2.6 backup got this message.
Read more >
How To Clear Redis Cache from Command Line (2 Easy ...
[…] this happens, clearing the cache is a simple remedy that ought to be all you need to solve the problem and get...
Read more >
Azure Cache for Redis common error FAQs - Microsoft Learn
This message indicates that a management operation, like scaling or patching, is in progress on your cache. All other management operations are blocked...
Read more >
How Do I Clear Redis Data? - 华为云
Exercise caution when clearing data.Redis 3.0Data of a DCS Redis 3.0 instance cannot be cleared on the console, and can only be cleared...
Read more >
Error detection and handling with Redis - IBM Developer
Detect errors while performing Redis commands ... A typical use-case is to use Redis as a cache. Your application will attempt to fetch...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found