Giter Club home page Giter Club logo

Comments (2)

Hsn723 avatar Hsn723 commented on July 23, 2024 1

Currently looking into this. The root issue is that we are using bufio.Scanner with the default MaxScanTokenSize which is 64kiB. I can reproduce this in our test suite by adding a package with an unrealistically large extended description, which is technically not illegal.

This can be addressed several ways:

  1. Introduce our own hard-coded MaxScanTokenSize and call Scanner.Buffer with it upon the creation of Parser in NewParser
  2. Expose a configuration knob for user-defined maximum scan token size and call Scanner.Buffer to set it with the user-provided value
  3. Catch bufio.ErrTooLong and dynamically increase buffer size

Option 3 is not ideal as we run into the risk of the buffer growing infinitely large.

Option 2 gives the most control, but requires a lot of elbow grease since we'll need to change a bunch of function signatures to expose MaxScanTokenSize all the way to Cacher (and we might also need to touch Mirror since it also calls apt.ExtractFileInfo. Plus, it introduces a configuration knob which might seem obscure to the user since it exposes an implementation detail which may not necessarily be relevant to them.

Option 1 doesn't give any control, but has the advantage that it does not break any of the current function signatures. It is also the most lightweight to implement.

For the time being, I'm leaning towards option 1 with an internal MaxScanTokenSize of 1 MiB, which seems to be a reasonable enough maximum size. If the buffer size issue is found to be prevalent enough, we can always consider building upon option 1 to implement the other options.

from aptutil.

ohmer1 avatar ohmer1 commented on July 23, 2024 1

The fix works great, thanks!

from aptutil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.