[ 
https://issues.apache.org/jira/browse/TS-4203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Peach resolved TS-4203.
-----------------------------
       Resolution: Fixed
         Assignee: James Peach
    Fix Version/s: 6.2.0

> 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
>            Assignee: James Peach
>             Fix For: 6.2.0
>
>
> {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)

Reply via email to