You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/02/14 13:57:18 UTC
[jira] [Commented] (TS-4203) Multiple PD init/alloc in PollCont
[ https://issues.apache.org/jira/browse/TS-4203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15146533#comment-15146533 ]
ASF GitHub Bot commented on TS-4203:
------------------------------------
GitHub user oknet opened a pull request:
https://github.com/apache/trafficserver/pull/478
TS-4203: Multiple PD init/alloc in PollCont & setupPollDescriptor
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/oknet/trafficserver patch-7
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafficserver/pull/478.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #478
----
commit d80e70abeb5cac2f9e8ce18a2b6044ecfba0e3e5
Author: Oknet <xu...@gmail.com>
Date: 2016-02-14T12:53:47Z
remove 2nd init() call in PollCont
commit 9a19a7988fbdb2d3a38d092afee049e6c3c4be8d
Author: Oknet <xu...@gmail.com>
Date: 2016-02-14T12:56:22Z
remove 2nd init() call in setupPollDescriptor
----
> Multiple PD init/alloc in PollCont
> ----------------------------------
>
> Key: TS-4203
> URL: https://issues.apache.org/jira/browse/TS-4203
> Project: Traffic Server
> Issue Type: Bug
> Components: Core
> Reporter: Oknet Xu
>
> {code}
> struct PollDescriptor {
> int result; // result of poll
> .
> .
> .
> PollDescriptor *
> init()
> {
> result = 0;
> #if TS_USE_EPOLL
> nfds = 0;
> epoll_fd = epoll_create(POLL_DESCRIPTOR_SIZE);
> memset(ePoll_Triggered_Events, 0, sizeof(ePoll_Triggered_Events));
> memset(pfd, 0, sizeof(pfd));
> #endif
> #if TS_USE_KQUEUE
> kqueue_fd = kqueue();
> memset(kq_Triggered_Events, 0, sizeof(kq_Triggered_Events));
> #endif
> #if TS_USE_PORT
> port_fd = port_create();
> memset(Port_Triggered_Events, 0, sizeof(Port_Triggered_Events));
> #endif
> return this;
> }
> PollDescriptor() { init(); }
> };
> {code}
> the construct function of PollDescriptor calls init() to create a `epoll_fd'.
> the below code create PollDescriptor object then call init() again.
> {code}
> source: iocore/net/UnixNet.cc
> PollCont::PollCont(ProxyMutex *m, NetHandler *nh, int pt)
> : Continuation(m), net_handler(nh), nextPollDescriptor(NULL), poll_timeout(pt)
> {
> pollDescriptor = new PollDescriptor;
> pollDescriptor->init();
> SET_HANDLER(&PollCont::pollEvent);
> }
> {code}
> {code}
> source: iocore/net/UnixUDPNet.cc
> if (pc->nextPollDescriptor == NULL) {
> pc->nextPollDescriptor = new PollDescriptor;
> pc->nextPollDescriptor->init();
> }
> {code}
> The 2nd init() did not close epoll_fd if it is already opened.
> solution: simplely remove 2nd `init()'.
> do we need to transfer `init()' to private in the PollDescriptor ?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)