Skip to content

Commit

Permalink
added removing pending lock files
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkorsukov committed Dec 1, 2020
1 parent d77fdfb commit aca3c25
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 27 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/ci_linux_mu4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,15 @@ jobs:
fi

DO_UPLOAD_SYMBOLS='false'
SENTRY_PROJECT=""
SENTRY_PROJECT=${{ github.event.inputs.sentry_project }}
SENTRY_URL=""
if [ "${{ github.event.inputs.sentry_project }}" == "editor" ] && [ ${{ secrets.SENTRY_SERVER_MU3_KEY }} != 0 ]; then
if [ "$SENTRY_PROJECT" == "editor" ] && [ ${{ secrets.SENTRY_SERVER_MU3_KEY }} != 0 ]; then
DO_UPLOAD_SYMBOLS='true'
SENTRY_PROJECT="editor"
SENTRY_URL=https://sentry.musescore.org/api/2/minidump/?sentry_key=${{ secrets.SENTRY_SERVER_MU3_KEY }}
fi

if [ "${{ github.event.inputs.sentry_project }}" == "sandbox" ] && [ ${{ secrets.SENTRY_SERVER_SANDBOX_KEY }} != 0 ]; then
if [ "$SENTRY_PROJECT" == "sandbox" ] && [ ${{ secrets.SENTRY_SERVER_SANDBOX_KEY }} != 0 ]; then
DO_UPLOAD_SYMBOLS='true'
SENTRY_PROJECT="sandbox"
SENTRY_URL=https://sentry.musescore.org/api/3/minidump/?sentry_key=${{ secrets.SENTRY_SERVER_SANDBOX_KEY }}
fi

Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/ci_macos_mu4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,15 @@ jobs:
fi
DO_UPLOAD_SYMBOLS='false'
SENTRY_PROJECT=""
SENTRY_PROJECT=${{ github.event.inputs.sentry_project }}
SENTRY_URL=""
if [ "${{ github.event.inputs.sentry_project }}" == "editor" ] && [ ${{ secrets.SENTRY_SERVER_MU3_KEY }} != 0 ]; then
if [ "$SENTRY_PROJECT" == "editor" ] && [ ${{ secrets.SENTRY_SERVER_MU3_KEY }} != 0 ]; then
DO_UPLOAD_SYMBOLS='true'
SENTRY_PROJECT="editor"
SENTRY_URL=https://sentry.musescore.org/api/2/minidump/?sentry_key=${{ secrets.SENTRY_SERVER_MU3_KEY }}
fi
if [ "${{ github.event.inputs.sentry_project }}" == "sandbox" ] && [ ${{ secrets.SENTRY_SERVER_SANDBOX_KEY }} != 0 ]; then
if [ "$SENTRY_PROJECT" == "sandbox" ] && [ ${{ secrets.SENTRY_SERVER_SANDBOX_KEY }} != 0 ]; then
DO_UPLOAD_SYMBOLS='true'
SENTRY_PROJECT="sandbox"
SENTRY_URL=https://sentry.musescore.org/api/3/minidump/?sentry_key=${{ secrets.SENTRY_SERVER_SANDBOX_KEY }}
fi
Expand Down Expand Up @@ -167,7 +165,7 @@ jobs:
- name: Upload dump symbols
if: env.DO_UPLOAD_SYMBOLS == 'true'
run: |
sudo bash ./build/ci/tools/sentry_syms_upload.sh -t ${{ secrets.SENTRY_AUTH_TOKEN }} -p ${SENTRY_PROJECT}
bash ./build/ci/tools/sentry_syms_upload.sh -t ${{ secrets.SENTRY_AUTH_TOKEN }} -p ${SENTRY_PROJECT}
- name: Publish package
if: env.DO_PUBLISH == 'true'
run: |
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/ci_windows_mu4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,15 @@ jobs:
fi
DO_UPLOAD_SYMBOLS='false'
SENTRY_PROJECT=""
SENTRY_PROJECT=${{ github.event.inputs.sentry_project }}
SENTRY_URL=""
if [ "${{ github.event.inputs.sentry_project }}" == "editor" ] && [ ${{ secrets.SENTRY_SERVER_MU3_KEY }} != 0 ]; then
if [ "$SENTRY_PROJECT" == "editor" ] && [ ${{ secrets.SENTRY_SERVER_MU3_KEY }} != 0 ]; then
DO_UPLOAD_SYMBOLS='true'
SENTRY_PROJECT="editor"
SENTRY_URL=https://sentry.musescore.org/api/2/minidump/?sentry_key=${{ secrets.SENTRY_SERVER_MU3_KEY }}
fi
if [ "${{ github.event.inputs.sentry_project }}" == "sandbox" ] && [ ${{ secrets.SENTRY_SERVER_SANDBOX_KEY }} != 0 ]; then
if [ "$SENTRY_PROJECT" == "sandbox" ] && [ ${{ secrets.SENTRY_SERVER_SANDBOX_KEY }} != 0 ]; then
DO_UPLOAD_SYMBOLS='true'
SENTRY_PROJECT="sandbox"
SENTRY_URL=https://sentry.musescore.org/api/3/minidump/?sentry_key=${{ secrets.SENTRY_SERVER_SANDBOX_KEY }}
fi
Expand Down Expand Up @@ -101,7 +99,7 @@ jobs:
shell: cmd
run: |
IF ${{ secrets.TELEMETRY_TRACK_ID != 0 }} == true ( SET T_ID=${{ secrets.TELEMETRY_TRACK_ID }} ) ELSE ( SET T_ID="''" )
IF ${{ env.SENTRY_URL != 0 }} == true ( SET C_URL=${{ env.SENTRY_URL }} ) ELSE ( SET C_URL="''" )
IF ${{ env.SENTRY_URL != 0 }} == true ( SET C_URL="${{ env.SENTRY_URL }}" ) ELSE ( SET C_URL="" )
build\ci\windows\build.bat -n ${{ github.run_id }} --telemetry %T_ID% --crash_log_url %C_URL% --build_mu4 ON
- name: Generate dump symbols
if: env.DO_BUILD == 'true'
Expand All @@ -124,7 +122,7 @@ jobs:
if: env.DO_UPLOAD_SYMBOLS == 'true'
shell: bash
run: |
sudo bash ./build/ci/tools/sentry_syms_upload.sh -t ${{ secrets.SENTRY_AUTH_TOKEN }} -p ${SENTRY_PROJECT}
bash ./build/ci/tools/sentry_syms_upload.sh -t ${{ secrets.SENTRY_AUTH_TOKEN }} -p ${SENTRY_PROJECT}
- name: Publish package
if: env.DO_PUBLISH == 'true'
shell: bash
Expand Down
30 changes: 24 additions & 6 deletions build/ci/tools/sentry_syms_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ SENTRY_AUTH_TOKEN=""
SENTRY_ORG=""
SENTRY_PROJECT=""

