Segmentation fault on High Sierra 10.13.1 Beta 2

Issue #210 resolved
Yusuke Terada
created an issue

I installed PyObjC 4.0 into Python 2.7 bundled with macOS by easy_install.

I've installed macOS High Sierra 10.13.1 Beta 2 (17B35a), which was released yesterday. Since then, PyObjC frequently causes Segmentation fault.

For instance, the following code is a minimal reproducible example:

import CoreFoundation 
import Quartz

pdf_path = "/path/to/some.pdf"

url = CoreFoundation.NSURL.fileURLWithPath_(pdf_path)
print str(url)

pdf_doc = Quartz.PDFDocument.alloc().initWithURL_(url)
print str(pdf_doc)

pdf_page = pdf_doc.pageAtIndex_(0)
print str(pdf_page)

page_data = pdf_page.dataRepresentation() # => Segmentation fault
print str(page_data)

I attached the crash log.

Comments (10)

  1. Ronald Oussoren repo owner


    I’m currently traveling without my computer and can therefore not look into this right now. I should be home again by the end of next week.

    One thing I should probably mention in the documentation: I advise against installing pyobjc into the system installation of python unless using a virtualenv. The reason for that is that Apple ships a copy of pyobjc and I don’t know how the two installations would interact.

    Did you upgrade macOS before or after installing PyObjC. If you upgraded afterwards you could try reinstalling PyObjC to check if that helps.

    (currently somewhere north of Kyoto)

  2. Yusuke Terada reporter

    At first, I didn't install PyObjC manually and I used PyOjbC which Apple bundles with macOS. Then I installed High Sierra 10.13.1 Beta 2 on three Macs I have. And then, I faced the crash problem on all of my Macs. So I installed the latest PyObjC 4.0 into one of the Macs using easy_install AFTER installing 10.13.1 Beta 2, but the problem didn't change.

    After that, I installed Python 3.6 and PyObjC 3.0.4 onto High Sierra 10.13.1 Beta 2 independently of the bundled Python2+PyObjC, using MacPorts. But the crash was still unchanged.

    I guess that in High Sierra 10.13.1 Beta 2 there are some bugs or some of API are changed internally. I reported this problem also to Apple.

    (I used to live near Kyoto. There are a lot of historic buildings worth seeing in Kyoto. Enjoy your trip!)

  3. Ronald Oussoren repo owner

    Using python 2.7.13 or 3.6.0 from and pyobjc 4.0 (wheels on PyPI) I don't get a crash. This is on a machine that should be running beta 2:

    $ sw_vers
    ProductName:    Mac OS X
    ProductVersion: 10.13.1
    BuildVersion:   17B35a

    W.r.t. installing: I'd stop using easy_install to install software, the current best practice is pip. This has two advantages: pip supports listing and uninstalling packages, and pip supports wheels (which are the current way to distribute binaries for python packages).

    I'm currently doing a full testsuite run in a VM running 10.13.1 beta 2 and Xcode 9.1 beta 2. That takes some time because it tests 32-bit and 64-bit for a number of python versions and the full testsuite for PyObjC isn't very fast. The results should be available later tonight (CEST).

    After that I'm trying to update the VM to beta 3, for some reason the App Store doesn't show the availability of that beta even though it is available from Sigh.

    (Kyoto was a nice city to visit, I preferred it over Tokyo; I wrote my last mail in Kinosaki Onsen. Arriving in Osaka and later Tokyo after that was quite a shock after spending time in quieter places like that :-) :-). Currently back home near Amsterdam recovering from a jetlag).

  4. Ronald Oussoren repo owner

    The test run finished and passed without problems.

    Could you test using pdf_path = "/usr/share/doc/bash/bash.pdf"? If that works for you as well you may have discovered a new bug in Apple's PDFKit framework.

  5. Yusuke Terada reporter

    Sorry for my late reply.

    I've installed 10.3.1 Beta 3 (Build 17B42a), and then this problem solved naturally. I tested more complicated scripts using PDFKit, but I no longer experienced any crashes. Apple seems to have fixed bridging mechanism's bugs in Beta 3. Sorry for bothering you.

    (It was very discerning of you to choose Kinosaki Onsen. I have also visited there many times before. I believe you enjoyed the little tasteful town where a lot of weeping willows grow along the river.)

  6. Log in to comment