From dev-return-58812-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Wed Jun 17 14:48:02 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3F4F1180608 for ; Wed, 17 Jun 2020 16:48:02 +0200 (CEST) Received: (qmail 10623 invoked by uid 500); 17 Jun 2020 14:48:01 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 10600 invoked by uid 99); 17 Jun 2020 14:48:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2020 14:48:01 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id BB2E640EDA for ; Wed, 17 Jun 2020 14:48:00 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 4059B7808B2 for ; Wed, 17 Jun 2020 14:48:00 +0000 (UTC) Date: Wed, 17 Jun 2020 14:48:00 +0000 (UTC) From: "Keith Turner (Jira)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (THRIFT-5230) Fix connection leak and CancelledKeyException when handling Epoll bug MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/THRIFT-5230?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D171= 38516#comment-17138516 ]=20 Keith Turner commented on THRIFT-5230: -------------------------------------- [~jensg] I can look into it. > Fix connection leak and CancelledKeyException when handling Epoll bug > --------------------------------------------------------------------- > > Key: THRIFT-5230 > URL: https://issues.apache.org/jira/browse/THRIFT-5230 > Project: Thrift > Issue Type: Bug > Components: Java - Library > Affects Versions: 0.13.0 > Environment: java version "1.8.0_161" > Reporter: zengji > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > 1. When Epoll bug occurs, the TThreadedSelectorServer.rebuildSelector reb= uilds only the channel has events, the idle connection was ignored and caus= ed connection leak > =C2=A0 > {code:java} > for (SelectionKey key : oldSelector.selectedKeys()) { > if (!key.isValid() && key.readyOps() =3D=3D 0) > continue; > SelectableChannel channel =3D key.channel(); > Object attachment =3D key.attachment(); > try { > if (attachment =3D=3D null) { > channel.register(newSelector, key.readyOps()); > } else { > channel.register(newSelector, key.readyOps(), attachment); > } > } catch (ClosedChannelException e) { > LOGGER.error("Register new selector key error.", e); > } > } > selector =3D newSelector; > try { > oldSelector.close(); > } catch (IOException e) { > LOGGER.error("Close old selector error.", e); > } > {code} > 2. When re-register the channel to new selector, the interested ops shoul= d same as before, not only the readyOps > =C2=A0 > 3. In the same code block, the channel will be registered to a new select= or and the previous selector will be closed, but the FrameBuffer is still h= olding the previous selector causing the=C2=A0FrameBuffer in a wrong state.= When the FrameBuffer is trying to processing the channel, it may occur a= =C2=A0CancelledKeyException.This issue (CancelledKeyException) has been rep= orted before:https://issues.apache.org/jira/browse/THRIFT-4847 -- This message was sent by Atlassian Jira (v8.3.4#803005)