New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong order state after multiple connection reset errors #464
Comments
Its probably overkill but with I will look into the issue now, should be a quick fix. |
Regarding the thread safety of |
I had a look into some issues of urllib3 and requests: I must say I am almost horrified by these issues. Seems pretty bold to me to put "thread-safety" as their first bullet point into the description of urllib3. Regarding the code change: Personally, I think it is not very intuitive that calling |
Another thought on the flumine implementation of the session pool: Currently, |
Just to clarify: I had a longer look at the issues and it seems like the ConnectionPool of Maybe directly using |
Agreed, updated to handle within the helper. |
Agreed, updated to |
It's a bit of a mess, happy to try some tests using urllib3, keen to keep it simple though and if we can get away with a single session maybe we should try that first? |
Just using a simple, shared If the change to the flumine session pool already fixes or significantly reduces the the connection errors, I also see no cause for immediate action. |
Hi!
I sometimes get multiple
ConnectionResetError
s when trying to cancel an order, even when retrying. After the last failed attempt, the order state is not properly reset, but remainsCANCELLING
.I looked at the code to execute the cancel operation:
https://github.com/liampauling/flumine/blob/4da58825ae529ddde2b3bfee2a434b20ed41ec3c/flumine/execution/betfairexecution.py#L55
The actual exception is handled here:
https://github.com/liampauling/flumine/blob/4da58825ae529ddde2b3bfee2a434b20ed41ec3c/flumine/execution/betfairexecution.py#L244
However, after the last attempt, there is simply no new retry and the order is not updated again to reflect the failed request.
Maybe the exception handler should re-raise the error when not retrying the operation. Then, the
execute_cancel
method could catch the error and set the order state back toEXECUTABLE
, when the state is stillCANCELLING
(to mostly avoid the current problem with race conditions in the order state processing).Also: I noticed flumine is using its own session pool instead of relying on the connection pool of the session itself. Why is that?
The text was updated successfully, but these errors were encountered: