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

Changing bufio.Scanner to bufio.Reader to support large message #3366

Merged
merged 1 commit into from
Aug 27, 2024

Commits on Aug 27, 2024

  1. Changing bufio.Scanner to bufio.Reader to support large message

    From the Issue containerd#3343
    
    As stated in the bufio Documentation, when using the bufio.Scanner, if the buffer exceed the max size of the token, the Scanner fail silently with an I/O error.
    
    In the case of a container started with nerdctl, the main process using stdout/stderr hang forever when sending text bigger than 64kb (bufio.MaxScanTokenSize) without any newline character. (Discovered from a JSON string dumped in the logs). bufio documentation state to switch to a Reader instead when you do not have control over the size of the message.
    
    Small test that is failing with the current master but working with this fix.
    
    @apostasie recommend to check the other place in the code for the bufio.Scanner usage but I am not really a GO expert
    
    Will trim any \n if it is not EOF else, will send the data no matter and exit in case of error
    
    Signed-off-by: Bastien Roy-Mazoyer <[email protected]>
    CerberusQc committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    7eb1523 View commit details
    Browse the repository at this point in the history