jamoma / JamomaMax

Implementation of Jamoma for Cycling'74 Max:
http://www.jamoma.org
41 stars 9 forks source link

sending bang to j.parameter @type integer crash #933

Closed theod closed 8 years ago

theod commented 9 years ago

here is the patch to reproduce the crash :


----------begin_max5_patcher----------
428.3ocuTEsSCBCE8Y3qnoOiKzh.a9j9cXLlBb2rKrVRonSM9ua6sfyYTCZl
RBk1aO8dOmSK843HZkdOzSIWPtlDE8bbTDFxGHZbbDcmXecqnGgQqFrVshlD
lROXaAq8wNHjCZkPsgRtYb5Ngs9NoZysFn1FPvVVrHMgTtz2xSmZeaIxFrL5
psmUNUE0vNoxUGjArwfq2Tqa0lPVSWTjWjmkk35wJcOE9dbW2UID16RuKUAN
GxkO3Kww9lj+ICfuZ1FP9Ow.R8JNuL87RtuWZVFOiepEuBdvQrIZYg8nnnaW
zILhcfELjJggbo2PHMPsbmncBcqTA05AEtD9W4ezD26L7OFaE9IEUdV1m6f7
ohuVqr8xmvpv3tk7cFqCqxoFLKWYjGjvwFH+uw.Wq0iFnTYgMf4Dafi+ANOC
j8eYfXwQI9gqiPE3ierq1qGL0SZd71BxAIz.8VoRXkteUOfgcDl6jMM.N8jZ
Zj8hpV.ke5mt6NW1jOC1v+krIXUhtt6AS+XJQh3NpsMbgPQBNTpBCwMFpAtW
NgO.PXbGNrtSFClvl09kEzXecdI9U3wvqQO
-----------end_max5_patcher-----------
theod commented 9 years ago

@lossius could you make an integration test for it while I fix it ?

theod commented 9 years ago

sorry for the noise... I think this trouble was due to a bad build of JamomaCore or bad copy of the result of this build ... I don't know but there no trouble at all !

reno- commented 9 years ago

It still crashs on my computer with a fresh clean build (Jamoma v1.0-beta.1 | build 189e647)

theod commented 9 years ago

oh ! so I was not dreaming ... could someone else (@lossius, @jln-, @bltzr or @matcham) can test this before I reopen the issue ?

jln- commented 9 years ago

It crashes most often as well on a build from monday morning. It doesnt necessarily crashes on the first bang sent to parameter though. Sometimes it crashes on the second bang sent or more if I send a bang to parameter of type decimal in the mean time (akthough I cannot reproduce exactly)

lossius commented 9 years ago

I set up a metro banging the two objects every 50 ms, and after a few minutes I got the following crash:

https://gist.github.com/lossius/3ccf52f7c9defc146913

Does this look similar to what you have seen? As usual it is useful that reports on crashes are accompanied by crash logs.

matcham commented 9 years ago

I confirm it crash here as well after sending a couple of bangs to a j.parameter test @type integer

Crashed Thread: 0 CrBrowserMain Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000012ed53f8

VM Regions Near 0x12ed53f8: CG image 0000000012ed3000-0000000012ed4000 [ 4K] rw-/rwx SM=COW
--> CG backing stores 0000000013064000-00000000131f5000 [ 1604K] rw-/rw- SM=SHM

Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread 0 libJamomaModular.6.dylib 0x0b9e1fb9 TTDataInfo::getIsNumerical(TTDataType) + 25 1 libJamomaModular.6.dylib 0x0b9e1f1d TTElement::truncate() + 29 2 libJamomaModular.6.dylib 0x0b9e47ed TTData::IntegerDecimalArrayCommand(TTValue const&, TTValue&) + 3949 3 libJamomaModular.6.dylib 0x0b9e7199 TTData::Command(TTValue const&, TTValue&) + 777 4 libJamomaFoundation.6.dylib 0x0be3098b TTObjectBase::sendMessage(TTSymbol, TTValue const&, TTValue&) + 491 (TTObjectBase.cpp:477) 5 libJamomaFoundation.6.dylib 0x0be2df75 TTObject::send(TTSymbol, TTValue const&, TTValue&) + 85 (TTObject.cpp:151) 6 libJamomaMax.6.dylib 0x0b9208ce jamoma_datacommand(TTObject&, symbol, long, atom const_) + 206 (JamomaModularForMax.cpp:415) 7 org.jamoma.j.parameter 0x10034495 datalist(void, symbol, long, atom) + 85 (j.parameter.cpp:335) 8 org.jamoma.j.parameter 0x10034334 databang(void) + 68 (j.parameter.cpp:309) 9 com.cycling74.Max 0x001532a9 outlet_bang + 1045 10 com.cycling74.button 0x0f54bedc jbuttonmousedown + 63 11 com.cycling74.Max 0x00221154 BoxComponent::sendMouseMessage(juce::MouseEvent const&, symbol) + 202 12 com.cycling74.Max 0x00221ba4 BoxComponent::mouseDown(juce::MouseEvent const&) + 1248 13 com.cycling74.Max 0x004991d9 juce::Component::internalMouseDown(juce::MouseInputSource&, juce::Point const&, juce::Time const&) + 661 14 com.cycling74.Max 0x004ec472 juce::MouseInputSourceInternal::sendMouseDown(juce::Component, juce::Point const&, long long) + 106 15 com.cycling74.Max 0x004ec18a juce::MouseInputSourceInternal::setButtons(juce::Point const&, long long, juce::ModifierKeys const&) + 376 16 com.cycling74.Max 0x004eb7e1 juce::MouseInputSourceInternal::handleEvent(juce::ComponentPeer, juce::Point const&, long long, juce::ModifierKeys const&) + 159 17 com.cycling74.Max 0x004eb2df juce::MouseInputSource::handleEvent(juce::ComponentPeer, juce::Point const&, long long, juce::ModifierKeys const&) + 77 18 com.cycling74.Max 0x004f0acb juce::ComponentPeer::handleMouseEvent(int, juce::Point const&, juce::ModifierKeys const&, long long) + 101 19 com.cycling74.Max 0x0057830f juce::NSViewComponentPeer::sendMouseEvent(NSEvent) + 171 20 com.cycling74.Max 0x00578391 juce::NSViewComponentPeer::redirectMouseDown(NSEvent_) + 121 21 com.cycling74.Max 0x0057473c -[JuceNSView_1_52_105_3 asyncMouseDown:] + 34 22 com.cycling74.Max 0x00574714 -[JuceNSView_1_52_105_3 mouseDown:] + 83 23 com.apple.AppKit 0x9810d3f6 -[NSWindow _reallySendEvent:isDelayedEvent:] + 13689 24 com.apple.AppKit 0x979ef3ca -[NSWindow sendEvent:] + 526 25 com.apple.AppKit 0x979eb9c4 -[NSApplication sendEvent:] + 4765 26 com.cycling74.Max 0x0042a0a8 -[MaxCefApplication sendEvent:] + 130 27 com.apple.AppKit 0x9790bbfc -[NSApplication run] + 1003 28 com.cycling74.Max 0x00429ff9 -[MaxCefApplication run] + 58 29 com.cycling74.chromium 0x00e7dc6e 0xd51000 + 1231982 30 com.cycling74.chromium 0x00e7d54c 0xd51000 + 1230156 31 com.cycling74.chromium 0x00ec0fd2 0xd51000 + 1507282 32 com.cycling74.chromium 0x00edbc7e 0xd51000 + 1617022 33 com.cycling74.chromium 0x00ec09ba 0xd51000 + 1505722 34 com.cycling74.chromium 0x00dc9ade 0xd51000 + 494302 35 com.cycling74.Max 0x0042a007 -[MaxCefApplication run] + 72 36 com.cycling74.Max 0x0057d237 juce::MessageManager::runDispatchLoop() + 589 37 com.cycling74.Max 0x0043fad4 juce::JUCEApplication::main(juce::StringArray const&) + 62 38 com.cycling74.Max 0x0043fbe9 juce::JUCEApplication::main(int, char const**) + 73 39 com.cycling74.Max 0x000b3d15 start + 53

lossius commented 9 years ago

truncate() is only called when type is integer, so this probably only happens with integers.

My guess is that either we have memory corruption, or there's something flacky in Foundation with truncation(). That's where I'd start out searching for the problem.

Unfortunately I'm still struggling with how to set up Xcode projects in such a way that we can run the debugger.

theod commented 9 years ago

yes I had the same crash too. about Xcode I used to make an external build system projects for each Makefiles generated by Cmake (into the build folder) depending on what I need to fix. Then I wrote my own post build script action to copy stuff around after the build. Here is a example of script for Core project relative to my computer :

cd /Users/WALL-E/Documents/Developpements/_Build/Jamoma/Max/JamomaCore make install

cp -f /usr/local/jamoma/lib/libJamomaAudioGraph.6.dylib /usr/local/jamoma/JamomaMax/Jamoma/support cp -f /usr/local/jamoma/lib/libJamomaDSP.6.dylib /usr/local/jamoma/JamomaMax/Jamoma/support cp -f /usr/local/jamoma/lib/libJamomaFoundation.6.dylib /usr/local/jamoma/JamomaMax/Jamoma/support cp -f /usr/local/jamoma/lib/libJamomaGraph.6.dylib /usr/local/jamoma/JamomaMax/Jamoma/support cp -f /usr/local/jamoma/lib/libJamomaModular.6.dylib /usr/local/jamoma/JamomaMax/Jamoma/support cp -f /usr/local/jamoma/lib/libJamomaScore.6.dylib /usr/local/jamoma/JamomaMax/Jamoma/support

cp -f "/usr/local/jamoma/extensions/*" /usr/local/jamoma/JamomaMax/Jamoma/support

cp -Rf /usr/local/jamoma/JamomaMax/Jamoma/support /Users/WALL-E/Documents/Developpements/Jamoma/Max/Jamoma

theod commented 8 years ago

I think I know what is going wrong in the code of IntegerDecimalArrayCommand :

            if (aValue.size())
                // Cast to int if
                if (!checkIntegerType(aValue))
                    aValue = (TTInt32)aValue[0];
                aValue[0].truncate();

here there is a lack of {} under the "if (aValue.size())" so the last line can be done even if the value is empty.

theod commented 8 years ago

it seems to be fixed ! does anyone can test it before I close the issue ?

reno- commented 8 years ago

it works on my machine !!

cheers,

renaud

Le 27 oct. 2015 à 15:42, theod notifications@github.com a écrit :

it seems to be fixed ! does anyone can test it before I close the issue ?

— Reply to this email directly or view it on GitHub https://github.com/jamoma/JamomaMax/issues/933#issuecomment-151523793.

theod commented 8 years ago

thanks Renaud !