Skip to content
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

ofxtools hanging on poor FI behavior #157

Open
aclindsa opened this issue May 28, 2022 · 6 comments
Open

ofxtools hanging on poor FI behavior #157

aclindsa opened this issue May 28, 2022 · 6 comments

Comments

@aclindsa
Copy link
Contributor

I've seen ofxtools hang a few times (with different financial institutions), and when I Ctrl-C it, it is in the following loop:

while True:

This behavior seems to be transient (the same FI may not cause it on other days...). This is from a call to client.request_statements.

From adding some debug prints, it appears that the FIs in question are returning endless empty lines (lovely)

Maybe this could fail more gracefully (like a limit on the max number of iterations of this loop so it doesn't become infinite for poorly-behaved FIs)?

@csingley
Copy link
Owner

Yeah that is not the finest piece of production quality code I have ever written. Surely I can find a more refined algo for discriminating the header from the body.

In other news, I may soon have need to become proficient in Go. How would you feel about rank novices clawing through your codebase and submitting ill conceived PRs riddled with obvious bugs?

@aclindsa
Copy link
Contributor Author

In other news, I may soon have need to become proficient in Go. How would you feel about rank novices clawing through your codebase and submitting ill conceived PRs riddled with obvious bugs?

GO for it (haha heh ha ... ha?), that's half of what this "open source" stuff is all about.

Just don't assume that you'll learn the most idiomatic Go from looking at my code...

@aclindsa
Copy link
Contributor Author

aclindsa commented Jun 3, 2022

Another wrinkle: ofxgo seems to be able to successfully download OFX from the offending FI... So there may be another layer to this.

@csingley
Copy link
Owner

csingley commented Jun 5, 2022

Maybe this could fail more gracefully (like a limit on the max number of iterations of this loop so it doesn't become infinite for poorly-behaved FIs)?

I'm not sure there's a better solution than this for neverending file descriptors, and it's simple to code. What I'm wrestling with is how to write the unit test. I haven't forgotten about this.

@aclindsa
Copy link
Contributor Author

aclindsa commented Jun 5, 2022

I'm not sure there's a better solution than this for neverending file descriptors, and it's simple to code.

I actually have a version of this locally and it "works", though its not as clean as might be ideal. I played around yesterday with trying to figure out if I could catch this condition higher in the call hierarchy (closer to where the request is made) but did not yet find a generic way to detect that the response was 0 bytes.

@thehesiod
Copy link

I just hit this, pre-readline you should be able to cache to buffer position via .tell() and if it hasn't moved after a readline you can consider it EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants