[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2017-04-02 Thread Andre Merzky
Andre Merzky added the comment: This one might be related: https://bugs.python.org/issue27889 -- nosy: +Andre Merzky ___ Python tracker ___

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-24 Thread Steven Adams
Steven Adams added the comment: anyone got any other thoughts on this?? -- ___ Python tracker ___ ___

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-19 Thread Chase Sterling
Chase Sterling added the comment: @STINNER Victor Your example is starting a thread before calling fork, the other examples just init a threading.Thread class before the fork (I imagine the OS thread is not created at that point.) Are you saying that just instantiating a threading.Thread

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-18 Thread Steven Adams
Steven Adams added the comment: Ok but the question still remains, why does it only happen on py3.4+?? -- ___ Python tracker ___

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-18 Thread Xiang Zhang
Xiang Zhang added the comment: I should not make more noise after realizing it's matter of thread and process. Sorry. :-( Except this one. :-) -- ___ Python tracker

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-18 Thread STINNER Victor
STINNER Victor added the comment: Hum, I should elaborate my explanation :-) os.fork() removes all threads except of the current thread. It's clearly stated in the fork manual page, but the Python os.fork() doesn't say anything about threads. https://docs.python.org/dev/library/os.html#os.fork

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-18 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-18 Thread Xiang Zhang
Xiang Zhang added the comment: I write a simple example which behaviour is like Steven's example. import os import sys import threading import ctypes import time def test(): while True: print(time.time()) _thread = threading.Thread(target=test) pid = os.fork() if pid > 0:

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-18 Thread STINNER Victor
STINNER Victor added the comment: IMHO it's a bad idea to create a thread before forking. I suggest you to not create any kind of resource before calling daemonize(). -- nosy: +haypo ___ Python tracker

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-18 Thread Xiang Zhang
Xiang Zhang added the comment: I am not sure what the real problem is. What I can see now it that it seems ctypes affects process fork. If you create the thread after fork, for example, in wait, your example works well. But if the thread participates in process fork, it fails. --

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-18 Thread Steven Adams
Steven Adams added the comment: My workaround didn't work either.. We are a number of third party libs including flask. As soon as i import flask the issues remains.. Maybe something with flask is importing ctypes? Something aint right.. -- ___

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-18 Thread Xiang Zhang
Xiang Zhang added the comment: Sorry. I forgot to take that into consideration. I think now the problem appears because of ctypes. Simply import ctypes instead of uuid can also lead to your problem. -- nosy: +amaury.forgeotdarc, belopolsky, meador.inge

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-17 Thread Steven Adams
Steven Adams added the comment: Shouldn't that mean it also breaks on py3.3? As a workaround i just import uuid later within the thread method. -- ___ Python tracker

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-17 Thread Xiang Zhang
Xiang Zhang added the comment: It seems a matter of lib uuid. The comments in uuid.py tells that the module is not thread-safe. I try to comment out the code using ctypes and rerun your sample, it works well. In uuid's documentation it does not mention the non-thread-safe characteristic.

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-17 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +pitrou, xiang.zhang ___ Python tracker ___ ___

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-17 Thread Steven Adams
Steven Adams added the comment: I forgot to mention if i remove import uuid all works as expected. -- ___ Python tracker ___

[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-17 Thread Steven Adams
New submission from Steven Adams: I've ran into a strange issue after trying to port a project to support py 3.x The app uses a double os.fork to run in the background. On py 3.4+ it seems that when you have an import uuid statement it causes threading.threads to always return false on