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

libevent keepalive memery leak problem solve #997

Closed
huzhiguang opened this issue Aug 28, 2013 · 4 comments
Closed

libevent keepalive memery leak problem solve #997

huzhiguang opened this issue Aug 28, 2013 · 4 comments
Assignees

Comments

@huzhiguang
Copy link
Contributor

HHVM keepalive run the memory leak problem,libevent version is release-1.4.14b-stable,we have solved this problem:
edit libevent file http.c in 2320 lines add codes:

  req->userdone = 1 ;

The specific content of the code:

  static void  evhttp_handle_request(struct evhttp_request *req, void *arg)
 {
    struct evhttp *http = arg;
    struct evhttp_cb *cb = NULL;

    event_debug(("%s: req->uri=%s", __func__, req->uri));
    if (req->uri == NULL) {
            event_debug(("%s: bad request", __func__));
            if (req->evcon->state == EVCON_DISCONNECTED) {
                    /*liulei edit
                      solve keepalive memery leak
                      huzhiguang add note
                      this code is solve keepalive memery leak problem
                      */
                    req->userdone = 1 ;
                    evhttp_connection_fail(req->evcon, EVCON_HTTP_EOF);
            } else {
                    event_debug(("%s: sending error", __func__));
                    evhttp_send_error(req, HTTP_BADREQUEST, "Bad Request");
            }
 .............

We have tested ,you can add in your libevent patch.

@scannell
Copy link
Contributor

Thanks. Can you submit a pull request for this? Just add the extra line of code, not the comment; the comment should be in the commit message, we can find it in the git history.

@huzhiguang
Copy link
Contributor Author

sorry,I didn't make a patch, I directly to the http.c,I also is looking at adding patch information,but I'm afraid to wrong,so can you help me to change libevent patch file ,and then tell me the patch location changes, I'll submit a pull request,file location I have to tell you,do you think is that ok?Thanks

@scannell
Copy link
Contributor

The diff file in the repository is at:

hphp/third_party/libevent-1.4.14.fb-changes.diff

the easiest way to do this is probably to apply the .diff to a libevent repository, make the change to the file, and then create a new diff -- if the file is under git source control, you can probably just 'git diff' and the output will be the new .diff file. You can test this by applying your new .diff file to an unpatched libevent and see if the file(s) are correct after applying the new diff file.

@ghost ghost assigned sgolemon Aug 29, 2013
@sgolemon
Copy link
Contributor

I've integrated your fix into the libevent patch and am just testing it now. Should hit the public repo within the hour.

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

3 participants