HISE Logo Forum
    • Categories
    • Register
    • Login

    Help with: Buffer_Not_Writeable_By_vImage

    Scheduled Pinned Locked Moved General Questions
    18 Posts 2 Posters 706 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dan KorneffD
      Dan Korneff @Christoph Hart
      last edited by Dan Korneff

      @Christoph-Hart Here's the crash log that contains the random crashes I've been experiencing:

      BUG IN CLIENT OF LIBPLATFORM: Unlock of an os_unfair_lock not owned by current thread

      Crashed Thread:        0  Main Thread  Dispatch queue: com.apple.main-thread
      
      Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
      Exception Codes:       0x0000000000000001, 0x0000000000000000
      Exception Note:        EXC_CORPSE_NOTIFY
      
      Termination Signal:    Illegal instruction: 4
      Termination Reason:    Namespace SIGNAL, Code 0x4
      Terminating Process:   exc handler [1990]
      
      Application Specific Information:
      dyld: in dladdr()
      BUG IN CLIENT OF LIBPLATFORM: Unlock of an os_unfair_lock not owned by current thread
      
      Thread 0 Crashed:: Main Thread  Dispatch queue: com.apple.main-thread
      0   libsystem_platform.dylib      	0x00007fff728fb655 _os_unfair_lock_unowned_abort + 23
      1   libsystem_platform.dylib      	0x00007fff728f6aaf _os_unfair_lock_unlock_slow + 105
      2   libsystem_pthread.dylib       	0x00007fff728fff53 _pthread_cond_check_init_slow + 206
      3   libsystem_pthread.dylib       	0x00007fff728ffc98 pthread_cond_broadcast + 55
      4   libc++.1.dylib                	0x00007fff6f9d6575 std::__1::condition_variable::notify_all() + 9
      5   com.korneffaudio.myplug       	0x0000000141263052 juce::MessageManager::Lock::BlockingMessage::messageCallback() + 98
      6   com.korneffaudio.myplug       	0x0000000141261146 juce::MessageQueue::deliverNextMessage() + 246
      7   com.korneffaudio.myplug       	0x0000000141260ffe juce::MessageQueue::runLoopSourceCallback(void*) + 14
      8   com.apple.CoreFoundation      	0x00007fff38592884 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
      9   com.apple.CoreFoundation      	0x00007fff38592823 __CFRunLoopDoSource0 + 103
      10  com.apple.CoreFoundation      	0x00007fff3859263d __CFRunLoopDoSources0 + 209
      11  com.apple.CoreFoundation      	0x00007fff38591359 __CFRunLoopRun + 937
      12  com.apple.CoreFoundation      	0x00007fff38590953 CFRunLoopRunSpecific + 466
      13  com.apple.HIToolbox           	0x00007fff371ababd RunCurrentEventLoopInMode + 292
      14  com.apple.HIToolbox           	0x00007fff371ab7d5 ReceiveNextEventCommon + 584
      15  com.apple.HIToolbox           	0x00007fff371ab579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
      16  com.apple.AppKit              	0x00007fff357f1039 _DPSNextEvent + 883
      17  com.apple.AppKit              	0x00007fff357ef880 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
      18  com.apple.AppKit              	0x00007fff357e158e -[NSApplication run] + 658
      19  com.digidesign.framework.DFW  	0x0000000102b27ba7 DFW_EventLoop::RunApplicationEventLoop() + 27
      20  com.digidesign.framework.DFW  	0x000000010292b87a TApplication::Run() + 34
      21  com.digidesign.framework.ProTools_Orange	0x000000011e6b5836 Launch_Pro_Tools(char*, bool) + 1613
      22  com.digidesign.framework.ProTools_Orange	0x000000011e6bc651 LaunchProTools + 5688
      23  com.avid.ProToolsDeveloper    	0x0000000101997738 main + 5544
      24  libdyld.dylib                 	0x00007fff726fbcc9 start + 1
      
      

      Found this:
      https://forum.juce.com/t/race-condition-i-e-crash-in-messagemanager-lock-with-fix/55870/4

      And the fix:
      https://github.com/juce-framework/JUCE/commit/33e81616ade84f40ccfec662c167b1b8dc772640

      What do you suggest?

      Dan Korneff - Producer / Mixer / Audio Nerd

      1 Reply Last reply Reply Quote 1
      • Dan KorneffD
        Dan Korneff @Christoph Hart
        last edited by

        @Christoph-Hart should I try to cherry pick this JUCE commit? I'm not sure how different the message system is between 6 and 7....

        Dan Korneff - Producer / Mixer / Audio Nerd

        Christoph HartC 1 Reply Last reply Reply Quote 0
        • Christoph HartC
          Christoph Hart @Dan Korneff
          last edited by

          @Dan-Korneff nice find! Yes, please try to cherry pick this, if it works, it would be awesome.

          Dan KorneffD 1 Reply Last reply Reply Quote 0
          • Dan KorneffD
            Dan Korneff @Christoph Hart
            last edited by

            @Christoph-Hart I tried.. 😖

            HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(295,22): error C2065: 'lock': undeclared identifier (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
            
            HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(300,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
            
            HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(300,26): error C2146: syntax error: missing ';' before identifier 'scope' (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
            
            HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(300,26): error C2065: 'scope': undeclared identifier (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
            
            HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(393,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
            
            HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(393,22): error C2146: syntax error: missing ';' before identifier 'scope' (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
            
            HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(393,22): error C2065: 'scope': undeclared identifier (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
            
            HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(409,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\..\JuceLibraryCode\i
            nclude_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
            
            HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(409,22): error C2146: syntax error: missing ';' before identifier 'scope' (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
            
            HISE\JUCE\modules\juce_events\messages\juce_MessageManager.cpp(409,22): error C2065: 'scope': undeclared identifier (compiling source file ..\..\JuceLibraryCode\include_juce_events.cpp) [Z:\Korneff Audio\Test Export\VST\Test Export\Binaries\Builds\VisualStudio2022\Test Export_SharedCode.vcxproj]
            

            Looks a bit more involved.

            Dan Korneff - Producer / Mixer / Audio Nerd

            Christoph HartC 1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart @Dan Korneff
              last edited by

              @Dan-Korneff alright, I‘ll take a look.

              Dan KorneffD 1 Reply Last reply Reply Quote 1
              • Dan KorneffD
                Dan Korneff @Christoph Hart
                last edited by

                @Christoph-Hart greatly appreciated !

                Dan Korneff - Producer / Mixer / Audio Nerd

                Christoph HartC 1 Reply Last reply Reply Quote 0
                • Christoph HartC
                  Christoph Hart @Dan Korneff
                  last edited by

                  @Dan-Korneff OK, I've manually patched the files (and I needed to pull in another class from JUCE 7 to compile), however now I'm hitting a few weird assertions that I didn't before so I'm a bit uncomfortable pushing this "fix" - it might be possible that there are other changes to JUCE 7's message handling and this would be a Frankenstein thing.

                  Christoph HartC 1 Reply Last reply Reply Quote 2
                  • Christoph HartC
                    Christoph Hart @Christoph Hart
                    last edited by

                    @Christoph-Hart Following the JUCE discussion, this might be a "better" fix (in the sense that it's less intrusive than the JUCE 7 fix):

                    https://forum.juce.com/t/blockingmessage-accessing-messagemanager-lock-that-went-out-of-scope/51901

                    Dan KorneffD 3 Replies Last reply Reply Quote 1
                    • Dan KorneffD
                      Dan Korneff @Christoph Hart
                      last edited by

                      @Christoph-Hart I can give this a try:

                              if (blockingMessage != nullptr)
                               {
                                {
                               ScopedLock lock(blockingMessage->ownerCriticalSection);
                                   blockingMessage->owner.set(nullptr);
                                }
                                   blockingMessage->releaseEvent.signal();
                                   blockingMessage = nullptr;
                               }
                      

                      Dan Korneff - Producer / Mixer / Audio Nerd

                      1 Reply Last reply Reply Quote 0
                      • Dan KorneffD
                        Dan Korneff @Christoph Hart
                        last edited by

                        @Christoph-Hart Do you have any plans to eventually bump to JUCE 7?

                        Dan Korneff - Producer / Mixer / Audio Nerd

                        1 Reply Last reply Reply Quote 0
                        • Dan KorneffD
                          Dan Korneff @Christoph Hart
                          last edited by Dan Korneff

                          @Christoph-Hart Does this look right? It's throwing a bunch of errors.

                          void MessageManager::Lock::exit() const noexcept
                          {
                              if (blockingMessage != nullptr)
                              {
                                  {
                                      ScopedLock lock(blockingMessage->ownerCriticalSection);
                                      blockingMessage->owner.set(nullptr);
                                  }
                                  blockingMessage->releaseEvent.signal();
                                  blockingMessage = nullptr;
                              }
                          
                              const ScopeGuard scope{ [&] { blockingMessage = nullptr; } };
                          
                              blockingMessage->stopWaiting();
                          
                              if (!blockingMessage->wasAcquired())
                                  return;
                          
                              if (auto* mm = MessageManager::instance)
                              {
                                  jassert(mm->currentThreadHasLockedMessageManager());
                                  mm->threadWithLock = {};
                              }
                          }
                          

                          EDIT: operator error. This works:

                          void MessageManager::Lock::exit() const noexcept
                          {
                              if (lockGained.compareAndSetBool (false, true))
                              {
                                  auto* mm = MessageManager::instance;
                          
                                  jassert (mm == nullptr || mm->currentThreadHasLockedMessageManager());
                                  lockGained.set (0);
                          
                                  if (mm != nullptr)
                                      mm->threadWithLock = {};
                          
                                  if (blockingMessage != nullptr)
                                  {
                                      {
                                          ScopedLock lock(blockingMessage->ownerCriticalSection);
                                          blockingMessage->owner.set(nullptr);
                                      }
                                      blockingMessage->releaseEvent.signal();
                                      blockingMessage = nullptr;
                                  }
                              }
                          }
                          

                          Testing now

                          Dan Korneff - Producer / Mixer / Audio Nerd

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          32

                          Online

                          1.7k

                          Users

                          11.8k

                          Topics

                          102.8k

                          Posts