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

issues with exceptions #25

Closed
ejbatutis opened this issue May 21, 2016 · 1 comment
Closed

issues with exceptions #25

ejbatutis opened this issue May 21, 2016 · 1 comment

Comments

@ejbatutis
Copy link

ejbatutis commented May 21, 2016

Two issues I noticed:

  1. in your exception-raiser code you don't set the errno with the unqlite return code so an exception handler needs to examine the message - but this not easy to do because there is more than one message for a single unqlite error condition. You are forced to look through the .c file and extract strings, etc. Not much fun.

  2. I have code that handles exceptions by doing a retry. If there are N exceptions on a particular operation, the exception is finally raised. There must be a message buffer that is appended to, but never cleared out, so I end up with exception messages that look like this:


IOError: Another process or thread hold the requested lock           
Another process or thread have a reserved lock on this database      
Another process or thread hold the requested lock                    
Another process or thread have a reserved lock on this database      
Another process or thread hold the requested lock                    
Another process or thread have a reserved lock on this database      
Another process or thread hold the requested lock                    
Another process or thread have a reserved lock on this database      
Another process or thread hold the requested lock                    

The above is just one message, with those repeats in it. That actually might kind of be useful, possibly, I guess. But not super useful. More of a pain. If I do more than about ten retries on a
store or commit, python usually crashes with a segfault. I suspect this is related.

  1. I have seen an occasional file handle leak in my multi-process access exception testing. I am still working on coming up with a more consistently reproducible test case, but I thought I'd throw that out there as an FYI.

Thanks

@ejbatutis
Copy link
Author

ejbatutis commented May 23, 2016

If I run the following code from two different processes (on Debian), the processes leak file handles:


for i in range(1, 1000):
    sys.stdout.write('.')
    sys.stdout.flush()
    time.sleep(0.09)
    with unqlite.UnQLite('/tmp/dbname') as db:
        while True:
            try:
                db.store('testkey', 'testvalue')
            except Exception as exc:
                print str(exc)
                pass
            else:
                break

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

1 participant