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
v0.31.0 - AVIF output after sharpen operation assumes high bit rate, crashes with aom built without support for this #3358
Comments
Please provide significantly more information, at least enough so that someone else can reproduce the problem, including sample code and, as you're using Docker, the Dockerfile. |
Apologies for frustratingly low amount of information. We wanted to report issue because we thought this might be widespread issue affecting everyone and it would be best if someone can start looking into this early. Btw, we can re-produce this on local machine now. Here is code which immediately results in segmentation fault. import sharp from "sharp";
import got from "got";
async function image_process() {
let response = await got.get("https://static.samyakk.com/pub/media/catalog/product/p/g/pg3239-b_1.jpg",{
responseType: 'buffer'
});
let transform = sharp(response.body, {
failOnError: false,
page: 0,
density: 144
});
transform.timeout({seconds:60});
transform.sharpen(); // if this is commented, everything works fine.
transform.avif({
quality: 75,
lossless: false,
effort: 0
});
let data = transform.toBuffer({resolveWithObject: true});
}
image_process(); |
I would also like to add that this one seems issue with libvips 8.13 rather than sharp. If sharp 0.30.6 is given custom built libvips 8.13 the same issue occurs. Everything works fine in 8.12. |
I could reproduce this with the pre-built binaries provided by sharp and NetVips. It looks like PR lovell/sharp-libvips#94 would conflict with commit libvips/libvips@e985e23 (i.e. writing a high bit rate AVIF image while aom is configured with $ curl -LO https://images.weserv.nl/zebra.jpg
$ cat <<EOT > sharpen-mild.mat
3 3 24
-1 -1 -1
-1 32 -1
-1 -1 -1
EOT
# Test with system provided aom
$ vips convf zebra.jpg x.avif sharpen-mild.mat
$ echo $?
0
# Test with the pre-built binaries
$ mkdir -p vips-8.13.1/
$ curl -Ls https://github.com/kleisauke/libvips-packaging/releases/download/v8.13.1/libvips-8.13.1-linux-x64.tar.gz | tar xzC vips-8.13.1/
$ LD_PRELOAD=vips-8.13.1/lib/libvips.so.42 vips convf pg3239-b_1.jpg x.avif sharpen-mild.mat
Segmentation fault (core dumped)
# Rebuild aom with -DCONFIG_AV1_HIGHBITDEPTH=0
$ mkdir -p aom-3.4.0/aom_build/
$ curl https://storage.googleapis.com/aom-releases/libaom-3.4.0.tar.gz | tar xzC aom-3.4.0/ --strip-components=1
$ cd aom-3.4.0/aom_build
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=1 -DENABLE_{DOCS,TESTS,TESTDATA,TOOLS,EXAMPLES}=0 -DENABLE_NASM=1 -DCONFIG_AV1_HIGHBITDEPTH=0 -DCONFIG_WEBM_IO=0 ..
$ cmake --build . -- -j$(nproc)
$ sudo cmake --install .
$ cd ../../
# Test with aom configured with -DCONFIG_AV1_HIGHBITDEPTH=0
$ vips convf zebra.jpg x.avif sharpen-mild.mat
Segmentation fault (core dumped) |
Thanks Kleis, great work, the convolution output is float, therefore heifsave assumes 16-bit. I'm not sure there's a way of querying aom to see what bitdepths it has been compiled with support for, so I guess we can fix this by forcing a |
Just curious. What would be behaviour with I am just thinking if there can be a quick fix. |
We tried above and it fixes the crash. |
It seems doing this results in completely black image. |
Commit 28b87db ensures a |
v0.31.1 now available |
Without this writing a 16bit heif/avif image leads to segmentation faults. See, * akash-akya/vix#109 * lovell/sharp#3358
Without this writing a 16bit heif/avif image leads to segmentation faults. See, * akash-akya/vix#109 * lovell/sharp#3358
Without this writing a 16bit heif/avif image leads to segmentation faults. See, * akash-akya/vix#109 * lovell/sharp#3358
Without this writing a 16bit heif/avif image leads to segmentation faults. See, * akash-akya/vix#109 * lovell/sharp#3358
i.e. limit it to a bitdepth of 8, since we compile libaom with `-DCONFIG_AV1_HIGHBITDEPTH=0`. See: lovell/sharp#3358 kleisauke/net-vips#217 libvips#3910 Upstream-Status: Inappropriate [disable feature] This is specific to libvips' prebuilt binaries.
i.e. limit it to a bitdepth of 8, since we compile libaom with `-DCONFIG_AV1_HIGHBITDEPTH=0`. See: lovell/sharp#3358 kleisauke/net-vips#217 libvips#3910 Upstream-Status: Inappropriate [disable feature] This is specific to libvips' prebuilt binaries.
It was working fine until 0.30. As soon as we upgrade library to 0.31.0, docker containers start crashing in production when request count goes high. No error in log, nothing in Kubernetes. It just simply crashes when lot of requests come. Kubernetes restarts it but it again crashes leading to downtime.
The text was updated successfully, but these errors were encountered: