Exception thrown while querying GroupShare API for project details

I've now found several GroupShare-based projects where the GroupShare API returns a 500 (Internal Server Error) response containing "An error has occurred."

The API method being called is /api/projectserver/v2/projects (GET)

At a guess I'd say that this has happened for approximately 1 in 10 projects. We mainly use GroupShareKit when consuming the API but GroupShareKit frequently doesn't bubble up the exception messages so for a clearer picture of the error I then tried calling the GroupShare REST API directly (using Postman) and it's from here that I receive the message "An error has occurred." (I think GroupShareKit threw an exception with the message "An API error occurred" or something similar.)

The project and its details are visible in the GroupShare web UI and in Trados, the problem only occurs when I ask for the details via the API.

I've found that the log file at C:\ProgramData\SDL\Service\Logs\Sdl.Application.log contains the following message each time this happens:

2018-07-23 13:34:22.167#Rest Api#GET groupshare.supertext.com:41234/.../aea5347e-eb18-4781-bb80-d13dc08ecf4c 2018-07-23 13:34:22.261#Rest Api#An unexpected error occurred: System.InvalidOperationException: An exception occured while reading a database value for property 'AnalysisStatisticsPerProject.ExactMatchedCharacters'. The expected type was 'System.Int32' but the actual value was null. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.EntityFrameworkCore.Metadata.Internal.EntityMaterializerSource.TryReadValue[TValue](ValueBuffer valueBuffer, Int32 index, IPropertyBase property) --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Metadata.Internal.EntityMaterializerSource.ThrowReadValueException[TValue](Exception exception, Object value, IPropertyBase property) at Microsoft.EntityFrameworkCore.Metadata.Internal.EntityMaterializerSource.TryReadValue[TValue](ValueBuffer valueBuffer, Int32 index, IPropertyBase property) at lambda_method(Closure , ValueBuffer ) at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.UnbufferedEntityShaper`1.Shape(QueryContext queryContext, ValueBuffer valueBuffer) at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext() at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__15`2.MoveNext() at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Sdl.ProjectServer.Data.Services.StatisticsService.GetAnalysisStatisticsOnProjectLevel(Guid projectId) at Sdl.StudioServer.Services.ProjectServer.RestApi.Adapter.Adapters.ProjectStatisticsAdapter.GetStatisticsOnProjectLevel(Guid projectId) at Sdl.StudioServer.Services.ProjectServer.RestApi.Controllers.V2.ProjectsV2Controller.Get(Guid id) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4() at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)

Might this exception be caused by something that we've done? Is there anything we can do to prevent this fro happening? Is this a known error?

Parents
  • Hi Andrew,

    I assume in the SDLSystem database you have entries in [proj].[AnalysisStatistics] with ExactMatchedCharacters is null?
    Do you create the projects in SDL Trados Studio, Studio API, the GS website or via the GS RestAPI?

    If it is via RestAPI or GS website: for an affected project, could you check the Sdl.Execution.log for any errors or warnings for the time when the project was created?

    Raphael
  • Hi Raphael,

    We create the projects using the Studio API and then publish them to GroupShare. We do currently have an ongoing problem with the analysis when run via the Studio API but I don't think that's connected.

    Looking in the database and finding the record in proj.AnalysisStatistics, there are two entries for the file: the first record (with the lower ID, therefore recorded earlier) has no NULLs at all; the second record has only the Total... fields populated and the rest are NULL.

    There are actually two source files in this project and the records for both files exhibit the same - one fully populated record and another containing mostly NULLs.

    Screenshot of Trados Studio database records showing two entries for a file analysis. The first entry has all fields populated, while the second has only 'Total...' fields filled and the rest are NULL.



    Generated Image Alt-Text
    [edited by: Trados AI at 4:03 AM (GMT 0) on 5 Mar 2024]
  • Hi!

    Please apologize the long silence from our side.

    Do you still encounter this issue?

    I am not sure why there are two records here.
    Can you check [SDLSystem].[proj].[LanguageFile] to see which of the proj.AnalysisStatistics entries is referenced here for the affected file ([AnalysisStatisticsId])?

    Can you also double check whether there is anything in the execution log files when an affected project is published?
    Although judging from the AnalysisStatisticsId's, the second entry is probably added at a later point...

    Raphael
  • Hi Raphael,

    Sorry for not replying sooner - I didn't receive the expected someone-has-replied email.

    >> Can you check [SDLSystem].[proj].[LanguageFile] to see which of the proj.AnalysisStatistics entries is referenced
    >> here for the affected file ([AnalysisStatisticsId])?

    It's the later record which is referenced by the LanguageFile - the record with the NULLs instead of 0s.

    >> Can you also double check whether there is anything in the execution log files when an affected project is published?

    Unfortunately the logs don't record this far back, and to be honest this problem hasn't occurred in some time. Like I said in my original post, this used to happen maybe 10% of the time but since around the time I wrote the original post I really can't remember it happening, so I'm unable to check the logs for a more recent project.

Reply
  • Hi Raphael,

    Sorry for not replying sooner - I didn't receive the expected someone-has-replied email.

    >> Can you check [SDLSystem].[proj].[LanguageFile] to see which of the proj.AnalysisStatistics entries is referenced
    >> here for the affected file ([AnalysisStatisticsId])?

    It's the later record which is referenced by the LanguageFile - the record with the NULLs instead of 0s.

    >> Can you also double check whether there is anything in the execution log files when an affected project is published?

    Unfortunately the logs don't record this far back, and to be honest this problem hasn't occurred in some time. Like I said in my original post, this used to happen maybe 10% of the time but since around the time I wrote the original post I really can't remember it happening, so I'm unable to check the logs for a more recent project.

Children