Category page doesn't work in test- but works in local- and prod-environments

Experiencing YSODs when visiting some of the category pages, but only on the litium test-environment.

After restoring the production database to the test-environment (litium hosted) we started seeing YSODs cropping up when browsing the category page on the test-environment.

The error doesn’t crop up on prod so I figured I’d restore the test-db locally to trouble-shoot the problem but, as it turns out, the error doesn’t turn up locally either.

So the error is reproduceable on test-env but not on prod or locally.

Does anybody has an incling of what could make the category page fail on test but not on local or prod?

I have re-build and re-updated the search indices in case the search was the culprit but that doesn’t seem to help.

The error is:

    [NullReferenceException: Object reference not set to an instance of an object.]
       Litium.Accelerator.Search.<>c__DisplayClass12_0.<CreateProductModel>b__0(Variant x) in C:\Code\Prosupport\Src\Litium.Accelerator\Search\ProductSearchService.cs:185
       System.Linq.WhereEnumerableIterator`1.MoveNext() +197
       System.Linq.Buffer`1..ctor(IEnumerable`1 source) +280
       System.Linq.<GetEnumerator>d__1.MoveNext() +115
       System.Linq.Enumerable.Count(IEnumerable`1 source) +258
       Litium.Accelerator.Search.ProductSearchService.CreateProductModel(SearchQuery searchQuery, IEnumerable`1 variants) in C:\Code\Prosupport\Src\Litium.Accelerator\Search\ProductSearchService.cs:214
       Litium.Accelerator.Search.ProductSearchService.CreateProductModels(Collection`1 hits, SearchQuery searchQuery) in C:\Code\Prosupport\Src\Litium.Accelerator\Search\ProductSearchService.cs:278
       Litium.Accelerator.Search.ProductSearchService.TransformSearchResult(Int32 pageSize, SearchQuery searchQuery, SearchResponse searchResponse) in C:\Code\Prosupport\Src\Litium.Accelerator\Search\ProductSearchService.cs:347
       System.Lazy`1.CreateValue() +708
       System.Lazy`1.LazyInitValue() +184
       Litium.Accelerator.Builders.Product.ProductListViewModelBuilder.Build() in C:\Code\Prosupport\Src\Litium.Accelerator\Builders\Product\ProductListViewModelBuilder.cs:45
       lambda_method(Closure , ControllerBase , Object[] ) +91
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
       System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
       System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +70
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
       System.Web.Mvc.Async.<>c__DisplayClass11_0.<InvokeActionMethodFilterAsynchronouslyRecursive>b__0() +80
       System.Web.Mvc.Async.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +387
       System.Web.Mvc.Async.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +387
       System.Web.Mvc.Async.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +387
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
       System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__4() +50
       System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult) +188
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
       System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +68
       System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
       System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
       System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +68
       System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +648
       System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +131

**Row 185:**
    variants = variants
                    .Where(x => x.ChannelLinks.Any(z => z.ChannelSystemId == _requestModelAccessor.RequestModel.ChannelModel.Channel.SystemId))
                    .OrderBy(x => x.SortIndex);

As far as I know, no changes has been made to ProductSearchService.cs in the accelerator.

So what can make variants be null on row 185 on test-env but not locally and prod when using the same db?

Litium version: [7.1]

Did you restart the application-pool on Test Env when you swapped the DB?

We only have access via ftp, so I haven’t. But I have forced a restart via web.config (connection string change).

Edit:
Is restart via change in web.config not enough?

I think it just restarts the site and do not reset app-pool. Ask support to recycle application-pool and try.

The problem persisted after the app-pool was reset, unfortunately.

Do you have exactly the same code base?

Yes, test and local environments is running the exact same code-base.

Ok rebuild the indices ones more now when app-pool recycled and try.

No change after rebuilding indices after the app-pool was restarted. But the sizes of the categories and products differs between test and local:

Local:
Categories: 295 kB
Products: 163 MB

Test:
Categories: 610 kB
Products: 273 MB

… although they have the same amount of products and categories:

Local and test:
Assortments: 1
Categories: 58
Products: 863
BaseProducts/Variants: 614/863

Although I now notice that the size (both category and products) differs after hitting “Rebuild All” on the same environment, even after giving the indices some time to finish.

Test first rebuild:
Categories: 383 kB
Products: 185 MB

Test second rebuild:
Categories: 532 kB
Products: 75 MB

Test third rebuild:
Categories: 676 kB
Products: 92 MB

I would expect the size to be at least constant when rebuilding the indices on the same env when using the same db.

So every time you rebuild the indices they grow?

Also is all the channel information and domain url’s, prefixes, permissions on all entities correct on Test env?

I’m stupid.

When rebuilding the search indices I used Products > Search Indices

image

I didn’t know / forgot that there is an aditional search index feature under System Settings > Search Indices

image

When running this feature, the page renders without errors.

Thanks Steve for hanging in there and helping with this.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.