-
Notifications
You must be signed in to change notification settings - Fork 10.5k
VisionIPCClient: fix slow connect #36817
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
Conversation
mici raylib UI Preview✅ Videos are identical! View Diff Report |
f25f726 to
392ec41
Compare
|
I don't totally understand what's going on. Running a few connect loops sleeping 0.1s in the background, then starting cameraview.py, the time taken shifts around. This time it's in importing the buffers: I also can't reproduce the 300ms+ time taken with the manual fake connect loops unless I start test_onroad.py Then running a few seconds later: Then again: |
|
Hit 500ms, but again only happens with full openpilot stack running naturally: |
|
I'm starting to doubt that this is the VisionIPC server, after adding a connect thread, now I'm seeing the time move to another part of the ui: It might be that all of the openpilot procs starting at once is preempting the lower priority ui process. This also explains why I can't reproduce above 50ms with a bunch of clients connecting in a loop |



























Can't reproduce on device anymore, but on PC:Something about this is slow:https://github.com/commaai/msgq/blob/e0ee68e69d1cb2e208ee13f1632b6e709e615a5a/msgq/visionipc/visionipc_client.cc#L68-L76As well as this on re-connect:https://github.com/commaai/msgq/blob/e0ee68e69d1cb2e208ee13f1632b6e709e615a5a/msgq/visionipc/visionipc_client.cc#L37-L42It looks like it's inconsistent because it relies on modeld, dmonitoringmodeld, and/or encoderd connecting to camerad at a certain time. This is the slow line for ui:
https://github.com/commaai/msgq/blob/e0ee68e69d1cb2e208ee13f1632b6e709e615a5a/msgq/visionipc/visionipc_client.cc#L57
Perhaps it wasn't reproducible on mici because startup timing is slightly different, earlier or later, missing the congestion of all the procs connecting.
And this handles incoming connections sequentially:
https://github.com/commaai/msgq/blob/e0ee68e69d1cb2e208ee13f1632b6e709e615a5a/msgq/visionipc/visionipc_server.cc#L86