ML Crash when resizing image EOS 650D

Issue #2434 new
Mark Barton created an issue

I save Raw + L and wanted to resize to a smaller jpg to send via eye-fi Mobi Pro selective transfer.

Eye-fi is working when I don't resize the photo. In the Play mode and pressing Q to get the menu to resize to either M or S3 on the Canon T4i/ 650D, I get ML display an assertion error and have to restart the camera.

If I hold down Set during startup to not load ML, the resize function works as expected to create another file.

Comments (75)

  1. Alex

    Most likely, ML allocated some memory from shoot_malloc. Can you check whether this is true? (Debug -> Free Memory)

    As a workaround, you could try loading fewer modules.

  2. Mark Barton reporter

    I just installed ML for the first time yesterday, so I'm still getting used to it. I think I left it at the default install with just turning on Focus Peaking, I will look though the FAQ on how to disable some things that are on by default and see if that helps. Below are the details from the Debug screen.

    Debug -> Free Memory
    128K + 3567K

    Allocated RAM 573kB, peak 701kB
    malloc 128kB, 13kB used
    AllocatedMemory 3.4MB, 559kB used
    shoot_malloc 0 used (but it will occasionally switch to 31MB, 0 used while reading the Debug screen)
    stack space 435kB
    shoot config 30MB
    shoot total 91MB
    SRM job total 1x31MB
    AUTOEXEC.BIN 547kB

  3. Alex

    Hm, so it's not that (since you have 0 used, and enough free memory in other buffers).

    If you simply load ML, and attempt to resize an image without doing anything else, do you get the error?

    If yes, does it help if you disable module loading? (Modules Debug -> Disable all modules)

  4. Mark Barton reporter

    I typed in this long description and when I attached the logs files, Jira threw it away. Anyway the brief description is:
    pulled battery from camera -> took a pic since it was an empty card -> resized -> crashed
    pulled battery from camera -> disabled all modules -> turn off camera -> turn on camera and confirm disabled modules setting -> resized existing pic from last step -> crash with slight different error message

    I always get a message that the resized pic cannot be displayed..do you want to create a new file. At that point I can do nothing until I pull the battery.

    Thanks for the responses. I'm going to go out and take some pictures today.

  5. Mark Barton reporter

    FYI...Just tried with a regular SD 32GB card and got the same results. I did that to rule out the Eye-Fi Mobi Pro card.

  6. Alex

    This smells like memory corruption (which is pretty serious IMO). Since it works when you hold SET, this means the main ML binary is allocated correctly; the issue is probably in one of the user tasks.

    Does it help if you turn off Global Draw and everything else under Prefs -> Image review settings?

    Does it help if you install the oldest build from the nightly page?

  7. Mark Barton reporter

    I did try disabling Global Draw after my last test and that did not make a difference. I will try an older build and try disabling everything.

  8. Mark Barton reporter

    I got the error with the previous build too. It does work when I got back to the magiclantern-Nightly.2015Nov07.650D104.zip build. So I will stick with that build for now as a workaround.

  9. Mark Barton reporter

    It appears to be the build shown below:
    Build Details

    magiclantern-Nightly.2015Nov15.650D104.zip
    Changeset: c295d34
    Downloads: 2431
    
  10. Alex

    So, only the latest build is problematic, but the previous one is not?

    Are you able to compile the source code? If not, I can try a few intermediate builds to narrow down the exact change.

  11. Mark Barton reporter

    The two latest builds for the 650D are problematic. I have been using the Nov 7th build with no errors, other than not being able to find the "focus confirmation" option for Magic Zoom, but that may not be supported on this camera/lens. I'm not able to compile a build currently as I would need to setup a system with a compiler (haven't done that in a few years).

  12. Alex

    For focus confirmation, one has to check whether CONFIG_LV_FOCUS_INFO is working (in internals.h). Looks like 700D also has this disabled, so maybe @Mathew Kelly would want to check it as well.

    Later I'll prepare a few test builds to identify the issue.

  13. Walter Schulz
    • Hackintosh with compiler: Check
    • 650D: Check

    No experience in reversing commits, though. How can I help hunting down the bug?

  14. Licaon Kter

    Clone at specific commit:

    hg clone -r unified https://bitbucket.org/hudson/magic-lantern/ -r c897f3f

    Where c897f3f is now the latest commit, replace it with one you want to test.

  15. Walter Schulz

    Thanks! But I have to revert "compiler checked". The autoexec.bin I compiled using cloned main (unchanged) behaves erratically. Will recompile on another Hackintosh this evening.

  16. Alex

    Hm, pretty strange.

    Can you try another change?

    • uncomment back #define CONFIG_LVAPP_HACK_DEBUGMSG
    • in gui-common.c, comment out #define CONFIG_LVAPP_HACK
    • in gui-common.c, hacked_DebugMsg, delete the contents (so the function would do nothing)

    This would replace DebugMsg with a dummy implementation (that does nothing). The only side effect should be an empty diagnostic log in case of crash.

  17. Walter Schulz

    Sorry, I'm lost. I'm unable to find hacked_DebugMsg but found DebugMsg_hack in src/gui-common.c. Do I have to delete contents between brackets after "static void DebugMsg_hack()"?

  18. Alex

    That's a different one. Look on line 44.

    Yes, delete the contents between brackets, but after "static void hacked_DebugMsg".

  19. Licaon Kter

    Funny thing, EOS-M (unified + GCC PR for 5.2.1 + DNG PR), RAW+L, resize:

    • choose size -> says unknown format (so no preview) -> camera (screen?) freezes
    • no touch reaction
    • using the wheel makes the lens focus ( I guess: it opens up to max, moves a bit and back to min apperture )
    • pressing the power button only stops the wheel reaction, image still on screen
    • battery pull needed.

    I'll try the procedure mentioned by @a1ex later.

    No errors saved on card, I'll try a debug build then.

  20. Walter Schulz

    Crash again.
    Changed lines:

    /** #define CONFIG_LVAPP_HACK */
    
    static void hacked_DebugMsg(int class, int level, char* fmt, ...)
    {
    }
    
    static uint32_t orig_DebugMsg_instr = 0;
    
  21. Alex

    At the end of DebugMsg_hack, can you add this?

    sync_caches();

    so it would look like:

    static void DebugMsg_hack()
    {
        if (!orig_DebugMsg_instr)
        {
            uint32_t d = (uint32_t)&DryosDebugMsg;
            orig_DebugMsg_instr = *(uint32_t*)(d);
            *(uint32_t*)(d) = B_INSTR((uint32_t)&DryosDebugMsg, hacked_DebugMsg);
            sync_caches();
        }
    }
    

    Keep the previous changes.

    If that still won't work, remove the contents of DebugMsg_hack (just to make sure there are no other code leftovers).

  22. Alex

    Hm...

    Let's try something else. Are you able to compile the dm-spy-experiments branch, and enable a diagnostic log?

    static void run_test()
    {
        msleep(2000);
        debug_intercept();
        msleep(60000);
        debug_intercept();
    }
    - you will need a stub: GetTaskName 0x6A38
    

    Then, run 'don't click me', and you have 60 seconds to resize an image and trigger the bug.

    There are two reasons I want this test:

    • DebugMsg is replaced with a custom implementation, in a similar way
    • it will log all Canon debug messages to dm.log on the card

    From previous tests, it looks like replacing DebugMsg with a custom implementation might actually do something useful (besides logging debug messages).

  23. Walter Schulz

    Unable to compile.

    /bin/sh: truncate: command not found

    make: *** [../../src/menuindexentries.h] Error 127

  24. Alex

    Try merging with the unified branch: hg merge unified. Ignore conflicts, since none of them affects 650D.

  25. Walter Schulz

    I have no idea what I'm doing here and "hg merge unified" won't run. And for me it's about time to go to bed.

  26. Alex

    It runs here, but has merge conflicts, which you can ignore.

    Alterntive: install truncate (without merging anything).

  27. Walter Schulz

    Error message was about "Repository not found". Can you compile this stuff and give me a download link?

  28. Licaon Kter

    Get dm-spy: hg clone -r dm-spy-experiments https://bitbucket.org/hudson/magic-lantern my-magic-lantern-debug

    Switch to it: cd my-magic-lantern-debug

    Pull latest commit: hg pull -r 32abe65 (lastest commit is 32abe65)

    Merge it: hg merge -r 32abe65 1 merge conflict, choose at random :) (BTW, hg merge unified errors out with merging with a working directory ancestor has no effect)

    Put CONFIG_DEBUG_INTERCEPT=y in Makefile.user

    In debug.c, run_test, put those. Although, not sure what this: - you will need a stub: GetTaskName 0x6A38 is !? Ignored it.

    Build... put on card...

    Start EOS-M, ML menu, Don't click me, message on screen, resize, freeze, solid orange led (or no led at all), wait a bit, pull battery... no dm.log on card, what's next?

    /LE: Without resize freeze dm.log is created.

  29. Alex

    Hm, if it's freezing, I'm not sure what you can do. But this hints - again - that replacing DebugMsg might be the problem.

    To confirm, in dm-spy.c, delete the contents of my_DebugMsg and the calls to dm_spy_extra_install/uninstall. You will get an empty log, and I expect it to crash.

    Merging is not required - it was only because Walter did not have truncate. Looks like you cloned just that branch, not the entire repo. Nevermind.

    That stub is only for 650D (won't compile without it).

  30. Walter Schulz

    Sorry, still lost.
    Tried to install truncate (brew install coreutils) but error persists. hg does not work (error messages available, if needed). Again: I have no idea what I'm doing here (noob with hg) and need either a detailed list of steps to proceed or a download file containing compiled stuff for 650D.

    EDIT: Truncate is running but other errors now with tasks.o and tasks.c. Using "make clean && make zip".
    EDITEDIT: Need help with

    - you will need a stub: GetTaskName 0x6A38
    

    Where?

  31. Mark Barton reporter

    FYI...I tried the Feb 28th 2016 build and got the same error. I went back to the Nov 7th 2015 build so I can use Magic Lantern with the Canon T4i.

  32. Mark Barton reporter

    FYI...I tried the latest build:
    magiclantern-Nightly.2016Apr01.650D104.zip
    Built on: 2016-03-31 17:54:31 -0700
    Changeset: 7d67bc6

    The problem is still there.

  33. Mathew Kelly

    I don't know if the thread is still under investigation, but I can confirm on 700D that it crashes while resizing image only after cleaner-lvapp-hack was added, if I undo those changes, no crash.

  34. nikfreak

    if so then undefine UNAVI_FEEDBACK_TIMER_ACTIVE in consts.h and recompile. Does it solve your issue?

  35. Mathew Kelly

    if I just change #define CONFIG_LVAPP_HACK_FBUFF back in Internals and add back the define for it in gui_common and then the code for it

    #ifdef CONFIG_LVAPP_HACK_FBUFF
                if (!canon_gui_front_buffer_disabled() && UNAVI_FEEDBACK_TIMER_ACTIVE)
                {
                    clrscr();
                    canon_gui_disable_front_buffer();
                    bottom_bar_dirty=0;
                }
    
                if (canon_gui_front_buffer_disabled() && !UNAVI_FEEDBACK_TIMER_ACTIVE)
                {
                    canon_gui_enable_front_buffer(0);
                }
                #else
    

    Then no more crash, I dont have to change any other changes in that changeset.

  36. nikfreak

    So either UNAVI_FEEDBACK_TIMER or JUDGE_BOTTOM_INFO_DISP_TIMER_STATE is causing it. I would revert your changes and uncomment the lines involved to see which one causes it.

  37. Alex

    @Mathew Kelly : can you try the code changes from here and see if you get the same results as Walter?

    To me, it looks like there might be a problem when overriding DebugMsg (not what we actually do from there), so I wanted to try a different method for doing that (the one from dm-spy-experiments).

  38. Mathew Kelly

    The only way it works is if I do above, using LVAPP_HACK_FBUFF, I dont have to switch back anything in CONST, getting rid of LVAPP_HACK_DEBUGMSG is not enough, has to have LVAPP_HACK_FBUFF enabled and its fucntion back, which also remove #ifdef UNAVI_FEEDBACK_TIMER_ACTIVE to add back its fucntion as well

  39. Mathew Kelly

    Well, I decided to start fresh, get a clean pull and update to unified again, formatted card cause of all crashes was worried maybe corruption, but anyways, now I dont have to do anything but comment out LVAPP_HACK_DEBUGMSG in Internals

  40. Mathew Kelly

    Ok, I went through that in gui_common.c and tracked it down to INIT_FUNC("debugmsg-hack", DebugMsg_hack);
    If I just comment that out, it works

  41. Mathew Kelly

    If I uncomment that line again and comment out these, it works of course.

           // uint32_t d = (uint32_t)&DryosDebugMsg;
           // orig_DebugMsg_instr = *(uint32_t*)(d);
           // *(uint32_t*)(d) = B_INSTR((uint32_t)&DryosDebugMsg, hacked_DebugMsg);
    
  42. Mathew Kelly

    Well, it all works, I see it says logging debugmsg.... I can go to resize 1 time, if i go back it freezes cam, if I do it one time and leave, and wait, all is fine, was thinking it was going to leave a log file though, there is none created.

  43. Mathew Kelly

    seems to crash not going back just twice, just within 20seconds from when i press dont click me

  44. Mathew Kelly

    20160426_172108.jpg
    I can do video, but when I click the resize button and go to choose size, it freezes right at that point, cant do anything but turn cam off and pull battery. On screen it says hsuite error, and crash logs are same as in first post, pacmem.c if you need exact, I can go do video for you?

  45. Mathew Kelly

    Quickzoom works fine and all the other options, exposure adjust doesnt work, it just goes to next image unless im not using it correctly, never had any reason to play with those features.

  46. Licaon Kter

    On EOS-M, using @Mathew Kelly build, as soon as I move the selector (with arrows) from OFF to M:

    ASSERT: ���
    at :577, task RscMgr
    lv:0 mode:1
    
    
    Magic Lantern version : Nightly.2016Apr26.EOSM202
    Mercurial changeset   : 66fca48e55cd+503e2578deef+ (unified) tip
    Built on 2016-04-27 03:48:34 UTC by mathew@mathewubuntu64.
    Free Memory  : 186K + 3464K
    
  47. Mathew Kelly

    Well thats a bummer, I just built your version from unified and merged in dmspy like I was told than built it and had no errors once alex solved the build issue, but wait, maybe the stub? I should of checked if it was there already, but figured was ok since it compiled, I will check and do another copy when I get to pc hopefully soon. And make another copy if needed. But will it even help solve this issue since alex already read the dm log from mine and found nothing weird?

  48. Log in to comment