Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Marc Aymerich Newsgroups: comp.lang.python Subject: Futex hang when running event loop on a separated thread Date: Tue, 24 Nov 2015 16:29:39 +0100 Lines: 36 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de PTbARZN9TzhwdZZv3ThmJAj3iFkh9QKfM7dD1a5+HtHQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'handler': 0.04; 'finally:': 0.05; 'exit': 0.07; 'valueerror:': 0.07; '__init__': 0.09; 'thread': 0.10; 'deadlock': 0.16; 'fuse': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:when': 0.16; 'try:': 0.18; 'skip:" 40': 0.20; 'appears': 0.23; 'tried': 0.24; "i've": 0.25; 'message-id:@mail.gmail.com': 0.27; 'idea': 0.28; 'marc': 0.29; 'separated': 0.29; 'thread,': 0.29; 'run': 0.33; 'null': 0.33; 'file': 0.34; 'running': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'received:209.85.213': 0.37; 'received:209': 0.38; 'hi,': 0.38; 'to:addr:python.org': 0.40; 'situation': 0.67; '.....': 0.76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=sR8upwTp89uTuid2oO6G2MXvscp/KIi1zEhntgJoObc=; b=yTJ7D9g5u+/ScrJUCgpyNhHX4N24NLsgkeIMAfPUeX4hGg2VEnMJ326BE1OHmc0U98 j9Yz6chJpo3FmGzZHKOs7wAYltzLi1CsRB2tUyBzyraWpmOc0nLh8WInmpAuOX+bDrE8 1YP1ieKnOnl5lO+pAZ4aqSaQli5RVa0xTllo/Sb/K/2nHjtf1T6zlqZbonGTAEejz8uu Vs0aewZwHaJx6Zv90oKmh7QSyHxMga9r/8DyU1pKIDVqvNltHn1sDi7gcE7iHqeNMEpF 8gMajb12WkgrRl7ZA8XQNPucLH2SfR2ez5jUgQNh0Eqr5b/Ji6ceyTk4NX6n8QVuzO5c 1XUw== X-Received: by 10.50.61.167 with SMTP id q7mr886339igr.2.1448378998713; Tue, 24 Nov 2015 07:29:58 -0800 (PST) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99356 Hi, I have to run the asyncio.loop on a separated thread because the main thread is running FUSE. Apparently fuse needs to run on the main thread because it uses signal(): .... File "/usr/local/lib/python3.4/dist-packages/fuse.py", line 390, in __init__ old_handler = signal(SIGINT, SIG_DFL) ValueError: signal only works in main thread Anyway, when I exit the program it appears that i run into a deadlock with the eventloop thread, strace is stuck with: .... futex(0x7f7ba0000c10, FUTEX_WAIT_PRIVATE, 0, NULL I've tried to stop the event loop from the main thread but the situation is exactly the same :( loop_container = {} handler = threading.Thread(target=run_loop, args=(loop_container,)) try: handler.start() FUSE(fs) finally: loop_container['loop'].stop() # handler.join() Any idea on how I can shutdown the hole thing? I have to manually kill the program each time :( -- Marc