Revert "Merge pull request #137 from overleaf/spd-memprof-again"

This reverts commit 1764b7e9c0a3891955b97136c2fa0d5821b8f40b, reversing
changes made to f1dc05fc8defebf341c320638998947537998192.
This commit is contained in:
Simon Detheridge 2021-07-19 10:50:25 +01:00
parent 6905ddf5f8
commit d830224e29
4 changed files with 5 additions and 66 deletions

View file

@ -1,5 +1,4 @@
*
!install-all-dev-packages.sh
!start.sh
!/conf
!/lib

View file

@ -2,28 +2,8 @@
FROM maven:3-jdk-11 as base
RUN apt-get update && apt-get install -y make git sqlite3 build-essential dpkg-dev
RUN echo "deb-src http://deb.debian.org/debian buster main" >> /etc/apt/sources.list && \
echo "deb-src http://deb.debian.org/debian buster-updates main" >> /etc/apt/sources.list && \
echo "deb-src http://security.debian.org/debian-security buster/updates main" >> /etc/apt/sources.list
RUN mkdir -p /build
WORKDIR /build
RUN apt-get update && \
apt-get -y source libjemalloc-dev && \
apt-get -y build-dep libjemalloc-dev && \
echo "override_dh_auto_configure:" >> jemalloc-5.1.0/debian/rules && \
echo "\tdh_auto_configure -- --enable-debug --enable-fill --enable-prof --enable-stat" >> jemalloc-5.1.0/debian/rules && \
cat jemalloc-5.1.0/debian/rules
WORKDIR /build/jemalloc-5.1.0
RUN dpkg-buildpackage
ADD install-all-dev-packages.sh /install-all-dev-packages.sh
RUN rm -rf /var/lib/apt/lists
RUN apt-get update && apt-get install -y make git sqlite3 \
&& rm -rf /var/lib/apt/lists
COPY vendor/envsubst /opt/envsubst
RUN chmod +x /opt/envsubst
@ -43,10 +23,7 @@ RUN make package \
-name 'writelatex-git-bridge*jar-with-dependencies.jar' \
-exec mv {} /git-bridge.jar \;
FROM builder
# FROM openjdk:11-jre <-- disabled while we are memory profiling
WORKDIR /
FROM openjdk:11-jre
RUN apt-get update && apt-get install -y git sqlite3 procps htop net-tools sockstat binutils graphviz \
&& rm -rf /var/lib/apt/lists
@ -61,16 +38,9 @@ RUN mkdir /opt/cdbg && \
wget -qO- https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz | \
tar xvz -C /opt/cdbg
# Disabled while we are memory profiling (these are already in the image)
# RUN useradd --create-home node
RUN useradd --create-home node
# COPY --from=builder /git-bridge.jar /
# COPY --from=builder /build/*.deb /tmp/
# RUN dpkg -i /tmp/libjemalloc*.deb
RUN dpkg -i /build/*.deb
RUN apt-get -y update && /install-all-dev-packages.sh && rm -rf /var/lib/apt/lists
COPY --from=builder /git-bridge.jar /
COPY vendor/envsubst /opt/envsubst
RUN chmod +x /opt/envsubst

View file

@ -1,28 +0,0 @@
#!/bin/bash
apt-cache pkgnames > /tmp/allpackages
BADPKGLIST="libjemalloc2"
NEWPKGLIST="build-essential"
echo "Searching for required -dev and -dbg packages..."
for PKG in `dpkg --get-selections | sed 's/[: ].*//'`
do
# Make sure it's not in the ignore list
echo $BADPKGLIST | grep -q $PKG
if [ $? -eq 0 ]
then
continue
fi
for suffix in dev dbg dbgsym
do
grep -qe "^$PKG-$suffix$" /tmp/allpackages
if [ $? -eq 0 ]
then
NEWPKGLIST=" $NEWPKGLIST $PKG-$suffix"
fi
done
done
apt-get install -y $NEWPKGLIST

View file

@ -16,6 +16,4 @@ if [ "$ENABLE_DEBUG_AGENT" == "true" ]; then
GIT_BRIDGE_JVM_ARGS="-agentpath:/opt/cdbg/cdbg_java_agent.so -Dcom.google.cdbg.module=git-bridge -Dcom.google.cdbg.version=$VERSION ${GIT_BRIDGE_JVM_ARGS}"
fi
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so
export MALLOC_CONF=prof:true,lg_prof_interval:30,lg_prof_sample:17,prof_prefix:/tmp/jemalloc
exec java $GIT_BRIDGE_JVM_ARGS -jar /git-bridge.jar /conf/runtime.json