From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8FD3820348634 for ; Thu, 10 May 2018 07:15:27 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 May 2018 07:15:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,385,1520924400"; d="scan'208";a="40739521" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga006.jf.intel.com with ESMTP; 10 May 2018 07:15:26 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 10 May 2018 07:15:26 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.228]) by fmsmsx111.amr.corp.intel.com ([169.254.12.70]) with mapi id 14.03.0319.002; Thu, 10 May 2018 07:15:25 -0700 From: "Carsey, Jaben" To: "Kinney, Michael D" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [edk2] [PATCH v1 1/1] BaseTools: loop to retry remove when it fails. Thread-Index: AQHT59eNgR4kqWD0EEKMdhnYqj6EFqQohceAgAB8fwA= Date: Thu, 10 May 2018 14:15:24 +0000 Message-ID: References: <17f1054c0e2f87617110550f64c1bff62a33700c.1525899066.git.jaben.carsey@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTNiYTRkYWQtZDlhYi00NDQ1LWE2NmUtNzU1MzIwYTMxOTM0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImtXZ2doVE1wMFgzcGhGaG41RzVHUlVPQjl0UFZjODlGd0s0RlJyTFwvdUFzPSJ9 x-ctpclassification: CTP_NT x-originating-ip: [10.1.200.106] MIME-Version: 1.0 Subject: Re: [PATCH v1 1/1] BaseTools: loop to retry remove when it fails. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2018 14:15:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Absolutely true. I am really trying to start the discussion as the error i= s occurring more and more for me. I can send a v1 patch with timeout added= . Yonghong and Liming,=20 And thoughts? =20 -Jaben > -----Original Message----- > From: Kinney, Michael D > Sent: Wednesday, May 09, 2018 4:47 PM > To: Carsey, Jaben ; edk2-devel@lists.01.org; > Kinney, Michael D > Cc: Gao, Liming > Subject: RE: [edk2] [PATCH v1 1/1] BaseTools: loop to retry remove when i= t > fails. > Importance: High >=20 > Jaben, >=20 > Instead of while TRUE, a timeout count be added so > the loop can exit if the file is not released in a > reasonable period of time. Perhaps 5 seconds. >=20 > Timeout =3D 0.0 > while Timeout < 5.0: > try: > return os.remove(LongFilePath(path)) > except: > time.sleep(0.1) > Timeout =3D Timeout + 0.1 > return os.remove(LongFilePath(path)) >=20 > Thanks, >=20 > Mike >=20 > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel- > > bounces@lists.01.org] On Behalf Of Jaben Carsey > > Sent: Wednesday, May 9, 2018 1:51 PM > > To: edk2-devel@lists.01.org > > Cc: Gao, Liming > > Subject: [edk2] [PATCH v1 1/1] BaseTools: loop to retry > > remove when it fails. > > > > There is a common race condition when the OS fails to > > release a file > > fast enough. this adds a retry loop. > > > > Cc: Liming Gao > > Cc: Yonghong Zhu > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Jaben Carsey > > --- > > BaseTools/Source/Python/Common/LongFilePathOs.py | 9 > > +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git > > a/BaseTools/Source/Python/Common/LongFilePathOs.py > > b/BaseTools/Source/Python/Common/LongFilePathOs.py > > index 2e530f9dd774..a595de2648b7 100644 > > --- a/BaseTools/Source/Python/Common/LongFilePathOs.py > > +++ b/BaseTools/Source/Python/Common/LongFilePathOs.py > > @@ -1,7 +1,7 @@ > > ## @file > > # Override built in module os to provide support for > > long file path > > # > > -# Copyright (c) 2014, Intel Corporation. All rights > > reserved.
> > +# Copyright (c) 2014 - 2018, Intel Corporation. All > > rights reserved.
> > # This program and the accompanying materials > > # are licensed and made available under the terms and > > conditions of the BSD License > > # which accompanies this distribution. The full text > > of the license may be found at > > @@ -15,6 +15,7 @@ import os > > import LongFilePathOsPath > > from Common.LongFilePathSupport import LongFilePath > > from Common.LongFilePathSupport import UniToStr > > +import time > > > > path =3D LongFilePathOsPath > > > > @@ -22,7 +23,11 @@ def access(path, mode): > > return os.access(LongFilePath(path), mode) > > > > def remove(path): > > - return os.remove(LongFilePath(path)) > > + while True: > > + try: > > + return os.remove(LongFilePath(path)) > > + except: > > + time.sleep(0.1) > > > > def removedirs(name): > > return os.removedirs(LongFilePath(name)) > > -- > > 2.16.2.windows.1 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel