Strange Crash - Only on Github Build

So I’ve got a plugin I’m working on. The local builds run just fine. But the builds on github actions started not working for me when I migrated from 2.0.4 to 2.4.1.

I’ve migrated both my local builds and the git hub builds to be using 2.4.1.

The crash for me is happening in the module’s widget constructor.

I’ve traced the crash down to the TParamWidget* o = new TParamWidget; inside createParam. Here’s how:

Crash Log:

[2.720 info src/app/RackWidget.cpp:327 fromJson] Creating module widget JP Four Track
[2.721 debug src/FourTrack.cpp:428 FourTrackWidget] A
[2.721 debug src/FourTrack.cpp:430 FourTrackWidget] B1
[2.721 debug src/FourTrack.cpp:432 FourTrackWidget] B2 C:/Users/Andrew/Documents/Rack2/plugins-win-x64/JPLab/res/FourTrack.svg
[2.729 info src/window/Svg.cpp:28 loadFile] Loaded SVG C:/Users/Andrew/Documents/Rack2/plugins-win-x64/JPLab/res/FourTrack.svg
[2.729 debug src/FourTrack.cpp:434 FourTrackWidget] B3
[2.729 debug src/FourTrack.cpp:436 FourTrackWidget] C
[2.729 debug src/FourTrack.cpp:438 FourTrackWidget] D1
[2.729 debug src/FourTrack.cpp:440 FourTrackWidget] D2
[2.729 debug src/FourTrack.cpp:390 createParamCentered_my] createParamCentered_my A
[2.729 debug src/FourTrack.cpp:373 createParam_my] createParam_my A
[3.138 fatal adapters/standalone.cpp:49 fatalSignalHandler] Fatal signal 11. Stack trace:
21:  0x0
20:  0x0
19: _C_specific_handler 0x7ffc71e07f60
18: _chkstk 0x7ffc73c72100
17: RtlRaiseException 0x7ffc73c21030
16: KiUserExceptionDispatcher 0x7ffc73c70d00
15: RtlSizeHeap 0x7ffc73bf4160
14: NotifyShims 0x7ffc37df2190
13: free_base 0x7ffc7133f040
12: Z14createParam_myIN4rack16componentlibrary19RoundSmallBlackKnobEEPT_NS0_4math3VecEPNS0_6engine6ModuleEi 0x7ffbe396b770
11: ZN15FourTrackWidgetC1EP9FourTrack 0x7ffbe397f340
10: ZZN4rack11createModelI9FourTrack15FourTrackWidgetEEPNS_6plugin5ModelENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN6TModel18createModuleWidgetEPNS_6engine6ModuleE 0x7ffbe39b3430
9: ZN4rack3app10RackWidget8fromJsonEP6json_t 0x7ffc0e3c8060
8: ZN4rack5patch7Manager8fromJsonEP6json_t 0x7ffc0e3884a0
7: ZN4rack5patch7Manager12loadAutosaveEv 0x7ffc0e388840
6: ZN4rack5patch7Manager6launchENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE 0x7ffc0e389f40
5: ZN4rack5patch7Manager6launchENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE 0x7ffc0e389f40
4: ZN4rack5patch7Manager6launchENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE 0x7ffc0e389f40
3: ZN4rack5patch7Manager6launchENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE 0x7ffc0e389f40
2: ZN4rack5patch7Manager6launchENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE 0x7ffc0e389f40
1: BaseThreadInitThunk 0x7ffc73267330
0: RtlUserThreadStart 0x7ffc73c22690

Code:

template <class TParamWidget>
TParamWidget* createParam_my(math::Vec pos, engine::Module* module, int paramId) {
	DEBUG("createParam_my A");
	TParamWidget* o = new TParamWidget;
	DEBUG("createParam_my B");
	o->box.pos = pos;
	DEBUG("createParam_my C");
	o->app::ParamWidget::module = module;
	DEBUG("createParam_my D");
	o->app::ParamWidget::paramId = paramId;
	DEBUG("createParam_my E");
	o->initParamQuantity();
	DEBUG("createParam_my F");
	return o;
}


template <class TParamWidget>
TParamWidget* createParamCentered_my(math::Vec pos, engine::Module* module, int paramId) {
	DEBUG("createParamCentered_my A");
	TParamWidget* o = createParam_my<TParamWidget>(pos, module, paramId);
	DEBUG("createParamCentered_my B");
	o->box.pos = o->box.pos.minus(o->box.size.div(2));
	DEBUG("createParamCentered_my C");
	return o;
}

struct FourTrackWidget : TrackModuleWidget<ROW_COUNT,COL_COUNT> {

	//Other Code

	FourTrackWidget(FourTrack* module) {
		DEBUG("A");
		setModule(module);
		DEBUG("B1");
		std::string a = asset::plugin(pluginInstance, "res/FourTrack.svg");
		DEBUG("B2 %s",a.c_str());
		auto b = createPanel(a);
		DEBUG("B3");
		setPanel(b);
		DEBUG("C");

		DEBUG("D1");
		auto v = mm2px(Vec(5.149, 32.986));
		DEBUG("D2");
		auto d = createParamCentered_my<RoundSmallBlackKnob>(v, module, FourTrack::LENGTH_PARAM);
		DEBUG("D3");
		addParam(d);
		DEBUG("E");
		addParam(createParamCentered<Trimpot>(mm2px(Vec(15.486, 35.822)), module, FourTrack::LENGTH_AV_PARAM));
		DEBUG("F");
		addParam(createParamCentered<TrackSwitch>(mm2px(Vec(23.86, 63.53)), module, FourTrack::TRACK_CONFIG_PARAM));
		DEBUG("G");
		addParam(createParamCentered<ExtraModeSwitch>(mm2px(Vec(4.193, 49.00)), module, FourTrack::EXTRA_MODE_PARAM));
		DEBUG("H");

Does anyone have any insight as to what might be going on here?

Each of my 5 modules inside this plugin crashes this way, though I haven’t specifically tracked down if there is one widget causing the problems yet. But since it was the first widget in FourTrack, I suspect its every parameter widget…

Even with an empty module, I still get the crash. I am very confused.

Code:

#include "plugin2.hpp"


struct TestModule : Module {
	enum ParamId {
		PARAMS_LEN
	};
	enum InputId {
		INPUTS_LEN
	};
	enum OutputId {
		OUTPUTS_LEN
	};
	enum LightId {
		LIGHTS_LEN
	};

	TestModule() {
		config(PARAMS_LEN, INPUTS_LEN, OUTPUTS_LEN, LIGHTS_LEN);
	}

	void process(const ProcessArgs& args) override {
	}
};


struct TestModuleWidget : ModuleWidget {
	TestModuleWidget(TestModule* module) {
		setModule(module);
		setPanel(createPanel(asset::plugin(pluginInstance, "res/FourTrack.svg")));

		addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0)));
		addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
		addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
		addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
	}
};


Model* modelTestModule = createModel<TestModule, TestModuleWidget>("TestModule");

Crash:


[3.059 info src/window/Svg.cpp:28 loadFile] Loaded SVG C:/Program Files/VCV/Rack2Pro/res/ComponentLibrary/Rail.svg
[4.361 info src/app/Browser.cpp:201 createPreview] Creating module widget JP TestModule
[4.365 info src/window/Svg.cpp:28 loadFile] Loaded SVG C:/Users/Andrew/Documents/Rack2/plugins-win-x64/JPLab/res/FourTrack.svg
[4.761 fatal adapters/standalone.cpp:49 fatalSignalHandler] Fatal signal 11. Stack trace:
33:  0x0
32:  0x0
31: _C_specific_handler 0x7ffc71e07f60
30: _chkstk 0x7ffc73c72100
29: RtlRaiseException 0x7ffc73c21030
28: KiUserExceptionDispatcher 0x7ffc73c70d00
27: memset 0x7ffc73c73f80
26: RtlFreeHeap 0x7ffc73bf4760
25: free_base 0x7ffc7133f040
24: ZZN4rack11createModelI10TestModule16TestModuleWidgetEEPNS_6plugin5ModelENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEN6TModel18createModuleWidgetEPNS_6engine6ModuleE 0x7ffbe6e729d0
23: ZN4rack3app7browser8ModelBox4drawERKNS_6widget6Widget8DrawArgsE 0x7ffc0e84a500
22: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x7ffc0e3ef570
21: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x7ffc0e3ef6e0
20: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x7ffc0e3ef570
19: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x7ffc0e3ef6e0
18: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x7ffc0e3ef570
17: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x7ffc0e3ef6e0
16: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x7ffc0e3ef570
15: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x7ffc0e3ef6e0
14: ZN4rack2ui12ScrollWidget4drawERKNS_6widget6Widget8DrawArgsE 0x7ffc0e3e77b0
13: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x7ffc0e3ef570
12: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x7ffc0e3ef6e0
11: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x7ffc0e3ef570
10: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x7ffc0e3ef6e0
9: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x7ffc0e3ef570
8: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x7ffc0e3ef6e0
7: ZN4rack6window6Window4stepEv 0x7ffc0e3f17a0
6: ZN4rack6window6Window3runEv 0x7ffc0e3f21f0
5: ZN4rack6window6Window3runEv 0x7ffc0e3f21f0
4: ZN4rack6window6Window3runEv 0x7ffc0e3f21f0
3: ZN4rack6window6Window3runEv 0x7ffc0e3f21f0
2: ZN4rack6window6Window3runEv 0x7ffc0e3f21f0
1: BaseThreadInitThunk 0x7ffc73267330
0: RtlUserThreadStart 0x7ffc73c22690

In case it helps, here is the gitworkflow for making the builds.

The issue may only be a windows issue as my one mac tester hasn’t reported it.

name: Build and GitHub Release
on: workflow_dispatch

env:
  rack-sdk-version: 2.4.1

defaults:
  run:
    shell: bash

jobs:
  build:
    name: ${{ matrix.config.name }}
    runs-on: ${{ matrix.config.os }}
    strategy:
      matrix:
        config:        
        # - {
        #     name: Linux,
        #     os: ubuntu-20.04,
        #     prepare-os: sudo apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages update,
        #     prepare-os2: sudo apt install -y libglu-dev,
        #     postfix: lin-x64
        #   }
        - {
            name: MacOS,
            os: macos-latest,
            prepare-os: "",
            prepare-os2: "",
            postfix: mac-x64
          }
        - {
            name: Windows,
            os: windows-latest,
            prepare-os: export CC=gcc,
            prepare-os2: "",
            postfix: win-x64
          }
        language: [ 'cpp' ]
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Get Rack-SDK
        run: |
          pushd $HOME
          curl -k -o Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-${{ matrix.config.postfix }}.zip
          unzip Rack-SDK.zip
      - name: Patch plugin.mk, use 7zip on Windows
        if: runner.os == 'Windows'
        run: |
          sed -i 's/zip -q -9 -r/7z a -tzip -mx=9/' $HOME/Rack-SDK/plugin.mk
      - name: Modify plugin version
        # only modify plugin version if no tag was created
        # if: "! startsWith(github.ref, 'refs/tags/v')"
        run: |
          gitrev=`git rev-parse --short HEAD`
          pluginversion=`jq -r '.version' plugin.json`
          echo "Set plugin version from $pluginversion to $pluginversion-$gitrev"
          cat <<< `jq --arg VERSION "$pluginversion-$gitrev" '.version=$VERSION' plugin.json` > plugin.json
      # - name: Initialize CodeQL
      #   if: runner.os == 'Linux'
      #   uses: github/codeql-action/init@v2
      #   with:
      #     languages: ${{ matrix.language }}
      - name: Build plugin
        run: |
          ${{ matrix.config.prepare-os }}
          ${{ matrix.config.prepare-os2 }}
          export RACK_DIR=$HOME/Rack-SDK
          make -j dep
          make -j dist
      - name: Upload artifact
        uses: actions/upload-artifact@v2
        with:
          path: dist
          name: ${{ matrix.config.name }}
      # - name: Perform CodeQL Analysis
      #   if: runner.os == 'Linux'
      #   uses: github/codeql-action/analyze@v2

  publish:
    name: Publish plugin
    # only create a release if a tag was created that is called e.g. v1.2.3
    # see also https://vcvrack.com/manual/Manifest#version
    # if: startsWith(github.ref, 'refs/tags/v')
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: actions/checkout@v2
      - uses: FranzDiebold/github-env-vars-action@v1.2.1
      - name: Get Release name from plugin and git revision
        run: |
          pluginversion=`jq -r '.version' plugin.json`
          gitrev=`git rev-parse --short HEAD`
          echo "releasename=$pluginversion-$gitrev" >> $GITHUB_ENV
      - name: Create Release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ env.releasename }}
          release_name: Release ${{ env.releasename }}
          body: |
            ${{ env.GITHUB_REPOSITORY_NAME }} VCV Rack Plugin ${{ env.releasename }}
          draft: false
          prerelease: true
      - uses: actions/download-artifact@v2
        with:
          path: _artifacts
      - name: Upload release assets
        uses: svenstaro/upload-release-action@v2
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          file: _artifacts/**/*.vcvplugin
          tag: ${{ env.releasename }}
          file_glob: true

Hmm, so I believe I have fixed my issue. I updated the build action to @qno 's latest git hub action. I don’t know why that fixed the issue though… but in case anyways else needs it, here is the build script I used (it has some slight tweaks from qno’s for my situation and taste)

name: Build and GitHub Release
on: workflow_dispatch

env:
  rack-sdk-version: 2.4.1
  rack-plugin-toolchain-dir: /home/build/rack-plugin-toolchain

defaults:
  run:
    shell: bash

jobs:

  modify-plugin-version:
    name: Modify plugin version
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/cache@v3
        id: plugin-version-cache
        with:
          path: plugin.json
          key: ${{ github.sha }}-${{ github.run_id }}
      - run: |
          gitrev=`git rev-parse --short HEAD`
          pluginversion=`jq -r '.version' plugin.json`
          echo "Set plugin version from $pluginversion to $pluginversion-$gitrev"
          cat <<< `jq --arg VERSION "$pluginversion-$gitrev" '.version=$VERSION' plugin.json` > plugin.json
        # only modify plugin version if no tag was created
        # if: "! startsWith(github.ref, 'refs/tags/v')"

  build:
    name: ${{ matrix.platform }}
    needs: modify-plugin-version
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/qno/rack-plugin-toolchain-win-linux
      options: --user root
    strategy:
      matrix:
        platform: [win-x64, lin-x64]
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: recursive
      - uses: actions/cache@v3
        id: plugin-version-cache
        with:
          path: plugin.json
          key: ${{ github.sha }}-${{ github.run_id }}
      - name: Build plugin
        run: |
          export PLUGIN_DIR=$GITHUB_WORKSPACE
          pushd ${{ env.rack-plugin-toolchain-dir }}
          make plugin-build-${{ matrix.platform }}
      - name: Upload artifact
        uses: actions/upload-artifact@v3
        with:
          path: ${{ env.rack-plugin-toolchain-dir }}/plugin-build
          name: ${{ matrix.platform }}

  # build-mac:
  #   name: mac
  #   needs: modify-plugin-version
  #   runs-on: macos-latest
  #   strategy:
  #     fail-fast: false
  #     matrix:
  #       platform: [x64, arm64]
  #   steps:
  #     - uses: actions/checkout@v3
  #       with:
  #         submodules: recursive
  #     - uses: actions/cache@v3
  #       id: plugin-version-cache
  #       with:
  #         path: plugin.json
  #         key: ${{ github.sha }}-${{ github.run_id }}
  #     - name: Get Rack-SDK
  #       run: |
  #         pushd $HOME
  #         wget -O Rack-SDK.zip https://vcvrack.com/downloads/Rack-SDK-${{ env.rack-sdk-version }}-mac-${{ matrix.platform }}.zip
  #         unzip Rack-SDK.zip
  #     - name: Build plugin
  #       run: |
  #         CROSS_COMPILE_TARGET_x64=x86_64-apple-darwin
  #         CROSS_COMPILE_TARGET_arm64=arm64-apple-darwin
  #         export RACK_DIR=$HOME/Rack-SDK
  #         export CROSS_COMPILE=$CROSS_COMPILE_TARGET_${{ matrix.platform }}
  #         make dep
  #         make dist
  #     - name: Upload artifact
  #       uses: actions/upload-artifact@v3
  #       with:
  #         path: dist/*.vcvplugin
  #         name: mac-${{ matrix.platform }}

  publish:
    name: Publish plugin
    # only create a release if a tag was created that is called e.g. v1.2.3
    # see also https://vcvrack.com/manual/Manifest#version
    # if: startsWith(github.ref, 'refs/tags/v')
    runs-on: ubuntu-latest
    # needs: [build, build-mac]
    needs: build
    steps:
      - uses: actions/checkout@v2
      - uses: FranzDiebold/github-env-vars-action@v1.2.1
      - name: Get Release name from plugin and git revision
        run: |
          pluginversion=`jq -r '.version' plugin.json`
          gitrev=`git rev-parse --short HEAD`
          echo "releasename=$pluginversion-$gitrev" >> $GITHUB_ENV
      - name: Create Release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ env.releasename }}
          release_name: Release ${{ env.releasename }}
          body: |
            ${{ env.GITHUB_REPOSITORY_NAME }} VCV Rack Plugin ${{ env.releasename }}
          draft: false
          prerelease: true
      - uses: actions/download-artifact@v2
        with:
          path: _artifacts
      - name: Upload release assets
        uses: svenstaro/upload-release-action@v2
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          file: _artifacts/**/*.vcvplugin
          tag: ${{ env.releasename }}
          file_glob: true

He recently announced that he updated it to 2.4.1 so that’s probably why, it needs to be 2.4.1 all the way.