Sort:  

Issue is fixed in https://github.com/holgern/beem/commit/7c8b53512ceedab73bb6388fb1fb02f3dd4ae557

The problem was the auto_clean function for the cache.

When using threads, auto_clean is now disabled with set_cache_auto_clean(False) and the cache is manually cleaned with clear_cache_from_expired_items() when all threads are finished.
When blocks() finishes, set_cache_auto_clean(auto_clean) is set to the old value.