summaryrefslogtreecommitdiffstats
path: root/chrome/browser/process_singleton_linux.cc
Commit message (Collapse)AuthorAgeFilesLines
* Fixes a number of issues with ProcessSingletonLinux.willchan@chromium.org2009-05-221-64/+154
| | | | | | | | | | | | | | (1) Use nonblocking sockets. Blocking the IO thread is bad. (2) Handle multiple SocketReaders. (3) Stop leaking file descriptors in SocketReader. Old code used to stop watching the fds, but not close them. (4) Handle partial reads and writes. SocketReader reads until the sender shuts down his side of the socket. (5) Timeout readers after 5 seconds so they don't hang forever. BUG=http://www.crbug.com/12343 TEST=Open a chrome instance. Check /proc/<pid>/fd/ to see how many descriptors there are. Run "chrome www.google.com" on the command line a bunch of times, which should create a bunch of tabs. Make sure you close all these new tabs that pop up.a Check /proc/<pid>/fd/ to see how many descriptors there are. There shouldn't be many more (although some of the new renderers that got created take awhile because they get cleaned up). Keep repeating, you should be at a steady state of file descriptors. Review URL: http://codereview.chromium.org/112054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16811 0039d316-1c4b-4281-b951-d872f2087c98
* Remove trailing NULL is data sent between chrome processes.tc@google.com2009-05-211-5/+4
| | | | | | | | | | | | Since we split on NULL, the final NULL results in an extra command line token passed to the original browser process. Bug found by willchan. Review URL: http://codereview.chromium.org/113714 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16629 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a invalid read found by valgrind in process singleton linux.tc@google.com2009-05-211-7/+26
| | | | | | | | | | | | | We set up a listener on the IO thread, but the listener lived longer than the IO thread. Instead, register a listener to stop listening when the IO thread goes away. We have to register the destruction listener on the thread that we're listening to, so there's an new StartListening method dispatched from ProcessSingleton::Create. Review URL: http://codereview.chromium.org/115605 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16606 0039d316-1c4b-4281-b951-d872f2087c98
* Implement process singleton on linux so if the user tries totc@google.com2009-05-201-13/+264
| | | | | | | | | | | | | | open multiple chrome processes, the first one just opens a new window. This is based on http://codereview.chromium.org/88067 by Nikita Ofitserov (himikof). BUG=8073 Review URL: http://codereview.chromium.org/115572 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16528 0039d316-1c4b-4281-b951-d872f2087c98
* Put test_user_data in a temp directory instead of using base::DIR_EXE. (try 2)thestig@chromium.org2009-05-111-0/+2
| | | | | | | | | base::DIR_EXE could be a very long path, which causes socket creation to fail because socket paths have a limited length. Let's use a temp directory instead. We should also clean up the temp dir when we're done. Also abort if the socket path is too long. Reviewed in issue 115107 Review URL: http://codereview.chromium.org/113193 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15749 0039d316-1c4b-4281-b951-d872f2087c98
* Revert r15607hclam@chromium.org2009-05-081-2/+0
| | | | | | | | r15607 broke the build TBR=brg, thestig git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15608 0039d316-1c4b-4281-b951-d872f2087c98
* Put test_user_data in a temp directory instead of using base::DIR_EXE.thestig@chromium.org2009-05-081-0/+2
| | | | | | | | | base::DIR_EXE could be a very long path, which causes socket creation to fail because socket paths have a limited length. Let's use a temp directory instead. We should also clean up the temp dir when we're done. Also abort if the socket path is too long. Review URL: http://codereview.chromium.org/115107 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15607 0039d316-1c4b-4281-b951-d872f2087c98
* POSIX: Add a macro for handling EINTR.agl@chromium.org2009-05-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On POSIX systems, system calls can be interrupted by signals. In this case, they'll return EINTR, indicating that the system call needs to be restarted. (The situation is a little more complicated than this with SA_RESTART, but you can read man 7 signal if you like.) The short of it is that you need to catch EINTR and restart the call for these system calls: * read, readv, write, writev, ioctl * open() when dealing with a fifo * wait* * Anything socket based (send*, recv*, connect, accept etc) * flock and lock control with fcntl * mq_ functions which can block * futex * sem_wait (and timed wait) * pause, sigsuspend, sigtimedwait, sigwaitinfo * poll, epoll_wait, select and 'p' versions of the same * msgrcv, msgsnd, semop, semtimedop * close (although, on Linux, EINTR won't happen here) * any sleep functions (careful, you need to handle this are restart with different arguments) We've been a little sloppy with this until now. This patch adds a macro for dealing with this and corrects every case of these system calls (that I found). The macro is HANDLE_EINTR in base/eintr_wrapper.h. It's safe to include on Windows and is a no-op there. On POSIX, it uses GCC magic to return the correct type based on the expression and restarts the system call if it throws EINTR. And you can use it like: HANDLE_EINTR(close(fd)); Or: ssize_t bytes_read = HANDLE_EINTR(read(fd, buffer, len)); *BEWARE* that it will evaluate the argument multiple times, so this is not safe: HANDLE_EINTR(close(FireMissiles())); http://groups.google.com/group/chromium-dev/browse_thread/thread/41a35b2a457d73a0 http://codereview.chromium.org/100225 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15102 0039d316-1c4b-4281-b951-d872f2087c98
* More solid detection of browser process in chrome_process_util_linux.cc:phajdan.jr@chromium.org2009-04-211-1/+2
| | | | | | | | | | | | | | | | - use GetAppOutput instead of popen - make unexpected conditions fatal (otherwise the tests using this code would mistakenly assume that there is no running browser process) Also add a constant for SingletonSocket. Make necessary adjustments to GetAppOutput - ignore stderr (because fuser prints the file name to stderr and having stderr in |output| would require more parsing). Review URL: http://codereview.chromium.org/77031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14091 0039d316-1c4b-4281-b951-d872f2087c98
* Implement chrome_proces_util for linux and enable download ui test.estade@chromium.org2009-04-141-1/+1
| | | | | | | | | | To get the PID from the socket, we use lsof (fuser doesn't work with unix sockets apparently). The download shelf, save page, and browser ui tests now pass. Review URL: http://codereview.chromium.org/66071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13716 0039d316-1c4b-4281-b951-d872f2087c98
* Removed zombie hunter codemaruel@chromium.org2009-03-231-6/+0
| | | | | | | | BUG=6468 Review URL: http://codereview.chromium.org/46076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12314 0039d316-1c4b-4281-b951-d872f2087c98
* Add bug links for ProcessSingleton.evan@chromium.org2009-02-251-2/+3
| | | | | | Review URL: http://codereview.chromium.org/28142 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10395 0039d316-1c4b-4281-b951-d872f2087c98
* Implement skeletal ProcessSingleton on Linux to cut down on NOTIMPLEMENTED()s.evan@chromium.org2009-02-181-0/+71
We now will refuse to run a second browser process if one is already running; making the second invocation bring up new windows in the first remains left to be implemented. Review URL: http://codereview.chromium.org/20448 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9980 0039d316-1c4b-4281-b951-d872f2087c98