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

#11710 more disttrial amp errors #11711

Merged
merged 5 commits into from
Oct 11, 2022

Conversation

exarkun
Copy link
Member

@exarkun exarkun commented Oct 9, 2022

Scope and purpose

Fixes #11710

@exarkun exarkun marked this pull request as ready for review October 9, 2022 12:41
@chevah-robot chevah-robot requested a review from a team October 9, 2022 12:42
Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good. Many thanks for the fix. Much appreciated.

errorStreamId = await stream(amp, chunk(error, 2 ** 16 - 1))
framesStreamId = await stream(amp, iter(frames))
errorStreamId = await stream(amp, chunk(error.encode("utf-8"), 2 ** 16 - 1))
framesStreamId = await stream(amp, (frame.encode("utf-8") for frame in frames))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that we assume that we don't have super long lines :)


On a second review: the "frames" which stands for "traceback lines" might not be the best name.
But we can live with it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea....... The way traceback lines are chunked is not great :/ I was a bit lazy here and didn't try to improve it much. I guess time will tell if it is a safe bet or not.

I agree that frames is not a great name here. Even if we ignore that they're strings and not actual frame objects, they're not even all strings representing frames :/ We are somewhat protected by the fact that they're not even exactly the lines of a traceback either - instead it's "code object names", "filenames", and "line numbers" - and I guess the parent process resolves that info to actual source lines when necessary. These things seem even less likely than source lines to exceed the AMP limit.

Still, someone should probably give this area of the protocol some extra attention. frames is one gross corner but it isn't the only one... :(

@@ -45,8 +45,8 @@ async def addError(
:param frames: The lines of the traceback associated with the error.
"""

errorStreamId = await stream(amp, chunk(error, 2 ** 16 - 1))
framesStreamId = await stream(amp, iter(frames))
errorStreamId = await stream(amp, chunk(error.encode("utf-8"), 2 ** 16 - 1))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 ** 16 - 1 is fine for now.
I guess that in an ideal world, this would be a constant that can be shared between the producer and consumer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I follow. The consumer can always figure this out by looking at the length of the chunks it receives. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Thanks for the followup.

I was thinking to have the constant between this code and the AMP protocol.
As this whole chunking work is due to an AMP protocol limitation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh yes I see. I think AMP does have a constant for this,

@exarkun exarkun merged commit 915c248 into twisted:trunk Oct 11, 2022
@exarkun exarkun deleted the 11710-more-disttrial-amp-errors branch October 12, 2022 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

trial -jN ... fails to report some large test results
3 participants