SENTRY_DOWNLOAD_SCRIPT=https://sentry.io/get-cli # Don't work on Windows
SENTRY_DOWNLOAD_Windows_x86_64="https://downloads.sentry-cdn.com/sentry-cli/1.59.0/sentry-cli-Windows-x86_64.exe"

while [[ "$#" -gt 0 ]]; do
case $1 in
-s|--symbols) SYMBOLS_PATH="$2"; shift ;;
Expand Down Expand Up @@ -39,19 +42,34 @@ echo "SENTRY_ORG: $SENTRY_ORG"
echo "SENTRY_PROJECT: $SENTRY_PROJECT"

# Install Sentry CLI
if ! command -v sentry-cli &> /dev/null
then
curl -sL https://sentry.io/get-cli/ | bash
echo "sentry-cli now installed"
PLATFORM=`uname -s`
if [[ $PLATFORM == CYGWIN* ]] || [[ $PLATFORM == MINGW* ]] || [[ $PLATFORM == MSYS* ]]; then
PLATFORM="Windows"
fi

if [ $PLATFORM == "Windows" ]; then

INSTALL_PATH=/c/sentry
SENTRY_CLI=$INSTALL_PATH/sentry-cli
if ! command -v $SENTRY_CLI &> /dev/null; then
mkdir $INSTALL_PATH
curl -SL --progress-bar "$SENTRY_DOWNLOAD_Windows_x86_64" > "$SENTRY_CLI"
echo "sentry-cli now installed"
fi

