Description of problem: pycurl is not always deallocated correctly when program using pycurl exits. That causes curl_easy_cleanup() not to get called, which results in cookies not getting written to a specified COOKIEJAR file. Attaching a script which reproduces the problem. It implements xmlrpclib transport using pycurl. It talks to RH bugzilla to log in, but the authentication cookie is not saved to the COOKIEJAR file. I verified with gdb that do_curl_dealloc() does not get called. I noticed that disabling HEADERFUNCTION callback fixes the problem. I do not believe the callback function in the script is incorrect. Using the same in a different / more simple script does not break module deallocation. Version-Release number of selected component (if applicable): python-pycurl-7.19.0-15.1.fc19.x86_64 libcurl-7.29.0-7.fc19.x86_64 python-2.7.5-3.fc19.x86_64
Created attachment 788197 [details] xmlrpclib pycurl transport This script demonstrates the issue. Pass your BZ user name as argument. Check cookies.txt file content after it exits (and empty it before running the test).
Created attachment 788198 [details] test that does not trigger the problem
Created attachment 788208 [details] better small tet I realized that my minimal test case did not match xmlrpclib one very well. This one should be better, and it does trigger the problem. I suspect the problem here actually comes from the script. It seems to create a loop in python object references (CURLHTTPRequest refers to pycurl.Curl instance and that instance refers back to the CURLHTTPRequest instance via reference to its method), which probably blocks garbage collection and proper module cleanup. Yeah, I won't be surprised if this is closed:notabug.
(In reply to Tomas Hoger from comment #3) > I suspect the problem here actually comes from the script. It seems to > create a loop in python object references (CURLHTTPRequest refers to > pycurl.Curl instance and that instance refers back to the CURLHTTPRequest > instance via reference to its method), which probably blocks garbage > collection and proper module cleanup. This is an issue with the python interpreter. Please consider calling the close() method on the curl object explicitly to work around the problem.
(In reply to Kamil Dudka from comment #4) > This is an issue with the python interpreter. Please consider calling the > close() method on the curl object explicitly to work around the problem. Calling close() is not really practical, as that would require changing several scripts that use a module that uses pycurl. I worked around by avoiding mentioned loop, which fixed the problem for me. I don't believe this is the right place to request python garbage collector change, so I'm closing this.