[issue1021318] PyThreadState_Next not thread safe

2020-05-14 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-26461 as a duplicate of this issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2020-03-13 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-35370: "Add _PyEval_SetTrace(tstate, func, arg) function".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-13 Thread Eric Snow


Eric Snow  added the comment:

On Wed, Dec 11, 2019 at 7:02 AM STINNER Victor  wrote:
> We may have to fix this API first, and clarify the scope of the different 
> locks.

+1

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-11 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-11 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not sure of what is the best approach. Currently, bpo-10915 is blocking 
different projects: "Make the PyGILState API compatible with multiple 
interpreters". We may have to fix this API first, and clarify the scope of the 
different locks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-11 Thread Julien Danjou


Julien Danjou  added the comment:

Victor, do you have an idea of how you would like this mutex to be exposed?

I see it only recently changed in Python 3.7 to be part of a structure, though 
this structure is not public AFAIU.

Is adding 2 new lock/unlock C functions good enough?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-10 Thread Julien Danjou

Julien Danjou  added the comment:

Yes, that's the one 👍

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-10 Thread STINNER Victor


STINNER Victor  added the comment:

> We'd simply need to provide a new API to lock/unlock the interpreter's mutex.

Are you talking about this lock?

#define HEAD_LOCK(runtime) \
PyThread_acquire_lock((runtime)->interpreters.mutex, WAIT_LOCK)
#define HEAD_UNLOCK(runtime) \
PyThread_release_lock((runtime)->interpreters.mutex)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-10 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +eric.snow, pitrou, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-10 Thread STINNER Victor


STINNER Victor  added the comment:

I reopened the issue and changed the version to 3.9.

--
resolution: out of date -> 
status: closed -> open
versions:  -Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-10 Thread Julien Danjou


Julien Danjou  added the comment:

It'd be great if you could reopen it. I'm interested in fixing it properly.

It's impossible to "solve" in Python 2 since the head mutex is not accessible 
(it's static in pystate.c) but this is doable with Python 3 (yay).

We'd simply need to provide a new API to lock/unlock the interpreter's mutex.

How hard to you need the script to reproduce? I can try to spend some time to 
extract some of my code to have one if that's really needed (I'm using Cython 
to generate some of the C code).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-10 Thread STINNER Victor


STINNER Victor  added the comment:

> This is actually true and it's quite easy to produce a bug that triggers a 
> segmentation fault when iterating over a large list of threads create 
> dynamically.

This issue is closed. Would you be able to write a reproducer script? If yes, 
maybe open a new issue, or I can reopen this one.

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe

2019-12-10 Thread Julien Danjou


Julien Danjou  added the comment:

This is actually true and it's quite easy to produce a bug that triggers a 
segmentation fault when iterating over a large list of threads create 
dynamically.

That makes PyThreadState_Next barely usable for any program that has a few 
threads. The head mutex needs to be locked to be able to iterate safely over 
the list of thread.

--
nosy: +jd
title: PyThreadState_Next not thread safe? -> PyThreadState_Next not thread safe
versions: +Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe?

2010-08-19 Thread Mark Lawrence

Mark Lawrence  added the comment:

No reply to msg82072.

--
nosy: +BreamoreBoy
resolution:  -> out of date
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1021318] PyThreadState_Next not thread safe?

2009-02-14 Thread Daniel Diniz

Daniel Diniz  added the comment:

Can someone take a look a this and either close or propose what to do?

--
nosy: +ajaksu2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com