QuantConnect / Lean.Brokerages.InteractiveBrokers

InteractiveBrokers Brokerage Plugin
Apache License 2.0
31 stars 20 forks source link

Fix race condition in manual weekly restart #94

Closed jhonabreul closed 8 months ago

jhonabreul commented 8 months ago

Description

Fix race condition in manual weekly restart. The call to IBAutomater.Stop() waits for the process to exit, but IB's handler for the process' Exited event is taking the same lock as StartGatewayWeeklyRestartTask which takes that lock before stoping the IB automater, causing a dealock when different a different thread handles the Exited event.

Related Issue

N/A

Motivation and Context

N/A

Requires Documentation Change

N/A

How Has This Been Tested?

Integration with Lean

Types of changes

Checklist: