locked
Problem with QueueUpdateProject (PSI) RRS feed

  • Question

  • Hi,

    I have a problem with the QueueUpdateProject method. When trying to update a project I get the following error:

    Unhandled Communication Fault occurred

    The stack trace:

    Server stack trace:

       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)

       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

     

    Exception rethrown at [0]:

       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

       at EPM.SvcProject.Project.QueueUpdateProject(Guid jobUid, Guid sessionUid, ProjectDataSet dataset, Boolean validateOnly)

       at EPM.SvcProject.ProjectClient.QueueUpdateProject(Guid jobUid, Guid sessionUid, ProjectDataSet dataset, Boolean validateOnly)

       at EPM.Connection.PSIHandler.UpdateProject(Project proj, DateTime sync, Guid sessionId)

    I can't find anything related to this. Sometimes, just before using the QueueUpdateProject I use the QueueAddToProject method with no problem. In addition, the server I'm using was a test server (before it was promoted to production) and everything worked fine.

    I checked the ULS log and this is the only error I found (I'm not sure it is related) at a close time to the error I got:

    Leaving Monitored Scope (ExecuteWcfServerOperation). Execution Time=4.05414654655829

    Detected use of SPRequest for previously closed SPWeb object.  Please close SPWeb objects when you are done with all objects obtained from them, but not before.  Stack trace:    at Microsoft.SharePoint.SPWeb.get_CurrentUser()     at Microsoft.Office.Project.PWA.PJContext.get_RegionalSettings()     at Microsoft.Office.Project.PWA.PJContext.get_LocaleCulture()     at Microsoft.Office.Project.PWA.WCFContext.AuthenticateUser(Message message, WCFContext& wcfContext, String userName, Boolean isWindowsUser)     at Microsoft.Office.Project.PWA.WCFContext.GetContext(Message message, String userName, Boolean isWindowsUser, Boolean newCookie, Uri originalTargetUri)     at Microsoft.Office.Project.Server.ProjectServerRouter.Microsoft.Office.Project.Server.IProjectServerRouter.ProcessMessage(Message message)     at SyncInvokeProcessMessage(Object , Object[] , Object[] )     at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)     at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)     at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)     at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)     at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)     at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)     at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)     at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)     at System.ServiceModel.Diagnostics.Utility.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)     at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)     at System.ServiceModel.Channels.InputQueue`1.AsyncQueueReader.Set(Item item)     at System.ServiceModel.Channels.InputQueue`1.EnqueueAndDispatch(Item item, Boolean canDispatchOnThisThread)     at System.ServiceModel.Channels.InputQueue`1.EnqueueAndDispatch(T item, ItemDequeuedCallback dequeuedCallback, Boolean canDispatchOnThisThread)     at System.ServiceModel.Channels.InputQueueChannel`1.EnqueueAndDispatch(TDisposable item, ItemDequeuedCallback dequeuedCallback, Boolean canDispatchOnThisThread)     at System.ServiceModel.Channels.SingletonChannelAcceptor`3.Enqueue(QueueItemType item, ItemDequeuedCallback dequeuedCallback, Boolean canDispatchOnThisThread)     at System.ServiceModel.Channels.SingletonChannelAcceptor`3.Enqueue(QueueItemType item, ItemDequeuedCallback dequeuedCallback)     at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, ItemDequeuedCallback callback)     at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)     at System.ServiceModel.PartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state)     at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2()     at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke()     at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks()     at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state)     at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)     at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)     at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) 

    Any Ideas?

    Thanks,

    ID


    Id
    Monday, March 7, 2011 9:52 PM

Answers

  • I encountered this error again with a new feature I was developing in the same environment.  The following stopped the error from occurring for me.

    It seems that I get this error mostly when working with large projects.  Rather than sending the whole project data set back, by only sending the changes, the QueueUpdateProject call is executed without issue.

    dsProject = (ProjectDataSet)dsProject.GetChanges();


    This is a very generic error message.  So I'm not sure how many cases of this error the suggestion will help.

    • Edited by Sean Panter Tuesday, August 9, 2011 10:28 PM
    • Marked as answer by I D Tuesday, October 4, 2011 7:26 AM
    Thursday, July 21, 2011 5:08 PM

