question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

calling overlayWith on a jpeg with an svg segfaulting (docker alpine image)

See original GitHub issue

I’m having issues with a particular operation in my operation pipeline, namely overlayWith. My sequence of operations looks something like this:

const frame = new Buffer(`<svg ....`)
 image.resize(imageWidth, imageHeight)
  .crop('north')
  .background({r: 255, g: 255, b: 255, alpha: 255})
  .extend(stretchDimensions)
  .overlayWith(frame)
  .jpeg().toBuffer().then(console.log)

On my computer it all works (Mac OS X). My issue is using one of the many variations of the sharp alpine distro (I’m following this one). As I need to do a bit more, I’ve copied and modified the entries in the Dockerfile to suit my needs, and the end result looks like this:

FROM node:8.2-alpine
...
ENV VIPS_VERSION 8.5.7
ENV SHARP_VERSION 0.18.2
ENV GYP_VERSION 3.6.2

# Compile Vips and Sharp
RUN	apk --no-cache add libpng librsvg libgsf libjpeg-turbo musl \
		&& apk --no-cache add --virtual .build-dependencies \
			 g++ libc-dev make python curl tar gtk-doc glib-dev \
			 libpng-dev libjpeg-turbo-dev librsvg-dev \
			 gobject-introspection expat-dev giflib-dev \
  	&& mkdir -p /usr/src \
  	&& curl -o vips.tar.gz -SL https://github.com/jcupitt/libvips/releases/download/v${VIPS_VERSION}/vips-${VIPS_VERSION}.tar.gz \
		&& tar -xzf vips.tar.gz -C /usr/src/ \
		&& rm vips.tar.gz \
		&& chown -R nobody.nobody /usr/src/vips-${VIPS_VERSION} \
		&& cd /usr/src/vips-${VIPS_VERSION} \
		&& ./configure \
		&& make \
		&& make install \
		&& cd / \
		&& rm -r /usr/src/vips-${VIPS_VERSION} \
		&& yarn add global node-gyp@${GYP_VERSION} sharp@${SHARP_VERSION} \
		&& apk del .build-dependencies 
...

After the lengthy process of building the image and running my program, it segfaults. I’ve isolated it to the overlayWith call (if I comment it, it works).

I’m aware that this might be an issue with libvips / alpine / smth else, so I’d appreciate at the very least some help in redirecting me to the proper person who can help me (maybe those maintainers are also maintaining sharp?).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
HoneyryderChuckcommented, Sep 24, 2017

@lovell as I went away from the alpine distro for everything involving vips, this is not as important to me anymore. However, I still have my test script to reproduce the segfault. I’ll see if I can allocate some time at the end of the week to test those changes and come back at you with feedback.

0reactions
lovellcommented, Oct 30, 2017

Closing due to inactivity but please feel free to re-open with a backtrace.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Segmentation Fault in alpine docker image - Tor's Gitlab
I have the following multi stage dockerfile for arti FROM rust:1.63-alpine.
Read more >
Bug listing with status RESOLVED with resolution TEST ...
Bug:233 - "Emacs segfaults when merged through the sandbox. ... "mounting iso-image fails" status:RESOLVED resolution:TEST-REQUEST severity:normal ...
Read more >
Query: Advanced Search - Wikimedia Phabricator
T238426 Creating a file description page with a redirect to an existing image, doesn't purge pages using the recently created redirect.
Read more >
Program segfaults on alpine linux. How do I resolve it?
Establish a connection between them. Close the connection if it's successful. Everything runs fine on a debian docker container and on my host ......
Read more >
sharp @ 0.20.8 .. 0.22.1 - Package Diff
overlayWith ('overlay.png', { gravity: sharp.gravity.southeast } ) ... JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data can be streamed into...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found