Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-37077: Add native thread ID (TID) for AIX#13624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
miss-islington merged 3 commits intopython:masterfromaixtools:bpo-37077-tid
Jun 13, 2019

Conversation

@aixtools
Copy link
Contributor

@aixtoolsaixtools commentedMay 28, 2019
edited by bedevere-bot
Loading

This is the followup for issue36084

https://bugs.python.org/issue37077

@aixtools
Copy link
ContributorAuthor

@jaketesler - Hi, and thanks in advance. Many thanks for offering to be "tagged"!

This seems straight forward - and I hope complete (docs updated). (also thanks to@ncoghlan iirc who pointed at thread_self() - the "kernel" routine versus the posix thread *_self routine!

tiran
tiran previously requested changesMay 29, 2019
Copy link
Member

@tirantiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

-1

As you already said, pthread_self does not return the TID,https://linux.die.net/man/3/pthread_self

The thread ID returned by pthread_self() is not the same thing as the kernel thread ID returned by a call to gettid(2).

I'd rather not provide the feature at all than to provide an implementation that does not match with other implementations.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@aixtools
Copy link
ContributorAuthor

-1

As you already said, pthread_self does not return the TID,https://linux.die.net/man/3/pthread_self

The thread ID returned by pthread_self() is not the same thing as the kernel thread ID returned by a call to gettid(2).

I'd rather not provide the feature at all than to provide an implementation that does not match with other implementations.

And I did not use pthread_self() - I used thread_self() - also a routine that has been around for years.

A short example - with also the verification from "ps" that the value returned by thread_self is - indeed - the KERNEL tid and not the POSIX_tid.

root@x066:[/data/prj/aixtools/tests/posix]./thread_selfthread_self: pid:7602402 tid:12779547 ptid:1[1] + Stopped (SIGTSTP)        ./thread_selfroot@x066:[/data/prj/aixtools/tests/posix]ps -p 7602402 -mo THREAD    USER     PID    PPID       TID ST  CP PRI SC    WCHAN        F     TT BND COMMAND    root 7602402 7209084         - T    0  60  1 f1000a040034adb0   200011  pts/0   - ./thread_self       -       -       -  12779547 T    0  60  1 f1000a040034adb0   410400      -   - -root@x066:[/data/prj/aixtools/tests/posix]cat thread_self.c#include <pthread.h>#include <sys/thread.h>#include <stdio.h>main(){        pid_t pid;        tid_t tid;        pthread_t ptid;        pid = getpid();        tid = thread_self();        ptid = pthread_self();        fprintf(stderr,"thread_self: pid:%d tid:%d ptid:%d\n", pid, tid, ptid);        sleep(300);     /* give time to run ps -mo THREAD */}

So, not understanding the GIT process - you requested a change - but I do not see anything to change. Other than perhaps my comment where I thanked 'someone' for pointing out the issue BEFORE I submitted anything.

Regards,
Michael

@jaketesler
Copy link
Contributor

@encukouencukou dismissedtiran’sstale reviewMay 29, 2019 23:16

review was based on misreading the code

@ncoghlan
Copy link
Contributor

ncoghlan commentedJun 9, 2019
edited
Loading

@aixtools@encukou has cleared out the review that was based on misreading the update. It's likely worth adding a clarifying comment to the new AIX code, referencing the link that@jaketesler's provided, as I doubt@tiran will be the only reader to ever miss the fact that there's no leading "p" on the function name.

Do you have any thoughts on how we might be able to properly test this change? The existing native thread ID code doesn't appear to have any obvious tests either, so I wouldn't consider that a merge blocker, but it would still be nice if we could add that missing test coverage while folks have eyes on the code anyway.

@aixtools
Copy link
ContributorAuthor

aixtools commentedJun 9, 2019 via email

On 09/06/2019 07:38, Nick Coghlan wrote:@aixtools@encukou has cleared out the review that was based on misreading the update. It's likely worth adding a comment to the new AIX code, referencing the link that@jaketesler's provided. Do you have any thoughts on how we might be able to properly test this change? The existing native thread ID code doesn't appear to have any obvious tests either, so I wouldn't consider that a merge blocker, but it would still be nice if we could add that missing test coverage while folks have eyes on the code anyway.
With all mails coming from "Nicole Trudeau", sometime hard to know whois saying what.a) I have no issue with adding a reference tohttps://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/com.ibm.aix.basetrf2/thread_self.htm,but I wonder why to make an exception for the AIX bit.I had replied directly to "whoever" had made the review - that I hadfound the same comment in a book (white books I called them back then)on AIX 4.1 documentation from June 1995).I'll bow to your wisdom - but it feels funny giving AIX "specialattention". iirc, the other platforms do not have any link re: theirdocumentation.b) as to how to verify the the difference between "pthread"_tid() -whatever it name and "kernel"_tid() - for AIX I can only come up withsomething (that would work on AIX, do not know how to implement it onother platforms) is to verify the current PID is the "owner" of the TIDwould be to call, and parse a command such as "ps -p $PID -mo tid".ps -p $PID # fairly common"
-o tid # I expect to be 'common' as well
-m (on AIX stands for multi-line),An example - not as root, so it works for all:ps -p $$ -mo tid      TID        - 22937633So, while it could be used "as proof" - I think it would need to be aseparate PR/issue - as it will require "platform" input for all platforms.As a footnote - I would not mind learning how to expand a test (even ifonly for AIX) to make this comparison - as long as you know, in advance,the basic approach I would take.Regards,Michael

