8 Replies Latest reply on Jul 25, 2013 7:19 PM by areohbee

    Hangs sometime when rendering on export

    ckhorne

      I hope someone can help me. My plugin implements both export and publish service services. It's being used by tens of thousands of users, and the vast majority don't have any problems.

       

      However, once in about every 1000 images that are exported, Lightroom seems to hang indefinitely during the actual render process:

       

      exportContext:startRendering()

       

      The CPU hits 100% and will run indefinitely until you kill the task (from the main progress bar). This happens, at about the same frequency, on both LR 4 and LR 5, and both Windows and Mac machines. It seemed to start around LR 4.0, but I'm not sure about that.

       

      a) Does anyone know why this might happen? Usually it'll happen again with the same image the process is killed and started again. Sometimes the same image will work fine again.

      b) If I can't find a fix, I'd like to find a way to alert the user and kill my process. I'm already running a background process/thread that serves as a network watchdog, and I've confirmed that it keeps running when there's a problem, so I have a way that I can detect and do something. The problem is... I'm not sure how to kill an export (/publish) in process programmatically. I looked into trying to affect the exportContext or functionContext somehow, causing it to error out, but I can't find a way to do that either.

       

      It happens only rarely, which makes it much harder to track down and reproduce.

       

      Any suggestions?

        • 1. Re: Hangs sometime when rendering on export
          ckhorne Level 1

          Hmm... no answers after a week.... Lets try a different question-

           

          Does anyone know how to kill an export process that's in progress? Specifically, the export service's processRenderedPhotos() is running and I can detect that it's hanging up forever. Any ideas on how I can force it to end / error out?

          • 2. Re: Hangs sometime when rendering on export
            areohbee Level 5

            When you say "hangs" do you mean "never returns from Lr method"?

             

            If so, then I wouldn't know how to get out of it (you could detect it, and notify users of problem by having a "watch dog" timer).

             

            But in general, this code will allow users to cancel via the progress scope:

             

            (you have to create a progress scope - myScope)

             

            watchDog:start() -- spin a separate thread to check for watch-dog timer expiration.

             

            for i, rendition in exportSession:renditions{ progressScope = myScope, stopIfCanceled = true } do -- starts rendering automatically on a separate thread.

             

                 local status, pathOrMessage = rendition:waitForRender()

             

                 watchDog:stroke() -- reset timer.

             

            end

             

            watchDog:stop() -- kill task...

             

            Rob

            • 3. Re: Hangs sometime when rendering on export
              ckhorne Level 1

              Correct - "hang" means the rendition:waitForRender() method call never returns. I can add a debug message directly before and directly after it, and it'll never finish. In fact, this is what I've got:

               

                   log("Rendering...");

                   local success, pathOrMessage = rendition:waitForRender()

                   log("Done rendering");

               

              In my log, I see "Rendering..." but never anything after that. The CPU goes to 100% for 5+ minutes, until I kill the process manually. I've only seen this a handful of times, and I've had reports from my users, but can't track down any kind of consistency.

               

              I have a separate watchdog process anyway that I could use to do what you've suggested (end a loop), but I can't figure out how to kill a process or functionContext once started.

              • 4. Re: Hangs sometime when rendering on export
                areohbee Level 5

                OK. I can only imagine it's a bug in Lr. If you've got a watch-dog process to at least inform the user, that's the best you can do I think - no way I know of to yank the rug out...

                 

                Nothing unusual about the problem cases?

                 

                Sorry I've not been more help.

                 

                Rob

                • 5. Re: Hangs sometime when rendering on export
                  ckhorne Level 1

                  I was afraid it may be a Lr bug. A popup when the condition is detected is a good idea, even if I can't do anything about it....

                   

                  If nothing else, at least you've helped confirm that it's not something obvious that I should be checking. Thanks for the insight.

                   

                  If anyone else has any ideas - please post here!

                   

                  -chris

                  • 6. Re: Hangs sometime when rendering on export
                    areohbee Level 5

                    ckhorne wrote:

                     

                    I was afraid it may be a Lr bug.

                    I think so. Still, it may be due to something you could find and fix. Or, not...

                     

                    e.g. it could be that if you force an export filter into the preset it won't happen (I just picked that out of thin air).

                     

                    Ya know - something different enough to cause something different to happen during init or whatever.

                     

                    I have NOT seen the same symptom on any ongoing basis - consider posting export settings being used and/or try with different ones..

                     

                    Also worth noting: I have seen things not happen that should when Lr is in a mood (e.g. auto-tone settings not settling in) - e.g. has consumed too much memory or whatever. - not sure what you can do with that info, but there it is...

                     

                    Rob

                    1 person found this helpful
                    • 7. Re: Hangs sometime when rendering on export
                      ckhorne Level 1

                      Dumping all the export settings right before export isn't a bad idea. I guess I'll work on trying to establish a pattern and if I can find one, reporting it as a bug.

                       

                      No function should spike CPU to 100% and never return, even if I am feeding it bad data somewhere along the way...

                      • 8. Re: Hangs sometime when rendering on export
                        areohbee Level 5

                        ckhorne wrote:

                         

                        No function should spike CPU to 100% and never return, even if I am feeding it bad data somewhere along the way...

                        Agreed. - if you could find a pattern and report, that would be great...

                         

                        Good luck (and I'll keep an eye out..).

                        Rob