iChat/iSight and Postgres Memory Bug

Basically, an attempt to initiate a video chat would die with a cryptic—and misleading—message: Disconnected from Video Chat because: Can’t get video from the camera. The problem could only be solved by rebooting the computer.

I’m posting this on a blog entry, not because I think my loyal blog readers are going to be interested by it, but someone out there on the web might run into this issue, and some googling suggests that nobody has reported on it.

There were two strange software failures going on recently, both of them quite troublesome, and it took until today to realize they were directly related.

On the one hand, I noticed that three people (who now work distantly together) were having problems with iChat on their G5 computers. Basically, an attempt to initiate a video chat would die with a cryptic—and misleading—message: Disconnected from Video Chat because: Can’t get video from the camera. The problem could only be solved by rebooting the computer.

There was another strange and inconsistent problem that just started happening, where Dave and I would not be able to start up Postgres due to a memory error: FATAL: could not create shared memory segment: Cannot allocate memory

The Postgres problem would occasionally pop up, and after the error showed up, there would be nothing short of rebooting that would alleviate the problem.

Well, the two problems appear to be related. If you have an iChat video chat, you will be able to run Postgres; and if you run the Postgres database, you will be unable to run iChat. The problem seems to lie with something called shared memory which is a section of memory that the Operating System manages that is able to be accessed by multiple processes.

Operating Systems generally have settings where you can specify the maximum amount of shared memory used, the maximum size of a shared memory segment, etc. In OS X these settings are the in file /etc/rc. Dave seems to have been able to fix the problem by increasing this maximum shared memory to 128 megabytes. (The default is 4!) I’m guessing you can have much less, but we haven’t had the chance to do much testing yet.

One good resource is this page which has a comment on the very bottom by a Mac guy who makes specific recommendations for OS X. (Note, it’s dated 2002, so it’s a little stale.)

If you have any luck or feedback, please provide it in the comments below so others can benefit from your wisdom!

Author: Murray Todd Williams

I live in Austin, Texas. I'm enthusiastic about food, wine, programming (especially Scala), tennis and politics. I've worked for Accenture for over 12 years where I'm a Product Manager for suite of analytical business applications.

16 thoughts on “iChat/iSight and Postgres Memory Bug”

  1. Holy sh*t! I can’t believe that this was the issue. I tried everything to try to get this working. All I had to do was shut down the pg database. Thanks so much for this page, I’ve been waiting months to resolve this problem. I’ll try to post on apple discussion boards too. Any luck with more recent versions of Postgres?

  2. Murray-

    Thanks so much for posting this information! Your solution showed up in a google search. I had scoured the apple discussion boards looking for a fix.

    I shutdown postgres and boom! My iSight camera works like a charm in iChat. I posted a followup on the appropriate discussion on the Apple boards. Thanks!

  3. Been struggling with this one for a while… we thought it was our routers at first.

    Thanks so much for this info!

  4. I encountered this problem about a month ago on my Powerbook, and haven’t been able to find a plausible cause for it until now.

    Hope this will fix things when I get around to trying it.

  5. What a find! This problem affected both my Powerbook G4 and my G5 desktop. I was about to give up after tweaking firewall settings and trying everything else I could think of. Shutting down PostgreSQL worked perfectly.

    I tried to increase my shared memory size, as recommended in one of the articles linked above. Didn’t work for me, even when I increased from 4MB to 128MB. I am using OS X Tiger 10.4.1.

  6. WOAH! I would *never* have thought of that. Thank you thank you thank you thank you 😀 I was just about to take the iSight back to the store, as well 😉 So not only has your insight helped me VChat with my wife and daughter again, but it also saved me a long and unnecessary walk, too 😀
    Cheers,
    C

  7. Does anybody know why? I can’t believe that this is really true!
    But often the things are not as they seem to be in this coloured world…

  8. THANK YOU FOr this…… I would NEVER have put these two together………

    I was GOING BATTY reinstalling ichat and such.

    THANK YOU!!!!!!!!!!

  9. Another thing just for anyone who may not already know it. Apple Remote Desktop also uses Postgres for something (I can’t remember what). For me the solution to this was to stop my sharing of my Desktop over ARD. That killed the Postgres processes and allowed the camera to finally connect. Quite strange that Apple wouldn’t have isolated this problem being that two of their applications could be the ones causing the problem.

  10. Hello,

    I have the same issue. Someone trying to connect from a hotel room to me. (Powerbook to iMac G5, both on 10.4.1). Audio works, video, does initiate and start, but then stops with the message: “Disconnected from Video Chat because: Can’t get video from the camera. ”
    I don’t know what Postgress is, and I don’t understand how to increase shared memory. Can sombody help ?

    Thanks,

    S.

  11. I have the same issue and tried Murray’s solution, which I incleased the shared memory’s max to 128MB. However, the problem can’t sold. I am using Mac OS X Tiger. Is that a problem?

  12. This problem is actually a long running problem with the port Postgres uses, 5432.
    If you change Postgres to use 5431 (or something else that’s free) in your config file this fixes it (the file is /usr/local/pgsql/data/postgresql.conf and you need to be root–search for 5432 in the file).
    Note that you’ll have to stop and restart postgres (or just restart the machine).
    I can’t believe that Apple won’t change their port, since Postgres has been using the same port for years, long before iChat came on the scene.
    One other note–you’ll need to change your code in any apps that reference the port 5432 to reflect the new port. This can be a pain if you’re developing on your machine and then putting it up on another machine for production, because you have to change that reference back to 5432 when you put it on another machine.

  13. Pingback: A Perfect Vacuum

Leave a Reply

Your email address will not be published. Required fields are marked *