@aixtoolsaixtools changed the titlebpo-37077: Add native thread ID (TID) to threading.Thread objects for AIXbpo-37077: Add native thread ID (TID) for AIXJun 12, 2019
@bedevere-bot
Copy link

Thanks for making the requested changes!

@asvetlov: please review the changes made to this pull request.

@methane
Copy link
Member

Yes, it looks a bit like a recommendation. FWIW, I recently had this conversation with a highly advanced git user, and his opinion was to merge master into the PR for all projects that squash merges, because the alternative is too complex for PRs that are open for a long time.

I agree with him. While I use rebase often (especially for branches before sending pull request), it requires high git knowledge. Additionally, it requires-f option whengit push. It is dangerous for new git users too.
I think "git rebase" shouldn't be recommended for new users.

@aixtools
Copy link
ContributorAuthor

I am thinking the "rebase" - read "merge" should be written up in the devguide. I tried reading up on it yesterday and this morning - and my head hurts - how to make it simple.

What I think has been vital for me was seeing how to merge from "upstream". I thought I had to maintain my fork at 100% - so I had a separate directory for "maintaining" the fork and then did all my cloneing, merge, pull, etc. from my fork rather than from "upstream".

I suppose when in a team using git - rather than "solo" (aka wannabe 'member') getting advice and direction in how to use git effectively is more efficient than googling through multiple opinions written up as tutorials.

:) so happy this "merge" went smoothly.

@methane
Copy link
Member

I sent pull request to stop recommend "rebase":python/devguide#496

@@ -0,0 +1,2 @@
Add native thread ID (TID) for AIX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
Add native thread ID (TID) forAIX
:func:`threading.get_native_id` now also supportsAIX.

has been terminated.

..availability::Require :func:`get_native_id` function.
..availability::Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX.
Copy link
Contributor

@asvetlovasvetlovJun 13, 2019
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
..availability::Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX.
..availability::Requires :func:`get_native_id` function.

Please keep the text from master.
@vstinner approved the change for NetBSD, I think we don't have to change it again (and fix doc in two places once next implementation will be added).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

“Require” or “Requires”?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

grepping python doc provides the only similarity fromos.rst:

.. availability:: Unix, Windows.  :func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp`

Also doesn't look perfect.

I don't know, I'm not a native speaker. Ok with any decision.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I’d suggest “Requires.” Maybe this will set a good precedent. ¯_(ツ)_/¯

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Updated suggestion

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@aixtools
Copy link
ContributorAuthor

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@asvetlov: please review the changes made to this pull request.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM.

@miss-islingtonmiss-islington merged commitd0eeb93 intopython:masterJun 13, 2019
@miss-islington
Copy link
Contributor

Thanks@aixtools for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@bedevere-bot
Copy link

GH-14067 is a backport of this pull request to the3.8 branch.

miss-islington added a commit that referenced this pull requestJun 13, 2019
This is the followup  for issue36084https://bugs.python.org/issue37077(cherry picked from commitd0eeb93)Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
lisroach pushed a commit to lisroach/cpython that referenced this pull requestSep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull requestJan 14, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner approved these changes

@asvetlovasvetlovasvetlov approved these changes

@tirantirantiran left review comments

@1st11st1Awaiting requested review from 1st1

@berkerpeksagberkerpeksagAwaiting requested review from berkerpeksag

@encukouencukouAwaiting requested review from encukou

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrently

@ericvsmithericvsmithAwaiting requested review from ericvsmith

@gpsheadgpsheadAwaiting requested review from gpshead

@gvanrossumgvanrossumAwaiting requested review from gvanrossum

@methanemethaneAwaiting requested review from methane

@ncoghlanncoghlanAwaiting requested review from ncoghlan

@rhettingerrhettingerAwaiting requested review from rhettinger

@terryjreedyterryjreedyAwaiting requested review from terryjreedy

@warsawwarsawAwaiting requested review from warsaw

+1 more reviewer

@jaketeslerjaketeslerjaketesler left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

13 participants

@aixtools@bedevere-bot@jaketesler@ncoghlan@encukou@skrah@asvetlov@methane@ericvsmith@miss-islington@vstinner@tiran@the-knights-who-say-ni

[8]ページ先頭

©2009-2025 Movatter.jp