• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting Bridge Strange Pauses
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Bridge Strange Pauses


  • Subject: Re: Scripting Bridge Strange Pauses
  • From: John Nairn <email@hidden>
  • Date: Thu, 16 Sep 2010 10:42:25 -0700

I have been having problems calling my Cocoa app with Python scripts through the Scripting Bridge. To test further, I wrote the following Cocoa code to use the Scripting Bridge. For a large file (over 7000 elements in the SBElementArray recs variable) it runs smoothly until 77% completion and then stops. I thought it had crashed, but one time I waited and after a 2 minute pause, it starts up again and runs smoothly to 100% completion.

So what is wrong with the Scripting Bridge in long scripts? I get these pauses in many scripts and thus is not related to the specific calls in the sample script. I test some I thought were crashing again and so far all start up again, but some pause for over 5 minutes.

(code snippet in prior posting)

On Sep 15, 2010, at 11:44 PM, Dave Keck wrote:

Have you profiled the thread that's stopped/paused? What does its stack trace look like?

It is running on main thread. I am not sure how to "profile." I tried "Thread State" in Instruments and it output data, but nothing unusual when the pause occurred. Is that the right tool?



Have you verified that the problem isn't that 'GEDitCOMII' isn't responding?

I did pinpoint exactly what method was being called when a pause occurred (although the specific method varied) and changed those methods to do nothing except return a number such as


- (long)birthSDN { return 10L; }

and it still pauses. It is hard to see how this method could not be responding. Also these pauses never happen when the same methods are called from an AppleScript. They only happen when called from a Python script or a Cocoa app, both through the Scripting Bridge.


Also, if you're not using GC, consider profiling your loop with and without each iteration allocating/releasing an autorelease pool. Adding one could improve performance if objects are being allocated indirectly by your several method calls within the loop.

I tried GC in Instruments, but it said my apps do no qualify? Also, I want the final solution to work in Python scripts and not to only work from other Cocoa apps. I am not sure if an autorelease pool method would work from Python script?


One new result has started as well when running from a Python script. When the long pause is over, some Python variables that were previously defined have changed to "None" and then the script encounters and error. The long pause seems to be corrupting memory as well.

------------
John Nairn
http://www.geditcom.com
Genealogy Software for the Mac

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Scripting Bridge Strange Pauses
      • From: Dave Keck <email@hidden>
References: 
 >Scripting Bridge Strange Pauses (From: John Nairn <email@hidden>)
 >Re: Scripting Bridge Strange Pauses (From: Dave Keck <email@hidden>)

  • Prev by Date: Animated scrolling of NSScrollView
  • Next by Date: Cocoa Borderless Panel causes issues in PowerPlant/Carbon
  • Previous by thread: Re: Scripting Bridge Strange Pauses
  • Next by thread: Re: Scripting Bridge Strange Pauses
  • Index(es):
    • Date
    • Thread