-
Notifications
You must be signed in to change notification settings - Fork 149
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
[XrdTpc] Do not modify curl handle after curl_easy_cleanup() #1449
Conversation
Converted back to draft, as I suspect it's not a complete or correct fix:
If modifying the curl handle in |
When `ProcessPushReq()` and `ProcessPullReq()` return, `TPC::State::~State()` is called. The destructor modifies the curl handle, but the handle may already have been through `curl_easy_cleanup()`, and any further use may cause memory corruption. Put the curl handle into a unique_ptr for cleanup at function exit.
…erSize() or ~MultiCurlHandler() The curl handle comes from a State object, which is only "borrowing" a reference.
This is marked as a "draft" do you have person in mind to review it? |
I think @bbockelm would be the most likely person. With the most recent version of this patch, I've been unable to reproduce the crash with some limited TPC load testing at Nebraska, and also not finding any obvious memory leaks. I'm going to go ahead and mark it ready for review. |
I get back from vacation Thursday morning, so I should be able to look at it this week. |
@jthiltges & @bbockelm : do you have an estimate on how long it will take to resolve this PR? we are currently in the release process of |
@jthiltges - I can't apply patches directly to your branch, could you do the following:
Were you able to test multistreaming? If the multistream case looks good, I think it's ready to mereg. |
@bbockelm Could you review this to make sure nothing else remains and if you are happy, I'll merge it. Though, it would be good if @jthiltges verifies this works with multi-streaming as that seems to bite us a lot. |
Thank you for the changes. I've committed them above. I've focused on testing TPC with FTS transfers. If you can point me toward a way to test multistream, I'd be happy to work on it. |
Still not quite there with multistream. The State destructor modifies a curl handle after it's been free'd. Valgrind output
|
Free the state objects (calling the ~State() destructor, which modifies the curl handles) before the curl handles are free'd
With the latest commit, valgrind looks OK. Multistream testing looks OK as well. With 9x 10-stream transfers of a 4GB file, no errors were reported by FTS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jthiltges - did you observe any issues overnight? If not, I think this is probably ready to go. |
I didn't run this patched version overnight, but put it back onto a production server this morning. So far, it has run over three hours with no issues to note. |
@jthiltges OK, please give me a thumbs up at the end of the day and I'll merge it. Hopefully we will have fixed our CI problem by then. |
Everything looks OK on the production server. (I'll close and reopen the PR to trigger a CI rebuild.) |
Just one more thing. You will need to rebase before you push again
otherwise the build will fail.
Andy
…On Fri, 7 May 2021, jthiltges wrote:
Everything looks OK on the production server. (I'll close and reopen the PR to trigger a CI rebuild.)
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#1449 (comment)
########################################################################
Use REPLY-ALL to reply to list
To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1
|
When
ProcessPushReq()
andProcessPullReq()
leave scope,TPC::State::~State()
is called. The destructor modifies the curl handle, but the handle may already have been throughcurl_easy_cleanup()
, and any further use may cause memory corruption.Make the curl handle NULL after
curl_easy_cleanup()
.Valgrind output from xrootd-5.1.2-0.experimental.2534824.4ca38eb6.el7.cern.x86_64 and curl-7.29.0-59.el7_9.1.x86_64