Bug 1192013 - pthread_cancel() doesn't work with dlmopen()
Summary: pthread_cancel() doesn't work with dlmopen()
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Carlos O'Donell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-12 11:55 UTC by Stas Sergeev
Modified: 2016-11-24 12:15 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-10 01:40:55 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
the test case (955 bytes, text/plain)
2015-02-12 11:55 UTC, Stas Sergeev
no flags Details

Description Stas Sergeev 2015-02-12 11:55:18 UTC
Created attachment 990892 [details]
the test case

Description of problem:
If you try to cancel the thread inside the dlmopen()'ed
library code, cancelation does not happen.

Version-Release number of selected component (if applicable):
glibc-2.20-7.fc21.x86_64

How reproducible:
easily

Steps to Reproduce:
1. Run the attached test case

Actual results:
test FAILED

Expected results:
test PASSED

Additional info:
Works properly on: glibc-2.14.1
So this is likely a regression.

Comment 1 Fedora End Of Life 2015-11-04 10:31:28 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 2 Stas Sergeev 2015-11-04 13:23:27 UTC
Hmm, a glibc bug with a test-case, and no activity
at all.

Comment 3 Carlos O'Donell 2015-11-10 01:40:55 UTC
(In reply to Stas Sergeev from comment #2)
> Hmm, a glibc bug with a test-case, and no activity
> at all.

Sorry we didn't get to this bug.

Your test case actually shows expected behaviour given the present implementation.

The cancellation request (outside of the dlmopen namespace) can't see that the thread is waiting at a cancellation point. The new namespace hides this fact from the cancellation code.

You must cancel the thread from within the namespace for the cancellation to effect a cancellation function running within the namespace.

At present upstream is working on a new cancellation implemetnation which should fix this implementation detail.

Sorry again for the delay in responding.

Comment 4 Carlos O'Donell 2015-11-10 01:57:22 UTC
(In reply to Carlos O'Donell from comment #3)
> You must cancel the thread from within the namespace for the cancellation to
> effect a cancellation function running within the namespace.

Just to clarify a bit more here. The dlmopen'd libc.so doesn't know there are threads active and so as an optimization it avoids running any cancellation enable/disable code. Therefore when I say "from within the namespace" I mean that you'd have to create the threads in that new namespace for that libc.so to be aware of threads and thus do the right thing.

Comment 5 Stas Sergeev 2015-11-10 12:06:03 UTC
So, given that it works differently on an earlier
glibc versions, and that the upstream is already working
on a fix - why NOTABUG?

Comment 6 Carlos O'Donell 2015-11-11 05:29:26 UTC
(In reply to Stas Sergeev from comment #5)
> So, given that it works differently on an earlier
> glibc versions, and that the upstream is already working
> on a fix - why NOTABUG?

It becomes a quality of implementation issue. The problem is that there is no standard that dictates how dlmopen and pthread_cancel should interact, therefore users have no guarantees. So it isn't a bug, but it isn't the best behaviour for our users. What we really need actually is a method for sharing important state across namespaces which actually includes errno, cancellation state, thread state, locale state, and several other states that need sharing. Users may also even want control over this and disable any sharing, which results in behaviour like the one you see where the new NS libc.so.6 doesn't know threads are running and optimizes out the calls to handle cancellation.

So this issue isn't going to be fixed easily, it's QoI or RFE, but not a bug.


Note You need to log in before you can comment on or make changes to this bug.