VirtualBox

Changeset 20282 in vbox for trunk/src/libs/xpcom18a4


Ignore:
Timestamp:
Jun 4, 2009 1:21:19 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
48161
Message:

libs/xpcom: fix race for EventQueueService singleton creation, which causes the client to be unresponsive to requests from VBoxSVC, causing lots of trouble. Also a few other minor bugfixes which can lead to crashes.

Location:
trunk/src/libs/xpcom18a4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp

    r18899 r20282  
    525525        IPC_InitModuleReg(argv[0]);
    526526
     527#ifdef VBOX
     528        // Use large backlog, as otherwise local sockets can reject connection
     529        // attempts. Usually harmless, but causes an unnecessary start attempt
     530        // of IPCD (which will terminate straight away), and the next attempt
     531        // usually succeeds. But better avoid unnecessary activities.
     532        if (PR_Listen(listenFD, 128) != PR_SUCCESS) {
     533#else /* !VBOX */
    527534        if (PR_Listen(listenFD, 5) != PR_SUCCESS) {
     535#endif /* !VBOX */
    528536            LOG(("PR_Listen failed [%d]\n", PR_GetError()));
    529537        }
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/uxproces.c

    r1 r20282  
    619619        InsertPidTable(pRec);
    620620    } else {
     621#ifdef VBOX
     622        /* In the context of VirtualBox processes get created (right now
     623         * exclusively via Machine::openRemoteSession) which xpcom doesn't know
     624         * about, and thus would trigger assertions or (even worse) could
     625         * crash VBoxSVC as the code below would notify a NULL condition
     626         * variable. Treat it like a detached process. The proper fix would be
     627         * to port the NSPR to use IPRT, as currently this races with getting
     628         * the exit code, but that's pretty harmless. */
     629        /** @todo fix this properly, by using IPRT for process management */
     630        if (_PR_PID_REAPED == pRec->state) {
     631            DeletePidTable(pRec);
     632            PR_DELETE(pRec);
     633        } else
     634#else /* !VBOX */
    621635        PR_ASSERT(pRec->state != _PR_PID_REAPED);
     636#endif /* !VBOX */
    622637        if (_PR_PID_DETACHED == pRec->state) {
    623638            PR_ASSERT(NULL == pRec->reapedCV);
  • trunk/src/libs/xpcom18a4/xpcom/build/nsXPComInit.cpp

    r11815 r20282  
    6969#include "nsEventQueueService.h"
    7070#include "nsEventQueue.h"
     71#ifdef VBOX
     72# include "nsEventQueueUtils.h"
     73#endif /* VBOX */
    7174
    7275#include "nsIProxyObjectManager.h"
     
    761764    nsIInterfaceInfoManager* iim = XPTI_GetInterfaceInfoManager();
    762765    NS_IF_RELEASE(iim);
     766#ifdef VBOX
     767    // Must initialize the EventQueueService singleton before anyone is
     768    // using it. The notification below creates a thread which races creating
     769    // the EventQueueService creation otherwise, no matter what.
     770    nsCOMPtr<nsIEventQueue> eventQ;
     771    rv = NS_GetMainEventQ(getter_AddRefs(eventQ));
     772    if (NS_FAILED(rv)) {
     773      NS_ERROR("Could not create event queue for main thread");
     774      return rv;
     775    }
     776#endif /* VBOX */
    763777
    764778    // Notify observers of xpcom autoregistration start
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette