Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stacks on close() while code compiled as cdylib #8

Open
Numenorean opened this issue Dec 25, 2021 · 1 comment
Open

Stacks on close() while code compiled as cdylib #8

Numenorean opened this issue Dec 25, 2021 · 1 comment

Comments

@Numenorean
Copy link

It's great that with your lib i can do such things

lazy_static! {
    static ref CACHE: Cache<String, TcpStream> = {
        let cache = Cache::new(12000, 1e6 as i64).unwrap();
        cache
    };
}

But there is 2 issues while compiling code as cdylib:

  1. Without cache.close() in DLL_PROCESS_DETACH (yeah, my lib is for windows), it just throws some kind of error, which rust detects while I loading this dll - STATUS_ACCESS_VIOLATION. In another programs this issues cause whole program crash
  2. I find out to prevent that issue i need to call cache.close() in order to clear some memory, stop additional threads, but now it just stacks on closing and do nothing until I kill process
    I really need your help, because i literally can't find another in-memory cache which can be defined as global value with lazy_static
@al8n
Copy link
Owner

al8n commented Dec 27, 2021

Hi, there is a method wait which can help you wait for all of the items in the write buffer to be written in the cache (If you have not tried this method). Have you tried to compile the related code on linux? I need to fix out whether it is a bug of Stretto. Or, could you give a piece of example code to help me reproduce the crash situation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants