chopsticks icon indicating copy to clipboard operation
chopsticks copied to clipboard

Tunnel destructor prevents subsequent stderr interception

Open amigrave opened this issue 6 years ago • 1 comments

When the Tunnel.close() is called, the ioloop writer and reader instances are closed and oddly this makes subsequent stderr writes not intercepted by the orchestrator.

Eg:

# -*- coding: utf-8 -*-
import time

from chopsticks.tunnel import Local


def func():
    import __bubble__
    __bubble__.debug("Hi there!")
    time.sleep(1)  # Wait stderr to be flushed


for i in range(3):
    print("Call #%s" % i)
    m = Local()  # triggers __del__ in cpython starting 2nd iteration
    m.call(func)

outputs the following:

$ python3 test.py server
Call #0
[localhost] Hi there!
Call #1
Call #2

...no second output...

amigrave avatar Dec 13 '17 11:12 amigrave

Please note that the comment

 m = Local()  # triggers __del__ in cpython starting 2nd iteration

comes from a test I originally made outside of a loop. Anyway you get the idea.

amigrave avatar Dec 13 '17 12:12 amigrave