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

QRecordSchema: close schemaLatch in Close #2398

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

serprex
Copy link
Contributor

@serprex serprex commented Dec 27, 2024

goroutines were leaking waiting on schemaLatch,
if provider hit error then schemaLatch could be left indefinitely open

goroutines were leaking waiting on schemaLatch,
if provider hit error then schemaLatch could be left indefinitely open
@serprex
Copy link
Contributor Author

serprex commented Dec 27, 2024

Some options: have Schema method take context.Context, have Schema return error

@iskakaushik
Copy link
Contributor

Some options: have Schema method take context.Context, have Schema return error

This option is definitely better.

@serprex
Copy link
Contributor Author

serprex commented Dec 27, 2024

So I went this route because I think context will make the error a bit flaky. Between both context error which is probably tied with stream error, but also because we should also handle context being alive while stream is closed. In that case the error should be stream.Err() so we'd still want this code on top of selecting over both stream.schemaLatch & ctx.Done()

This way makes flow/pua/stream_adapter.go work unchanged, ie stream transforms don't have an error path

If stream is closed without error without schema it's a strange scenario. Seems best in that case to return 0, nil, whereas with error return we'd get back nil & go ahead with no schema. Guess we could make a separate errors.New("NoSchema")

So this seemed like the simplest path. But could have Schema() still return error, which would just be stream.Err(), so that it isn't so easy to call Schema without error handling

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.

2 participants