dweepy icon indicating copy to clipboard operation
dweepy copied to clipboard

Not Thread-Safe

Open Meorge opened this issue 9 years ago • 7 comments

I'm trying to use dweepy for a program to create a Google Docs-style collaboration mode. However, it seems like I have to run it in a thread, which apparently is not good (it uses urllib/htmllib, which isn't thread-safe). Is there a way to port this to urllib3/htmllib2?

Meorge avatar Mar 25 '15 00:03 Meorge

I'd certainly like to fix this, maybe you can help me understand the issue a bit better.

dweepy uses the requests library for all of its HTTP calls (which I thought built on urllib3 but maybe i'm mistaken?). The only place I import from urllib is that i use the quote function when setting an alert.

Do you know what exactly is making the library unsafe?

paddycarey avatar Mar 25 '15 08:03 paddycarey

No, I don't think I know exactly what. Here's my traceback: http://pastebin.com/MJdRriyH From that, it looks like it's httplib not working in urllib3, but I'm not sure (I'm a relative novice in Python)

Meorge avatar Mar 25 '15 12:03 Meorge

Thanks for the traceback, I think I know what the issue is but i'll dig in more and hopefully should have a fix for this when i get some time over the next few days.

paddycarey avatar Mar 25 '15 14:03 paddycarey

Sounds great! Thanks for the quick response :smile:

Meorge avatar Mar 25 '15 22:03 Meorge

Do you know what the issue is?

Meorge avatar Apr 30 '15 01:04 Meorge

Sorry about the delay, I'm looking at this again now. I thought I knew what the issue was but I'm having trouble recreating on my own rig (Linux/AMD64). I've tried the same python and requests versions that I can see in your traceback but still can't get it to fail.

Could you possibly provide a more complete example of exactly what's failing for you? Just a quick function that I can run that shows the failing behaviour and I'll try to find a Mac to test it out on. Even better would be a failing test case, but I understand if you're not able to provide that.

paddycarey avatar May 01 '15 14:05 paddycarey

I just tried to make a small program that would give the error again, but it's actually working fine :
http://pastebin.com/Zc4S8g4K

Would I be able to send you the snippet of code in my program that's causing the error?

EDIT: just saw that it actually did print out an error - http://pastebin.com/9Ufi8mYX

Meorge avatar May 05 '15 23:05 Meorge