8000 Fix for issue #7054 by avoiding recursive calls to websocket_background. by DavePutz · Pull Request #7694 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

Fix for issue #7054 by avoiding recursive calls to websocket_background. #7694

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

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

DavePutz
Copy link
Collaborator
@DavePutz DavePutz commented Mar 8, 2023

Issue #7054 was caused by a recursive call to websocket_background(); due to the call to _read_next_payload_byte() in that function. That caused mismatches and overflows in the _incoming_ringbuf ring buffer. This fix will simply return if websocket_background() is already being called.

@jepler
Copy link
jepler commented Mar 8, 2023

Is websocket_background a "background callback" created by background_callback_add? This API is intended to provide a guard against recursive calls already. If it is not providing this guard properly, then it would be better to fix that. However, if websocket_background can be called in other contexts than background_callback_run_all, it may be appropriate to add this kind of extra guard.

@DavePutz
Copy link
Collaborator Author
DavePutz commented Mar 8, 2023 via email

@jepler
Copy link
jepler commented Mar 8, 2023

Thanks! I wasn't able to find that on a quick search in the source code. In that case, I think it's appropriate to add the protection.

@dhalbert
Copy link
Collaborator
dhalbert commented Mar 8, 2023

I think this should go in 8.0.x as well. I can backport it, or if you rebase the PR, it will go in and we can pull it forward to main.

@DavePutz
Copy link
Collaborator Author
DavePutz commented Mar 8, 2023

@dhalbert ; I'm not sure how to go about rebasing thru github. Do I just create a fork on 8.0.x and commit the change to that?

@dhalbert
Copy link
Collaborator
dhalbert commented Mar 8, 2023

@dhalbert ; I'm not sure how to go about rebasing thru github. Do I just create a fork on 8.0.x and commit the change to that?

Yes, though it can be difficult to get the 8.0.x branch from upstream.

I can do a cherry-pick after it's merged -- no problem.

@dhalbert dhalbert requested a review from jepler March 8, 2023 21:46
@dhalbert dhalbert merged commit 21305e3 into adafruit:main Mar 9, 2023
@dhalbert dhalbert mentioned this pull request Mar 9, 2023
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

Successfully merging this pull request may close these issues.

3 participants
0