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!
Posted by Murray Todd Williams at December 9, 2004 07:06 PMHoly 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?
Posted by: Jesse Costello-Good at January 3, 2005 02:39 PMOr is it a port issue?
http://www.entropy.ch/phpbb2/viewtopic.php?t=1564
But I changed the port to 5433 and that didn't help.
Posted by: Jesse Costello-Good at January 3, 2005 09:02 PMMurray-
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!
Posted by: Eric at January 29, 2005 06:12 AMBeen struggling with this one for a while... we thought it was our routers at first.
Thanks so much for this info!
Posted by: Ed at March 19, 2005 12:44 PMI 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.
Posted by: Audun Rundberg at May 8, 2005 01:14 PMWhat 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.
Posted by: Kurt at May 19, 2005 10:33 AMWOAH! I would *never* have thought of that. Thank you thank you thank you thank you :D 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 :D
Cheers,
C
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...
THANK YOU FOr this...... I would NEVER have put these two together.........
I was GOING BATTY reinstalling ichat and such.
THANK YOU!!!!!!!!!!
Posted by: Joe Fleck at June 18, 2005 10:15 AMAnother 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.
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.
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?
Strange! killed the postmaster and sure enough it worked. Thanks for the heads-up. I had to increase shared memory to even get postgres running initially, as noted here: http://www.entropy.ch/phpbb2/viewtopic.php?p=2783#2783
Posted by: Brett at August 5, 2005 07:52 PMI found Lotus Notes 6.5 on my powerbook causes the same error. Very strange.
Posted by: Ryan at August 9, 2005 05:06 PMThis 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.