else
echo "sentry-cli already installed"
SENTRY_CLI=sentry-cli
if ! command -v $SENTRY_CLI &> /dev/null; then
curl -sL "$SENTRY_DOWNLOAD_SCRIPT" | bash
echo "sentry-cli now installed"
fi
fi

# Upload symbols
export SENTRY_URL=$SENTRY_URL
export SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN

sentry-cli upload-dif -o $SENTRY_ORG -p $SENTRY_PROJECT $SYMBOLS_PATH
$SENTRY_CLI upload-dif -o $SENTRY_ORG -p $SENTRY_PROJECT $SYMBOLS_PATH

if [ $? -eq 0 ]; then
echo "Success symbols uploaded"
Expand Down
4 changes: 2 additions & 2 deletions build/ci/windows/build.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@echo off
REM @echo off
ECHO "MuseScore build"

SET ARTIFACTS_DIR=build.artifacts
Expand All @@ -13,7 +13,7 @@ SET BUILD_UI_MU4=OFF
IF /I "%1" == "-n" SET BUILD_NUMBER=%2& SHIFT
IF /I "%1" == "-b" SET TARGET_PROCESSOR_BITS=%2& SHIFT
IF /I "%1" == "--telemetry" SET TELEMETRY_TRACK_ID=%2& SHIFT
IF /I "%1" == "--crash_log_url" SET CRASH_LOG_SERVER_URL=%2& SHIFT
IF /I "%1" == "--crash_log_url" SET CRASH_LOG_SERVER_URL=%2& SHIFT & SHIFT
IF /I "%1" == "--portable" SET BUILD_WIN_PORTABLE=%2& SHIFT
IF /I "%1" == "--build_mu4" SET BUILD_UI_MU4=%2& SHIFT
SHIFT
Expand Down
25 changes: 25 additions & 0 deletions framework/telemetry/internal/dump/crashhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "crashhandler.h"

#include <QDir>

#include <thirdparty/google_crashpad_client/client/crashpad_client.h>
#include <thirdparty/google_crashpad_client/client/crash_report_database.h>
#include <thirdparty/google_crashpad_client/client/settings.h>
Expand Down Expand Up @@ -69,6 +71,8 @@ bool CrashHandler::start(const io::path& handlerFilePath, const io::path& dumpsD
db->GetSettings()->SetUploadsEnabled(true);
}

removePendingLockFiles(dumpsDir);

m_client = new CrashpadClient();
bool success = m_client->StartHandler(
handler,
Expand All @@ -83,3 +87,24 @@ bool CrashHandler::start(const io::path& handlerFilePath, const io::path& dumpsD

return success;
}

void CrashHandler::removePendingLockFiles(const io::path& dumpsDir)
{
#ifdef _MSC_VER
//! NOTE Different directory structure and no lock file on Windows
return;
#endif

io::path pendingDir = dumpsDir + "/pending";
RetVal<io::paths> rv = fileSystem()->scanFiles(pendingDir, { "*.lock" }, framework::IFileSystem::ScanMode::OnlyCurrentDir);
if (!rv.ret) {
LOGE() << "failed get pending lock files, err: " << rv.ret.toString();
return;
}

for (const io::path& p : rv.val) {
if (!fileSystem()->remove(p)) {
LOGE() << "failed remove file: " << p;
}
}
}
2 changes: 2 additions & 0 deletions framework/telemetry/internal/dump/crashhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class CrashHandler

private:

void removePendingLockFiles(const io::path& dumpsDir);

crashpad::CrashpadClient* m_client = nullptr;
};
}
Expand Down
2 changes: 1 addition & 1 deletion msvc_build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ IF /I "%1"=="clean" (
if not exist "%INSTALL_FOLDER%\" mkdir "%INSTALL_FOLDER%"

IF NOT "%MSCORE_STABLE_BUILD%" == "" (
IF NOT "%CRASH_LOG_SERVER_URL%" == "" (
IF NOT %CRASH_LOG_SERVER_URL% == "" (
IF "%BUILD_FOR_WINSTORE%" == "OFF" (
SET CRASH_REPORT_URL_OPT=-DCRASH_REPORT_URL=%CRASH_LOG_SERVER_URL% -DBUILD_CRASH_REPORTER=ON
)
Expand Down

0 comments on commit aca3c25

Please sign in to comment.