Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 54E02200C69 for ; Sat, 6 May 2017 22:16:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 478CC160BAD; Sat, 6 May 2017 20:16:59 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 62751160B9F for ; Sat, 6 May 2017 22:16:58 +0200 (CEST) Received: (qmail 12523 invoked by uid 500); 6 May 2017 20:16:57 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 12511 invoked by uid 99); 6 May 2017 20:16:56 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 May 2017 20:16:56 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 7F08118832E for ; Sat, 6 May 2017 20:16:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.879 X-Spam-Level: * X-Spam-Status: No, score=1.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id EyyPxRzhFsUU for ; Sat, 6 May 2017 20:16:54 +0000 (UTC) Received: from mail-oi0-f51.google.com (mail-oi0-f51.google.com [209.85.218.51]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 44F3B5F397 for ; Sat, 6 May 2017 20:16:53 +0000 (UTC) Received: by mail-oi0-f51.google.com with SMTP id h4so17900724oib.3 for ; Sat, 06 May 2017 13:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=1vWLbpz8rVaExKtQU7oeDPuJFOQP+WIPo4fXU/k6DDk=; b=tpjBrTkxPsMXzf5cVsXU5p8PX8Rbrt/N2big70fn6uxkCnRDVjx2IKCtRZWKgROEhn g+NqGGiI61V9L3RsRVj0i0kQ8LrGM9yF1eVX5i3Rdt/mPX2w9U0IBMHKwRMp+8e8HaTM VktiCdLs7cVfhn37OrIksVhIMnPWV7vgjZrBuUJmPrDa45UNynifx9mSVtn/iX9sxjU8 hhtsJ51ISJbBlQaeyVtTxXRvcJ0d4Jv/NM29WKob2whHTjfBXdw2TqlEVaj9Y8rQNf6i mewtMH1/QwroAfOsMrRLcNGKgmEdrJe6n5k4JYjXnJwmndbwP+/OFcPIgkOk2zyLiZ4p OyLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=1vWLbpz8rVaExKtQU7oeDPuJFOQP+WIPo4fXU/k6DDk=; b=RNoeqB4BseJO6hoPnL5bJFUIY6iNp+oH3pIQOCfNGoBC+6U3UlTsOG10ahJSG3IrlM 9IdAY+1sdOKB1/EOzPfYSQNhB3ZvmifndD67SimkweJp5cuacehQVxuaQYNZzybvRizJ rj3WZrfO56HJ5ClSB/n+5fyrxHy4taaktlSE1kwnUaOfNA4FAKhtUn+w3QBH6EHvEU16 +Axv3LByPikacuzutyg6zsAmUV+wQOV2NgMgSeDlJoL3hNK5HObuBFN+sRgJB4i5CxVu qPlBijFfkdEeEI9HHW3wt1uC51BJw0mBCRkGqqkz1D7t33Uam7pp9/OGBfr7UXr5y409 21Ng== X-Gm-Message-State: AN3rC/5YOcyxers74PlhAFgc9+Vasf9zcvkJzzXGkuHggi/tqb4BknfM xu5D0Di85GlDyZRlJUTNuPyEyYRadhgr1Xc= X-Received: by 10.202.106.148 with SMTP id f142mr3778658oic.16.1494101811919; Sat, 06 May 2017 13:16:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.56.18 with HTTP; Sat, 6 May 2017 13:16:51 -0700 (PDT) In-Reply-To: <1494060419.18357.5.camel@apache.org> References: <1494060419.18357.5.camel@apache.org> From: Gary Gregory Date: Sat, 6 May 2017 13:16:51 -0700 Message-ID: Subject: Re: Missing log call? To: HttpComponents Project Content-Type: multipart/alternative; boundary=001a114087dac2022e054ee0afaf archived-at: Sat, 06 May 2017 20:16:59 -0000 --001a114087dac2022e054ee0afaf Content-Type: text/plain; charset=UTF-8 Or I could just simply show a patch: Index: src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java =================================================================== --- src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java (revision 1793912) +++ src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java (working copy) @@ -277,10 +277,10 @@ @Override public void exception( final NHttpServerConnection conn, final Exception cause) { + log(cause); final State state = getState(conn); if (state == null) { shutdownConnection(conn); - log(cause); return; } state.setTerminated(); Gary On Sat, May 6, 2017 at 1:46 AM, Oleg Kalnichevski wrote: > On Fri, 2017-05-05 at 16:55 -0700, Gary Gregory wrote: > > In our method > > _org.apache.http.nio.protocol.HttpAsyncService.exception(NHttpServerC > > onnection, > > Exception)_ the log() method does not always get called: > > > > @Override > > public void exception( > > final NHttpServerConnection conn, final Exception cause) > > { > > final State state = getState(conn); > > if (state == null) { > > shutdownConnection(conn); > > log(cause); > > return; > > } > > state.setTerminated(); > > closeHandlers(state, cause); > > final Cancellable cancellable = state.getCancellable(); > > if (cancellable != null) { > > cancellable.cancel(); > > } > > final Queue pipeline = state.getPipeline(); > > if (!pipeline.isEmpty() > > || conn.isResponseSubmitted() > > || > > state.getResponseState().compareTo(MessageState.INIT) > > > 0) { > > // There is not much that we can do if a response > > // has already been submitted or pipelining is being > > used. > > shutdownConnection(conn); > > } else { > > try { > > final Incoming incoming = state.getIncoming(); > > final HttpRequest request = incoming != null ? > > incoming.getRequest() : null; > > final HttpContext context = incoming != null ? > > incoming.getContext() : new BasicHttpContext(); > > final HttpAsyncResponseProducer responseProducer = > > handleException(cause, context); > > final HttpResponse response = > > responseProducer.generateResponse(); > > final Outgoing outgoing = new Outgoing(request, > > response, > > responseProducer, context); > > state.setResponseState(MessageState.INIT); > > state.setOutgoing(outgoing); > > commitFinalResponse(conn, state); > > ///////////////////////////////////////////////////// > > ///// > > ///////////////////////////////////////////////////// > > ///// > > // log() has not been called by the time we get here > > ///////////////////////////////////////////////////// > > ///// > > ///////////////////////////////////////////////////// > > ///// > > } catch (final Exception ex) { > > shutdownConnection(conn); > > closeHandlers(state); > > if (ex instanceof RuntimeException) { > > throw (RuntimeException) ex; > > } else { > > log(ex); > > } > > } > > } > > } > > > > So I propose we move the call to log from: > > > > if (state == null) { > > shutdownConnection(conn); > > log(cause); > > return; > > } > > > > To the first line of the method: > > > > @Override > > public void exception( > > final NHttpServerConnection conn, final Exception cause) > > { > > log(cause); > > final State state = getState(conn); > > if (state == null) { > > shutdownConnection(conn); > > return; > > } > > > > Thoughts? > > > > Gary > > > > Gary > > It would make things much easier if you forked HttpCore at GitHub, > patched your private fork, gave us a reference to the diff set in your > repository and asked for a review. > > This should be the standard work-flow anyway once we migrate to Git. > > Oleg > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org > For additional commands, e-mail: dev-help@hc.apache.org > > -- E-Mail: garydgregory@gmail.com | ggregory@apache.org Java Persistence with Hibernate, Second Edition JUnit in Action, Second Edition Spring Batch in Action Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory --001a114087dac2022e054ee0afaf--