Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1372822

Summary: pthread_cancel inside exception handler and cancel point called from C++ code unexpected behavior
Product: Red Hat Enterprise Linux 8 Reporter: Paulo Andrade <pandrade>
Component: gccAssignee: Marek Polacek <mpolacek>
gcc sub component: gcc-toolset-10 QA Contact: Alexandra Petlanová Hájková <ahajkova>
Status: CLOSED UPSTREAM Docs Contact:
Severity: medium    
Priority: medium CC: ahajkova, cww, dbasant, fweimer, jakub, jwakely, mnewsome, mpolacek, ohudlick, pbhoot, sipoyare, vmukhame
Version: 8.2Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.2   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-06 18:41:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1461138, 1477664    
Attachments:
Description Flags
thread.cxx none

Description Paulo Andrade 2016-09-02 19:14:52 UTC
Created attachment 1197277 [details]
thread.cxx

In the attached test case, if flush is called, it
will fail with the message:

terminate called after throwing an instance of 'std::runtime_error'

  The test case fails because of 'endl'.

  Other kinds of cancellation points work as expected.

Comment 2 Marek Polacek 2016-10-04 09:44:14 UTC
Wrong component.

Comment 4 Jakub Jelinek 2016-10-18 07:36:44 UTC
Simpler testcase, without STL, needs just libsupc++ and libpthread:

#include <pthread.h>
#include <unistd.h>

namespace __cxxabiv1
{  
  class __forced_unwind
  {
    virtual ~__forced_unwind() throw();
    virtual void __pure_dummy() = 0; 
  };
}

int a;

extern "C" void *
fun (void *)
{
  try
  {
    throw 1;
  }
  catch (int &)
  {
    try
    {
      char buf[10];
      for (;;)
	read (4, buf, 0);
    }
    catch (__cxxabiv1::__forced_unwind &)
    {
      a = 5;
      throw;
    }
  }

  return NULL;
}

int
main ()
{
  pthread_t thread;
  pthread_create (&thread, NULL, fun, NULL);
  pthread_cancel (thread);
  pthread_join (thread, NULL);
}

Comment 5 Jakub Jelinek 2016-10-18 07:37:51 UTC
All GCC versions affected.

Comment 10 Divya 2017-07-31 05:15:11 UTC
Hello 

Can we get a update on likelyhood of this getting fixed in RHEL-6?

Comment 32 Marek Polacek 2021-04-06 18:41:17 UTC
This BZ depends on the upstream bug being fixed.  There hasn't been any progress, so I'm closing this BZ in favor of the upstream bug.