1-word PR to reduce ~20 warnings for every session...
# dev-pr-review
l
1-word PR to reduce ~20 warnings for every session start: https://github.com/All-Hands-AI/OpenHands/pull/11392
b
@limited-student-10747 this piece of code has bigger issue - 2s wait w/ 0.1s is not a good setup for all environments - in mine it was causing runtimes be quickly killed off as under load this can take sometimes up to 30s for client to show up i made this PR to make this configurable and also reduce logging https://github.com/All-Hands-AI/OpenHands/pull/11397
l
Hey @breezy-author-40257, are you sure that this is causing runtimes to get killed off? I think this is just a timeout to wait before sending messages
(I might be wrong though)
b
100% sure - if in 2s there is no client - that runtime churns
so if load increases this creates situation where runtimes start/get killed infintely
setting this to 30s fixed it in my env
l
Thanks, i’ll take a closer look. Do you have a way to reproduce the failing behavior for testing?
b
yes - coincidentally this is where most of today went for me
l
ok, great, if you could give instructions I can try to repro and test the pr
also cc @straight-sundown-84319 who may want to be aware of this
b
create conversation via API but dont connect websocket - that all it takes for session manager to kill it
obviously there are many cases where websocket connection may take more than 2s
nod 1
image.png
l
OK, interesting, I didn’t realize that timeouts killed the server
will take a look
Thanks, this looks very good in general, but I’m not familiar enough with
file_conversation_store.py
to be confident in reviewing the changes. @straight-sundown-84319 if you could take a look that’d be very appreciated!
Hey @breezy-author-40257, based on @calm-artist-7206’s comments, maybe we can just remove the file-based store changes from this PR for now since they’re orthogonal to the connection timing+logging changes and may not be relevant after we switch to v1 (probably next week)? If you do that I’m happy to approve the PR
b
sotty they got combined - let me fix that
👍 1
i meant to do 2 separate
this one is just session timeout stuff
though the other issue is also quite serious - when using filestore for sessions once you get a folder without metadata.json - API just stops working
would you like me to submit a separate PR for that
?
l
I think that issue should be fixed in v1 probably, since we’ll move away from storing sessions in filestore and use a db instead
👀 1
overall the session timeout PR lgtm other than switching warning to debug, since it’s still an expected scenario that we might need to wait a bit
b
if that helps - i think there should be rate limiter on API - if create_conversation gets called faster than runtimes spawn - it leads to all kinds of instabilities - i spent whole day yesterday checking edge cases and ended up implementing throttling on my side
l
yeah, if we can come up with a reproducible example of this breaking on the current main branch I think it’s definitely worth considering, thanks for digging in to this!
(the current main branch has transitioned to using the v1 agent sdk with a fair number of changes from before)
b
i wrote a load test where it increases rate of runtime creation until API starts timing out - in my case it is at about 1/s
l
ah, very interesting, yeah, I think we should take a look at this load test if you could share it
cc @quiet-night-61895 who may also be interested
👀 1
b
unfortunately it uses my harness so wont be much use - but agent one-shotted it quickly so shoul dbe easy to replroduce "write me a load test that calls "create conversation" at rate of X/min for DURATION seconds, then waits SETTLE seconds and checks ohapp logs for exceptions and reports their count, then cleans up runtimes and their respective docker containers, waits DELAY seconds and increass rate BY INCREMENT"
🤔 1
is what i did
it's stable at 30/min in my case and breaks at 60/min or so
in the end i think it just overwhelms docker daemon and after that all kinds of issue begin until u reboot the VM
dunno if you have rate limiter in k8s setup....
l
AFAIK we don’t have a rate limiter, but on the cloud you can only spin up so many runtimes before consecutive runtimes start to get denied, so maybe that’s it: https://github.com/All-Hands-AI/OpenHands-cloud
q
When we say rate limiting, are your referring to rate of k8s API requests?
b
@quiet-night-61895 just how often OH API is called - i am not running it in k8s