Comments (2)
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:
- Introduce our own hard-coded
MaxScanTokenSize
and callScanner.Buffer
with it upon the creation ofParser
inNewParser
- Expose a configuration knob for user-defined maximum scan token size and call
Scanner.Buffer
to set it with the user-provided value - 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.
The fix works great, thanks!
from aptutil.
Related Issues (20)
- fatal error: runtime: out of memory HOT 3
- error: "update failed" ... found no Release/InRelease HOT 6
- Provide a workaround to ignore bad indices
- go-apt-cacher panics with base prefix HOT 3
- Official docker image HOT 2
- [cacher] configure proxies via TOML
- How to support security.debian.org? HOT 5
- Not building on arm HOT 1
- Failed to fetch dep11/by-hash File has unexpected size
- transparently proxy repositories HOT 2
- error when synchronizing mirrors created by aptly HOT 2
- downloaded data is not valid on .xz and .bz2 i18n files HOT 1
- error= no files in .../Sources.gz HOT 7
- cannot startup with big Packages.gz HOT 3
- does not appear to stream the download to the first client as it's downloading from the upstream
- Question: Have go-apt-cacher read go-apt-mirror files
- No cleanup for temporary directories if sync fails for them HOT 4
- Missing files from repositories create neverending sync jobs
- No binaries for 1.4.1 and 1.4.2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aptutil.