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

lru-dict segfaults on use after being serialized/deserialized with pickle #17

Open
zmjjmz opened this issue Mar 20, 2017 · 1 comment
Open

Comments

@zmjjmz
Copy link

zmjjmz commented Mar 20, 2017

It's always a bit weird to hit a segfault in Python!

Here's a simple example that hits this issue:

import pickle                                             
from lru import LRU                                       
                                                          
key_limit = 10                                            
a = LRU(key_limit)                                        
for i in range(key_limit - 5):                            
    a[i] = key_limit - i                                  
print(a[0])                                               
                                                          
with open("/vol/data0/tmp/example_lru.pkl",'wb') as f:     
    print("Saving LRU")                                   
    pickle.dump(a, f, pickle.HIGHEST_PROTOCOL)            
                                                          
                                                          
with open("/vol/data0/tmp/example_lru.pkl",'rb') as f:     
    print("Loading LRU")                                  
    b = pickle.load(f)                                    
                                                          
print(b[0])                                               

Output:

10
Saving LRU
Loading LRU
Segmentation fault (core dumped)

Not sure if you've intended the LRU to survive serialization / deserialization, but if not I'd understand closing this.

Thanks!

@amitdev
Copy link
Owner

amitdev commented Mar 20, 2017

Serialization/deserialization is not supported, but I'll leave this ticket for sometime. Maybe someone (or I) might fix it later.

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

No branches or pull requests

2 participants