Skip to content

Latest Alpine image seg faults #20

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

Closed
zoidyzoidzoid opened this issue Jun 21, 2017 · 6 comments · Fixed by #22
Closed

Latest Alpine image seg faults #20

zoidyzoidzoid opened this issue Jun 21, 2017 · 6 comments · Fixed by #22

Comments

@zoidyzoidzoid
Copy link

zoidyzoidzoid commented Jun 21, 2017

± docker run -it --rm memcached:1.4.37-alpine -o modern -m 32
Unable to find image 'memcached:1.4.37-alpine' locally
1.4.37-alpine: Pulling from library/memcached
6f821164d5b7: Pull complete
338fbb6cf27a: Pull complete
0930cf93b5b2: Pull complete
7bdbb30d4915: Pull complete
54c1d5e73dc6: Pull complete
Digest: sha256:ae33b9e8b100774d92277df779bc0d72bae81a2f62741106e7ea4cd683e2a507
Status: Downloaded newer image for memcached:1.4.37-alpine
± echo $?
139
± docker run -it --rm memcached:1.4.36-alpine -o modern -m 32
Unable to find image 'memcached:1.4.36-alpine' locally
1.4.36-alpine: Pulling from library/memcached
6f821164d5b7: Already exists
338fbb6cf27a: Already exists
714c5ae9370a: Pull complete
3a1e7538d8c8: Pull complete
952bb42ade1c: Pull complete
Digest: sha256:00b68b00139155817a8b1d69d74865563def06b3af1e6fc79ac541a1b2f6b961
Status: Downloaded newer image for memcached:1.4.36-alpine
^CSignal handled: Interrupt.

± echo $?
0
@tianon
Copy link
Member

tianon commented Jun 21, 2017

Seems to be something specifically to do with -o modern -- I can only reproduce by including that. 😕

@zoidyzoidzoid
Copy link
Author

And still happens with 14.39 😞

Think it's us or upstream Alpine image?

@tianon
Copy link
Member

tianon commented Jul 7, 2017

For compiling memcached itself, we make no changes from Debian to Alpine, so it's bound to be something odd happening between memcached and musl. 😞

Can it be reproduced with the Alpine package of memcached? (https://pkgs.alpinelinux.org/package/v3.6/main/x86_64/memcached)

That would at least help us confirm that it's not something we're doing odd, and is instead more likely something musl-related.

Here's our full Debian->Alpine diff, for context:

--- debian/Dockerfile	2017-07-05 11:14:17.003901806 -0700
+++ alpine/Dockerfile	2017-07-05 11:14:17.002901835 -0700
@@ -1,25 +1,25 @@
-FROM debian:jessie-slim
+FROM alpine:3.5
 
 # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
-RUN groupadd -r memcache && useradd -r -g memcache memcache
+RUN adduser -D memcache
 
 ENV MEMCACHED_VERSION 1.4.39
 ENV MEMCACHED_SHA1 9d6f77f4f9f1b50289882fd88851dece7699c74b
 
 RUN set -x \
-	&& buildDeps=' \
+	&& apk add --no-cache --virtual .build-deps \
 		ca-certificates \
-		dpkg-dev \
+		coreutils \
+		cyrus-sasl-dev \
+		dpkg-dev dpkg \
 		gcc \
-		libc6-dev \
+		libc-dev \
 		libevent-dev \
-		libsasl2-dev \
+		libressl \
+		linux-headers \
 		make \
 		perl \
-		wget \
-	' \
-	&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
-	&& rm -rf /var/lib/apt/lists/* \
+		tar \
 	&& wget -O memcached.tar.gz "https://memcached.org/files/memcached-$MEMCACHED_VERSION.tar.gz" \
 	&& echo "$MEMCACHED_SHA1  memcached.tar.gz" | sha1sum -c - \
 	&& mkdir -p /usr/src/memcached \
@@ -32,10 +32,15 @@
 	&& make -j "$(nproc)" \
 	&& make install \
 	&& cd / && rm -rf /usr/src/memcached \
-	&& apt-mark manual \
-		libevent-2.0-5 \
-		libsasl2-2 \
-	&& apt-get purge -y --auto-remove $buildDeps \
+	&& runDeps="$( \
+		scanelf --needed --nobanner --recursive /usr/local \
+			| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
+			| sort -u \
+			| xargs -r apk info --installed \
+			| sort -u \
+	)" \
+	&& apk add --virtual .memcached-rundeps $runDeps \
+	&& apk del .build-deps \
 	&& memcached -V
 
 COPY docker-entrypoint.sh /usr/local/bin/

@zoidyzoidzoid
Copy link
Author

zoidyzoidzoid commented Jul 11, 2017

It's happening on edge with the packaged memcached when using -o modern as well. 😞

docker run -it --rm alpine:edge                                                                                                                                  
/ # apk add --no-cache memcached
/ # memcached -V
memcached 1.4.39

/ # memcached -u root -o modern
Segmentation fault (core dumped)

On 3.6.2 it behaves as expected because it uses 1.4.36:

docker run -it --rm alpine
/ # cat /etc/alpine-release
3.6.2
/ # apk add --no-cache memcached
/ # memcached -V
memcached 1.4.36
/ # memcached -u root -o modern
^CSignal handled: Interrupt.

@dormando
Copy link

ahh sorry, I thought I'd responded for some reason.

Not sure why that was missing... I just installed musl locally, compiled libevent with musl, then compiled memcached and was able to get it to crash... but it can't build memcached-debug under musl sadly :/

I was able to do a quick bisect and narrowed it down to d184b4b08f92d0171c8a3a3f03fa22e33c6aaa55 - dunno what I did just yet but that does seem to be where it's segfaulting so I must've done something stupid.

@dormando
Copy link

found it, followed up in the linked issue. would appreciate some testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants