×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    19

    Getting panic from position server (Application closed: PosServer: EUser32:CBase 42)

    Hi, i have an active object in ma application which is scheduled to run after every 8 minutes and retrieve the location by creating session and sub-session with position server, after location retrieval it closes the both of the sessions with position server and again scheduled to run after 8 minutes and this happens again and again after every 8 minutes, what is happening when ma application is running on ma phone (Nokia Xpress music 5800, i am using S60 5th Edition SDK) the a panic dialog is shown with this error message (i.e. Application closed: PosServer:EUser32:CBase 42). My application still keeps on running it never exit, when i checked the log then i saw that before the panic appears this error was logged after a request fto position server for position, error is: -15, Client/server send/receive operation cannot run, because the server has terminated. that is KErrServerTerminated. I am posting the code below tell me what i am doing wrong, or suggest me some guidelines in order to prevent such panics.

    Code:
    PositionScheduler.h
    
    /**
     *  CPositionScheduler
     * 
     */
    class CPositionScheduler : public CActive
    	{
    	
    public:
    	
    	~CPositionScheduler();
    	static CPositionScheduler* NewL();
    	
    	void StartPosSchedulerL();
    	TInt GetError();
    	
    protected:
    	
    	void DoCancel();
    	void RunL();
    	TInt RunError(TInt aError);
    	
    private:
    	
    	void StartTimer();
    	
    	void StartPositioner();
    	void RetrievePositionL(TInt aStatus);
    	CPositionScheduler();
    	
    	void ConstructL();
    	
    private:
    	
    	RTimer iTimer;
    	
    	RPositionServer iPositionServer;
    	TPositionUpdateOptions iPosUpdateOpts;
    	
    	RPositioner iPositioner;
    	
    	TPositionInfoBase* iPosInfoBase;
    	
    	TPositionInfo iPositionInfo;
    	TInt iIntervalInSeconds;
    	
    	TBool isTimerRequested;
    	
    	TInt iError;
    	};
    Code:
    PositionScheduler.cpp
    
    CPositionScheduler::CPositionScheduler() : CActive(EPriorityStandard),
    										   isTimerRequested(EFalse) // Standard priority
    	{
    	}
    
    CPositionScheduler::~CPositionScheduler()
    	{
    	Cancel();
    	iTimer.Close();
    	iPositioner.Close();
    	iPositionServer.Close();
    	}
    
    CPositionScheduler* CPositionScheduler::NewL()
    	{	
    	CPositionScheduler* self = new (ELeave) CPositionScheduler();
    	CleanupStack::PushL(self);
    	self->ConstructL(); // Need to call CTimer::ConstructL()
    	CleanupStack::Pop(self);
    	return self;
    	}
    
    void CPositionScheduler::ConstructL()
    	{
    	// add this AO to active scheduler
    	CActiveScheduler::Add(this);
    	}
    
    void CPositionScheduler::StartPosSchedulerL()
    	{
    	iError = KErrNone;
    	
    	// create the timer
    	User::LeaveIfError(iTimer.CreateLocal());
    	
    	iPosUpdateOpts.SetUpdateInterval(TTimeIntervalMicroSeconds(0));
    	
    	iPosUpdateOpts.SetUpdateTimeOut(TTimeIntervalMicroSeconds(30000000));
    	
    	iPosUpdateOpts.SetMaxUpdateAge(TTimeIntervalMicroSeconds(0));
    	
    	iPosUpdateOpts.SetAcceptPartialUpdates(EFalse);
    	
    	StartTimer();
    	}
    
    TInt CPositionScheduler::GetError()
    	{
    	return iError;
    	}
    
    void CPositionScheduler::DoCancel()
    	{
    	if(isTimerRequested && IsActive())
    		{
    		iTimer.Cancel();
    		}
    	
    	if(!isTimerRequested && IsActive())
    		{
    		iPositioner.CancelRequest(EPositionerNotifyPositionUpdate);
    		}
    	}
    
    void CPositionScheduler::RunL()
    	{
    	if(!isTimerRequested)
    		{
    		// get the location
    		TRAPD(leaveCode, RetrievePositionL(iStatus.Int()));
    		if(leaveCode != KErrNone)
    			{
    			CLogFile::Instance().Log(_L("CPositionScheduler::RunL(): An error occured while retrieveing positoion"), leaveCode);
    			}
    		
    		// close the positioner and position server 
    		iPositioner.Close();
    		iPositionServer.Close();
    		
    		// start the timer again
    		StartTimer();
    		}
    	else
    		{
    		// timer expired so start the position aqusition
    		StartPositioner();
    		}
    	}
    
    TInt CPositionScheduler::RunError(TInt aError)
    	{
    	iError = aError;
    	
    
    	return KErrNone;
    	}
    
    void CPositionScheduler::StartTimer()
    	{
                    TInt64 tempInterval;
    		iIntervalInSeconds = 8 * 60; // 8 minutes interval
    		tempInterval = iIntervalInSeconds * KSecond; // KSecond = 1000000	
    	
    	// start timer
    	Cancel();	
    	TTimeIntervalMicroSeconds32 microSeconds(tempInterval);
    	iTimer.After(iStatus, microSeconds);
    	SetActive();
    	
    	// set this flag to true
    	isTimerRequested = ETrue;
    	}
    
    void CPositionScheduler::StartPositioner()
    	{
    	TInt error;
    	
    	// Connect to the position server
    	error = iPositionServer.Connect();
    	if(error != KErrNone)
    		{
    		// it means there is an error so log the error
    		CLogFile::Instance().Log(_L("LocScheduler::ConstructL():An error occured while connecting to position server"), error);
    		StartTimer();
    		return;
    		}
    	
    	// open the session with position server
    	error = iPositioner.Open(iPositionServer);
    	if (error != KErrNone)
    		{
    		// It means an error occured while opening positioner
    		// close the connection with position server and log the error
    		iPositionServer.Close();
    		CLogFile::Instance().Log(_L("LocScheduler::ConstructL():An error occured while opening positioner"), error);
    		StartTimer();
    		return;
    		}
    	
    	// Set position requestor
    	error = iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication , KRequestor);
    	if (error != KErrNone)
    		{
    		// it means an error occured while setting requestor
    		// close the positioner and connection with position server
    		// and log the error
    		iPositioner.Close();
    		iPositionServer.Close();
    		CLogFile::Instance().Log(_L("LocScheduler::ConstructL():An error occured while setting requestor"), error);
    		StartTimer();
    		return;
    		}
    	
    	// Set update options
    	error =  iPositioner.SetUpdateOptions(iPosUpdateOpts);
    	if (error != KErrNone)
    		{
    		// It means an error occured while setting update
    		// options close positioner and connection with server
    		// and log the error
    		iPositioner.Close();
    		iPositionServer.Close();
    		CLogFile::Instance().Log(_L("LocScheduler::ConstructL():An error occured while setting update options"), error);
    		StartTimer();
    		return;
    		}
    	
    	// make the asynchronous request for position
    	// Get position. The processing of the result
    	// is done in RunL method
    	Cancel();
    	iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus);
    	SetActive();
    
    	// set the isTimerRequested flag to false
    	isTimerRequested = EFalse;
    	}
    
    void CPositionScheduler::RetrievePositionL(TInt aStatus)
    	{
    	// switch the status to check the completion of asynch position request
    	switch (aStatus)
    		{
    		// The fix is valid
    		case KErrNone:
    			{
    			
                           // retrieve the location and save it to a file
    			break;
    			}
    		// The fix has only partially valid information.
    		// It is guaranteed to only have a valid timestamp
    		case KPositionPartialUpdate:
    			{
    			// log this and make request again
    			CLogFile::Instance().Log(_L("PosScheduler::RetrievePositionL():Got partial position update"), aStatus);
    			break;
    			}
    		// The position data could not be delivered
    		case KPositionQualityLoss:
    			{
    			// log this and make request again
    			CLogFile::Instance().Log(_L("PosScheduler::RetrievePositionL():Lost position quality"), aStatus);
    			break;
    			}
    		// Access is denied
    		case KErrAccessDenied:
    			{
    			// log this and request again
    			CLogFile::Instance().Log(_L("PosScheduler::RetrievePositionL():Access Denied while getting location"), aStatus);
    			break;
    			}
    		// Request timed out
    		case KErrTimedOut:
    			{
    			// log this and request again
    			CLogFile::Instance().Log(_L("PosScheduler::RetrievePositionL():Request timed out while getting location"), aStatus);
    			break;
    			}
    		// The request was canceled
    		case KErrCancel:
    			{
    			// log this and request agian
    			CLogFile::Instance().Log(_L("PosScheduler::RetrievePositionL():Request was cancelled while getting location"), aStatus);
    			break;
    			}
    		// There is no last known position
    		case KErrUnknown:
    			{
    			// log this and request again
    			CLogFile::Instance().Log(_L("PosScheduler::RetrievePositionL():An unknown error occured while getting location"), aStatus);
    			break;
    			}
    		// Unrecoverable errors.
    		default:
    			{
    			// log this and request again
    			CLogFile::Instance().Log(_L("PosScheduler::RetrievePositionL():Unrecoverable errors occured while getting location"), aStatus);
    			break;
    			}
    		}
    	}
    This is the code which is used to start the position scheduler in void DoStartL() of application

    Code:
         // Create active scheduler (to run active objects)
        CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
        CleanupStack::PushL(scheduler);
        CActiveScheduler::Install(scheduler);
    
    	// create the location scheduler
    	CPositionScheduler* positionScheduler = CPositionScheduler::NewL();
    	CleanupStack::PushL(positionScheduler);
    	TRAP(err, positionScheduler->StartPosSchedulerL());
    	if(err != KErrNone)
    		{
    		CLogFile::Instance().Log(_L("DoStartL(): An error occured while starting the location Scheduler"), err);
    		}
    
    	// start active scheduler
    	CActiveScheduler::Start();
    
    	// delete location scheduler
    	CleanupStack::PopAndDestroy(positionScheduler);
    	
    	// Delete active scheduler
    	CleanupStack::PopAndDestroy(scheduler);
    Please help i am not getting what is going wrong, becuase i checked the panic, its description says that it occurs whenever u try to set SetActive() when there is already a request is outstanding, i am not getting what i am doing wrong due to which this panic is occuring. waiting for your reply regards Noman Afzal.

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: Getting panic from position server (Application closed: PosServer: EUser32:CBase

    Do re-check your active objects and just make sure you are having only one active request active in each one at any given time. The panic is caused by calling SetActive() when you already have an active request pending.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: Getting panic from position server (Application closed: PosServer: EUser32:CBase

    Do you get the issue on the first attempt (8 minutes) already?

  4. #4
    Registered User
    Join Date
    Mar 2010
    Posts
    19

    Re: Getting panic from position server (Application closed: PosServer: EUser32:CBase

    This is the most amazing thing i found, i never got it at first attempt, whenever a request is complete whether its timer or position acquisition, i log this to log file and i am amazed that this application kept on running and when panic occured it was still running i confirmed that application is still running because when i tried to uninstall it it never because i got message (i.e. cannot install application close applications first), what i found from the log was : for first two or three attempts it was KErrTimedOut, than 2 times it reported the location, which was logged into log file too, then when panic occured it logged KErrServerTerminted, then again its started giving KErrTimedOut, it means ma application did not stoped it was PositionServer which was terminated, from ma code i think its not possible that a new request can be made before cancelling any outstanding request, so i don't know is there any possibility due to which position server was terminated that's amazing becuase panic was raised by position server application not mine. From the log file i saw i never got this panic at first attempt because it made several attempts to acquire position fix and for timer before the panic occured. any pointers now? if u say then i can do is post the logging messages from log file, after receiving panic message application is still running on ma phone and logging its progress into log file.

    this is log file output:

    Position Fix:

    74.3814

    31.5304

    Position Fix:

    74.3808

    31.5308

    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out

    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out

    PosScheduler::RetrievePositionL():An unknown error occured while getting location, ErrorNumber: -15
    Client/server send/receive operation cannot run, because the server has terminated.

    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out

    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out

    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out

    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out

    Position Fix:

    74.3811

    31.5305

    Position Fix:

    74.3808

    31.5306

    Position Fix:

    74.3808

    31.5305

    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out



    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out


    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out


    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out



    PosScheduler::RetrievePositionL():Request timed out while getting location, ErrorNumber: -33
    Timed out


    /**********************************************************************************************************************/

    Its clear from the log output that application never failed, its running constantly. Maybe, from code and log output anyone of you can figure out some problem in ma code or approach. regards Noman Afzal.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: Getting panic from position server (Application closed: PosServer: EUser32:CBase

    The Position Server can not be modified (fixed?) for obvious reasons, but it may matter if your code would connect/open the two RPosXy variables a single time (preferably in the ConstructL), and would not stress the server with this close-reopen approach.

  6. #6
    Registered User
    Join Date
    Mar 2010
    Posts
    19

    Re: Getting panic from position server (Application closed: PosServer: EUser32:CBase

    thanx wizard_hu for ur kind reply, sorry for late reply actually i got ill so i am replying so lately, i have another problem i remember i saw it written somewhere whether it was an article or forum.nokia.com thread that keeping the RPositionServer and RPositioner open when u don't need any position fix drains the battery because gps hardware does not stop running untill u close both of the session, plz tell me what to do if i donot close the both session then there will be a lot of attery usage and application will have no practical usage. Can u tell me someway if u know that we keep both the sessions open and still battery usage by gps hardware can be stoped or anyother trick. waiting for you reply. regards Noman Afzal

Similar Threads

  1. Application Closed: PosServer KERN-EXEC 3
    By amit.mangal in forum Symbian
    Replies: 3
    Last Post: 2009-10-21, 07:33
  2. CActive panic(CBase -42)
    By pornima in forum Symbian
    Replies: 3
    Last Post: 2009-08-10, 14:16
  3. Panic E32USER-CBase 42 / RecvFrom
    By Cartouche67 in forum Symbian Networking & Messaging (Closed)
    Replies: 11
    Last Post: 2009-05-05, 12:45
  4. WLanSnifferServer EUSER32-CBASE 71
    By agagganapally in forum Symbian
    Replies: 2
    Last Post: 2008-01-10, 09:54
  5. Replies: 0
    Last Post: 2007-05-24, 21:49

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •