Page 1 of 1

python, ForexConnect.get_history, thread leaking

PostPosted: Thu May 09, 2019 9:55 am
by aosipov
Hi,
I am trying to use python forexconnect package.
I noticed that every time I call get_history method, a new thread is created.
Here is the sample code:
Code: Select all
from forexconnect import fxcorepy, ForexConnect

TIME_FRAME = 'm1'
ALIGNING = fxcorepy.O2GCandleOpenPriceMode.PREVIOUS_CLOSE
FXCM_URL = 'fxcorporate.com/Hosts.jsp'


def session_status_changed(session, status):
    if status == 'DISCONNECTED':
        exit(1)

def run():
    login = <your login>
    password = <your password>
    connection = 'demo'

    with ForexConnect() as fx:
        fx.login(login, password, FXCM_URL, connection, None, None,
                 session_status_changed)
        for i in range(500):
            print(i)
            fx.get_history('EUR/USD', TIME_FRAME, None, None, 3, ALIGNING)

if __name__ == "__main__":
    run()
    input()


When the loop finishes, the python process has more than 500 threads.
Checked it with ps
Code: Select all
ps huH p <PID> | wc -l

Am I doing something wrong? Is it normal?

Re: python, ForexConnect.get_history, thread leaking

PostPosted: Mon May 13, 2019 7:53 am
by Konstantin.Toporov
We will investigate

Re: python, ForexConnect.get_history, thread leaking

PostPosted: Thu Jun 13, 2019 4:57 am
by aosipov
Did you have a chance to look into it?

Re: python, ForexConnect.get_history, thread leaking

PostPosted: Fri Jul 26, 2019 11:27 am
by Konstantin.Toporov
Version with the fixed issue has been released:
viewtopic.php?f=37&t=68716