All replies

  • Can you add a code snippet to give some insight in what you're doing?
    Regards, J
    Tuesday, March 8, 2011 7:57 AM
  •  // add to the project using the current sessionID
    if (proj.NewProjectDs.HasChanges())
    {
      projectClient.QueueAddToProject(jobId, sessionId, proj.NewProjectDs, false);
      WaitForQueue(jobId);
    }

    if (proj.DeletedTasks.Count()>0)
    {
      projectClient.QueueDeleteFromProject(jobId, sessionId,proj.ID,proj.DeletedTasks.ToArray<Guid>());
      WaitForQueue(jobId);
    }
                 
    // Update existing data using the current sessionID
    jobId = Guid.NewGuid();
    projectClient.QueueUpdateProject(jobId, sessionId, proj.ProjectDS, false);
    WaitForQueue(jobId);

    proj.NewProjectDs and proj.ProjectDS are the typed datasets I'm using to add and update the tasks. SessionId is a guid I'm generating when I start working with a specific project.

    Thanks,

    ID

    • Edited by I D Tuesday, March 8, 2011 4:52 PM formating
    Tuesday, March 8, 2011 4:47 PM
  • I appreciate they are just snippets ID, but the PSI is epxecting to make changes based on the dataset, and potentially you are making additions, deletions and then updates all in the same session?  I wouldn't expect this to work - but it could be I am reading your flow incorrectly.  I think you would need to break this down a little and treat each part in isolation and in its own session and see if that work better for you.  You say it was working fine though - so either you are now seeing different code paths get exercised or something changed.

    Best regards,

    Brian.


    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Friday, March 11, 2011 11:52 PM
  • Brain,

    It seems quite logical to me to do these three operations all on the same session. Anyhow the problem occurs even if I call only the QueueUpdateProject function.

    Apparently, I found out it happends only on some of the projects and not others. I can't really say why and unfortunately the error I recieve is to general to do something with it.

     

    ID


    Id
    • Edited by I D Monday, March 14, 2011 11:49 AM Additional data
    Saturday, March 12, 2011 8:20 AM
  • I am experiencing the exact same set of exceptions.  It only seems to affect specific projects.  I haven't been able to identify a pattern though. 

    We are creating projects using the PSI and custom project templates that have been published to project server. 

    Did you eventually find the source of your issue?

    Much Thanks,

    Sean

    Wednesday, May 4, 2011 2:27 PM
  • Unfortunately I didn't find it. I managed to narrow it down to something to do with task properties. I thought of a workaround, reading the tasks I need, delete them and re-add them.

    ID


    Id
    Wednesday, May 11, 2011 7:59 PM
  • Thanks for your response.  Our issue also turned out to be template / task related.  We're still figuring out exactly what the issue was, but we used a process of elimination on the template to figure out which task(s) had the issue. 

    We were able to get more details out of the message by properly handling  the SOAP response that the PSI was giving (Thanks Ray Letts fromn Arbutus Solutions for that idea).

    We know its related to an Enterprise Resource that we're using in the template.  By creating a simple 2 task template with this resource assigned to one of the two tasks, it causes the failure.  Still looking for the root cause though. 

     

     

    Sunday, May 15, 2011 1:48 PM
  • Thanks Sean.

    How did you manage to pull more details form the SOAP response? I only get the general error without anythign? can you post the code?

    Also using the workaround I suggested before doesn't help because then you have to deal with related tasks, that need to be updated which returns us to the original problem.

     

     


    Id
    Tuesday, May 24, 2011 7:19 PM
  • We used some of the methods described in this article to better handle the fault exceptions.

    http://www.codeproject.com/KB/webservices/SoapClientTest.aspx

    Our Symptoms

    When a critical mass of projects were created on the server, this call would suddenly start to fail on some projects.  It happened in our development and test environments. 

    In our event handler, we are opening projects, updating custom fields and calling QueueUpdateProject to commit the changes.

    Through a process of elimination, we started subtracting tasks from the project template that these problematic projects were based upon (basically halfing the number of tasks each time).  Then we created new projects from these templates and would see if the call would work. After repeatedly removing tasks, suddenly the calls started working again.  We continued our elimination work and found that it had to do with whether a specific (extremely) overallocated generic enterprise resource was assigned work on the project or not.

    Temporary Relief

    1. By republishing these projects without these overallocated generic resources in them, the QueueUpdateProject calls would work again.
    2. By deleting a large number of projects from the server, the QueueUpdateProject calls would work again (reducing the allocation on the resource).

    In production there may be changes you could make to an enterprise resource, but deleting projects is not always an option unless an archiving plan is available.

    Next Steps

    We're looking at setting the Default Booking Type on these Enterprise Resources to Proposed rather than Committed.  We know our problem has to do with projects where specifc overallocated enterprise resources have been assigned tasks.  Hopefully the booking type setting will help, but we wont know until we again reach the critical mass of projects (~2000 projects with about 150 tasks per project). 


    Thursday, June 2, 2011 3:35 PM
  • Sean,

    Have you tried using the project web service instead of the WCF?

     


    Id
    Friday, June 3, 2011 12:57 PM
  • Through our developemnt, we've only bound to the .svc - have you found different behaviours while binding to the .asmx versions of these servcies?

    Friday, June 3, 2011 2:18 PM
  • Unfortunately, using WS insteadof WCF didn't help.

    I have no idea what raises this error or how to solve it.


    Id
    Thursday, June 16, 2011 6:34 PM
  • Without knowing what you're aiming to acheive with your code, could you test it on a simple one task project plan?  This will help you identify if it's a task / schedule issue or something to do with the calls you're making.

    If it's related to an attribute of the schedule, I would repeatedly remove half the tasks from your project and attempt to run your code each time.  Once it works, you'll know which block of tasks the issue is within - you should be able to trial and error your way to identifying the problem.

    Definitely not a silver bullet solution, but it's what go us to identifying our issue.


    Wednesday, June 22, 2011 4:54 PM
  • I have additional input -

    I've been to the customer site today and played a little with the PSI. I had another problem with inserting new tasks to a project (because of empty lines it had). I've created a new project and copied the original tasks to it. it had the inserting problem so I deleted all empty lines and then I got the infamus error: "Unhandled Communication Fault occurred". So I deleted all tasks and recopied them from the original and everything worked fine. I'm now pretty sure it has something to do with links of the tasks.


    Id
    Tuesday, June 28, 2011 6:06 PM
  • I encountered this error again with a new feature I was developing in the same environment.  The following stopped the error from occurring for me.

    It seems that I get this error mostly when working with large projects.  Rather than sending the whole project data set back, by only sending the changes, the QueueUpdateProject call is executed without issue.

    dsProject = (ProjectDataSet)dsProject.GetChanges();


    This is a very generic error message.  So I'm not sure how many cases of this error the suggestion will help.

    • Edited by Sean Panter Tuesday, August 9, 2011 10:28 PM
    • Marked as answer by I D Tuesday, October 4, 2011 7:26 AM
    Thursday, July 21, 2011 5:08 PM
  • Can you confirm, are there any Inactive Resources in the Project....!!?
    Thanks, Parth
    • Proposed as answer by Parth Rawal Thursday, July 28, 2011 4:43 AM
    Thursday, July 28, 2011 4:43 AM
  • I'll test it later this week and will let you know.
    Id
    Monday, August 1, 2011 8:50 PM
  • Hi Id, any luck with either of these? 

    Cheers,

    Sean

    Friday, September 2, 2011 2:56 PM
  • Sorry, but I'm still waiting for the customer (August vacations and such).


    Id
    Saturday, September 3, 2011 6:33 PM
  • Hi, I have come to some solutions in terms of what you guys are seeing, I've played extensively with the Web Service API for PSI and I want to firstly challenge Brian Smith on his assertion that you cannot add/update or delete tasks in the same session, I can and my solution works for 95% of the GANTT's I have from EPM.

    I see that some of the issues that I have with some GANTTs are that when a Task is created it also creates the TaskCustomFields too, such as Health and Billing Milestone. On 95% of projects all the TaskCustomFields are named and are added correctly within MS Project and can be uppdated and deleted fine. On two or three of GANTT's if I create a task in MSProject, it creates twenty customfields "under the bonnet" so to speak which are of FIELD_TYPE_ENUM 17 and are not called anything, it seems that MSProject needs these underlying flag fields to be present in the GANTT when it comes to delete them.

    I have proved this in ProjTool and can always reproduce the issue, why does it create these 20 flag values for each task on the GANTT? I have a hunch that it's something to do with the template from where the GANTT came from, but I'm not sure, other hunches are calculations and things, but I think I'm chasing my tail here....

    Is there a way of copying a GANTT completely to a new GANTT from a new template so that it could all work properly?

    Thanks

    Sunday, June 10, 2012 8:15 AM
  • Thank you, your suggestion to use GetChanges() worked for me!
    Friday, March 1, 2013 10:56 AM