Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » ProductIndexBuilder fails to build after upgrading from 9.4.4 to 9.4.12

ProductIndexBuilder fails to build after upgrading from 9.4.4 to 9.4.12

Antek Drzewiecki
Reply

Hello,

After upgrading Dynamicweb from 9.4.4 to 9.4.12 we have noticed after starting up our app the product list on our frontpage disapeared. After manually building the indexes the product appear again. 
After looking into the logs, I noticed that an exception gets thrown. The ExecuteRead exception can't be shown in our logs so I've attached an screenshot for it.

Product index builder experienced a fatal error.. System.IO.IOException: The process cannot access the file 'D:\home\site\wwwroot\Files\System\Indexes\repository\index\InstanceB\write.lock' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalDelete(String path, Boolean checkHost) at Lucene.Net.Store.NativeFSLockFactory.ClearLock(String lockName) in d:\Lucene.Net\FullRepo\trunk\src\core\Store\NativeFSLockFactory.cs:line 124 at Lucene.Net.Store.Directory.ClearLock(String name) in d:\Lucene.Net\FullRepo\trunk\src\core\Store\Directory.cs:line 120 at Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, IndexDeletionPolicy deletionPolicy, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) in d:\Lucene.Net\FullRepo\trunk\src\core\Index\IndexWriter.cs:line 1227 at Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, Boolean create, MaxFieldLength mfl) in d:\Lucene.Net\FullRepo\trunk\src\core\Index\IndexWriter.cs:line 1019 at Dynamicweb.Indexing.Lucene.LuceneIndexWriter.Open(Boolean openForAppend) at Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder.Build(IIndexWriter writer, Tracker tracker)

 

A second issue is We also have a notification service set up on index build failures. But no emails were delivered to these addresses.

Since we are testing the upgrade, we disabled all the automated calls to /admin/Public/TaskExecute.aspx. So I think this index gets build during startup.  We are running this app on Azure with no custom code for this specific index.

Our steps to reproduce:
Build indexes manually ( see them succeed)
Restart your app on azure
Check the product list and Repositories in the admin they are now marked as failed.

This hapens 8/10 times

Best regards, Antek Drzewiecki

buildfailSQL.png

Replies

 
Antek Drzewiecki
Reply

Forget the email bug. I noticed we allready got anwser on that in https://doc.dynamicweb.com/forum?ThreadID=57944&PID=1605

 
Antek Drzewiecki
Reply

Hello again,

In our custom index builder we are getting an Lock obtain timeout on our first method call `writer.Open(false)`. It leaves the following stacktrace:
Lucene.Net.Store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@D:\home\site\wwwroot\Files\System\Indexes\Content repository\News index\News B\write.lock
   at Lucene.Net.Store.Lock.Obtain(Int64 lockWaitTimeout) in d:\Lucene.Net\FullRepo\trunk\src\core\Store\Lock.cs:line 97
   at Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, IndexDeletionPolicy deletionPolicy, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) in d:\Lucene.Net\FullRepo\trunk\src\core\Index\IndexWriter.cs:line 1228
   at Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, Boolean create, MaxFieldLength mfl) in d:\Lucene.Net\FullRepo\trunk\src\core\Index\IndexWriter.cs:line 1019
   at Dynamicweb.Indexing.Lucene.LuceneIndexWriter.Open(Boolean openForAppend)
   at Warmgarant.Shop.Application.CustomCode.Search.NewsIndexBuilder.Build(IIndexWriter writer, Tracker tracker)

I think we also got this issue in our 9.4.4 release. As i can see it happens every automated attempt.

 
Antek Drzewiecki
Reply

After upgrading a second site to 9.4.12 the same errors occured on product index builds.

Ive tried upgrading to 9.4.13 and the frontpage to 9.4.34, errors didnt disapear.

I've attached some new errors.

 

nativeFileread.png winIOERROR.png
 
Nicolai Pedersen
Reply

Hi Antek

Please provide a link to the solution so we can have a look.

BR Nicolai

 
Antek Drzewiecki
Reply

Hi Nicolai! 

I've send the links to your email address.

Best regards,

Antek Drzewiecki

 
Antek Drzewiecki
Reply

Upgrading to 9.4.16 gives me mostly these errors during the chron tasks. This one came from the content builder.

Exception message: read past EOF
Exception stack trace: at Lucene.Net.Store.BufferedIndexInput.Refill() in d:\Lucene.Net\FullRepo\trunk\src\core\Store\BufferedIndexInput.cs:line 179 at Lucene.Net.Store.BufferedIndexInput.ReadByte() in d:\Lucene.Net\FullRepo\trunk\src\core\Store\BufferedIndexInput.cs:line 42 at Lucene.Net.Store.ChecksumIndexInput.ReadByte() in d:\Lucene.Net\FullRepo\trunk\src\core\Store\CheckSumIndexInput.cs:line 42 at Lucene.Net.Store.IndexInput.ReadInt() in d:\Lucene.Net\FullRepo\trunk\src\core\Store\IndexInput.cs:line 77 at Lucene.Net.Index.SegmentInfos.Read(Directory directory, String segmentFileName) in d:\Lucene.Net\FullRepo\trunk\src\core\Index\SegmentInfos.cs:line 276 at Lucene.Net.Index.IndexFileDeleter..ctor(Directory directory, IndexDeletionPolicy policy, SegmentInfos segmentInfos, StreamWriter infoStream, DocumentsWriter docWriter, HashSet`1 synced) in d:\Lucene.Net\FullRepo\trunk\src\core\Index\IndexFileDeleter.cs:line 202 at Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, IndexDeletionPolicy deletionPolicy, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) in d:\Lucene.Net\FullRepo\trunk\src\core\Index\IndexWriter.cs:line 1305 at Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, Boolean create, MaxFieldLength mfl) in d:\Lucene.Net\FullRepo\trunk\src\core\Index\IndexWriter.cs:line 1019 at Dynamicweb.Indexing.Lucene.LuceneIndexWriter.Open(Boolean openForAppend) at Dynamicweb.Content.ContentIndexBuilder.Build(IIndexWriter writer, Tracker tracker) at Dynamicweb.Indexing.Index.Build(String instance, String name, Tracker tracker) at Dynamicweb.Indexing.IndexService.<>c__DisplayClass14_0.b__0(Tracker tracker) 
 
Peter Leleulya
Reply

Nicolai,

Is there anything to say in this matter, it still occurs on our production website warmgarant on 9.4.18.

The exception message is 'Object reference not set to an instance of an object.'

Can this be caused by configuration, or is this a code issue?

When I manually run the index build in the CMS it always succeeds by the way.

Ive added a notification to this build which results in many failures, but not every time
It runs every 5 minutes and once an hour by avarage we receive an error mail.
The log attached to the mail is like below.

It mentiones a lock on instance A.
We had instance A and B.
We threw away instance A and created an instance C.
Still the error occurres with instance A in the file path ... I have no idea why tis is ...

 

2018-11-01 07:15:49.774: Running.
2018-11-01 07:15:50.290: Fetching build definition.
2018-11-01 07:15:50.352: Fetched build definition. 'Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder'.
2018-11-01 07:15:50.387: Creating index writer.
2018-11-01 07:15:50.416: Created index writer: 'Dynamicweb.Indexing.Lucene.LuceneIndexWriter'.
2018-11-01 07:15:50.524: Starting build process.
2018-11-01 07:15:50.603: Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder building using Dynamicweb.Indexing.Lucene.LuceneIndexWriter... Action: 'Full', Resume: 'False'
2018-11-01 07:15:50.711: Opening index writer.
2018-11-01 07:15:51.915: Product index builder experienced a fatal error.. Lucene.Net.Store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@D:\home\site\wwwroot\Files\System\Indexes\Ketel repository\Ketel index\KetelInstanceA\write.lock    at Lucene.Net.Store.Lock.Obtain(Int64 lockWaitTimeout) in d:\Lucene.Net\FullRepo\trunk\src\core\Store\Lock.cs:line 97    at Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, IndexDeletionPolicy deletionPolicy, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit) in d:\Lucene.Net\FullRepo\trunk\src\core\Index\IndexWriter.cs:line 1228    at Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, Boolean create, MaxFieldLength mfl) in d:\Lucene.Net\FullRepo\trunk\src\core\Index\IndexWriter.cs:line 1019    at Dynamicweb.Indexing.Lucene.LuceneIndexWriter.Open(Boolean openForAppend)    at Dynamicweb.Ecommerce.Indexing.ProductIndexBuilder.Build(IIndexWriter writer, Tracker tracker)
2018-11-01 07:15:51.915: Product index builder experienced a fatal error.
2018-11-01 07:15:52.508: Failed.
2018-11-01 07:15:52.730: Closing index writer.
2018-11-01 07:15:52.900: BuildIndex failed.. System.NullReferenceException: Object reference not set to an instance of an object.    at Dynamicweb.Indexing.Lucene.LuceneIndexWriter.Close()    at Dynamicweb.Indexing.Index.Build(String instance, String name, Tracker tracker)    at Dynamicweb.Indexing.IndexService.<>c__DisplayClass14_0.<BuildIndex>b__0(Tracker tracker)
2018-11-01 07:15:52.900: BuildIndex failed.

 

 

CaptureMailbox.PNG
 
Harald Brouwers
Reply

Any updates about this problem yet?

Grtz Harald

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Harald

We have been lookin into the code and have come up with these suggestions.

Since this is not a hosting environment we control, we cannot do much about it. I think this is a hosting related issue (server or setup issue) as we do not see this situation in other solutions.

Our Lucene provider has no changes in more than a year, so I cannot see that an upgrade from .14 to .16

We have these ideas that you might be able to look into:

  1. Custom code that is not using the same casing for folders etc. as Dynamicweb does internally
  2. Multiple scheduled tasks that calls the task handler
  3. Multiple data integrations that rebuilds the index are present and overlaps in creation
  4. NLB setup where multiple nodes can lock indexes if not setup correctly
  5. Azure file system issue - the default write.lock creation timeout is 1000 ms (1 sec), and if the file system is slow, it can fail.

We have tried to make a number of updates to the LuceneIndexProvider

  1. Increased write.lock timeout to 2 seconds (DefaultWriteLockTimeout)
  2. If a LockObtainFailedException is thrown, we log a bit of more information about the cause. Is the lock file present or not, and if it is, when was it created? That might help us find the cause
  3. Updated the internal dictionaries that keeps track of writers and readers to be concurrent.

The above is a new version of the Dynamicweb.Indexing.Lucene nuget package that you will get on MyGet tomorrow. (TFS#57405)

Give it a go - if none of these are the cause, we cannot do much more before moving the hosting into an environment where we can debug and see what happens. Or we need to reproduce in a test/staging environment.

BR Nicolai

Votes for this answer: 1
 
Harald Brouwers
Reply

Hi Nicolai,

Thanks for the update!

I will give the new Indexing package a try tomorrow, and post the results of that.

Greetings Harald

 
Morten Buhl Dynamicweb Employee
Morten Buhl
Reply
This post has been marked as an answer

Dynamicweb.Indexing.Lucene v. 1.0.17 is now available from the package feed on MyGet - https://www.myget.org/feed/dynamicweb-packages/package/nuget/Dynamicweb.Indexing.Lucene/1.0.17

/Morten Buhl, DW

Votes for this answer: 1
 
Harald Brouwers
Reply

Hi Morten,

I installed the new package on our Azure staging environment. Its running for a day now, and no build errors sofar.

Thanx for the update!
Greetins Harald

 
Harald Brouwers
Reply

Hello,

Unfortunately the problems with the indexes are back. After running for a while without problems, the build errors started returning. We get dozens of build errors per day. And the errors we get are:

Index build Installers build was executed with error

Start time: 2019-01-03 09:07:41
End time: 2019-01-03 09:07:42
Run time: 00:00:01.59
Number of last processed record: 0
Total number of records: 0
Latest log information: Closing index writer.
Fail reason: BuildIndex failed.
Exception message: Object reference not set to an instance of an object.
Exception stack trace: at Dynamicweb.Indexing.Lucene.LuceneIndexWriter.Close() at Dynamicweb.Indexing.Index.Build(String instance, String name, Tracker tracker) at Dynamicweb.Indexing.IndexService.<>c__DisplayClass14_0.b__0(Tracker tracker)

I attached the log file for more information.

Do you have any idea what might be causing this, and how to solve it?

Greetings Harald

 
Nicolai Pedersen
Reply

Hi Harald

This is the userindex builder - last time it was the productindexbuilder... So this is another issue?

BR Nicolai

 
Harald Brouwers
Reply

Hi Nicolai,

Thank jou for your reply, we have this problem with all 5 index builders in the site. The errors the indexbuilders generate are the same.
Previously the problem was also with all index builders (but we posted one as example).

Grt Harald

 
Nicolai Pedersen
Reply

Hi Harald

I cannot see those errors on the solution - I only see SQL timeout from the userindexbuilder.... It seems to come from this SQL:

SELECT OrderCustomerAccessUserId, OrderLineProductId FROM EcomOrders INNER JOIN EcomOrderLines On OrderId = OrderLineOrderId WHERE OrderCustomerAccessUserId > 0 AND OrderLineProductId IS NOT NULL AND OrderLineProductId <> '' AND OrderComplete = 1 AND OrderDeleted = 0 GROUP BY OrderCustomerAccessUserId, OrderLineProductId

Anyways - I can see from the logfiles that your index lock files keeps locking themselves indicating you have more instances running at the same time or an instance is not releasing its locks. It could also be caused by slow disks as the locktimeout we improved the last time helped - but this new exception seems to be coming from the next step in the build process, but basically from the same issue...

I've added some improved logging and error handling to Dynamicweb.Indexing, TFS#59008, and you will get a release that might give us better insight.

BR Nicolai

 

 
Harald Brouwers
Reply

Hi Nicolai,

Thanks for te support. I will await the new Dynamicweb.Indexing package, and update the solution when it is available.

Greetings Harald

 
Harald Brouwers
Reply

Hi,

We have updated the site with the new Dynamicweb.Indexing package (3.0.6), this is the error log of one of the indexes we are getting now:

Index build Content build was executed with error

Start time: 2019-01-10 08:05:13
End time: 2019-01-10 08:05:15
Run time: 00:00:02.64
Number of last processed record: 0
Total number of records: 0
Latest log information: Failed.
Fail reason: BuildIndex failed.
Exception message: Lock file is NOT present: D:\home\site\wwwroot\Files\System\Indexes\Content repository\Content index\B\write.lock. Time in ms taken in Open: 2018, writer timeout ms: (2000)
Exception stack trace: at Dynamicweb.Indexing.Lucene.LuceneIndexWriter.Open(Boolean openForAppend) at Dynamicweb.Content.ContentIndexBuilder.Build(IIndexWriter writer, Tracker tracker) at Dynamicweb.Indexing.Index.Build(String instance, String name, Tracker tracker) at Dynamicweb.Indexing.IndexService.<>c__DisplayClass14_0.b__0(Tracker tracker)

I attached the corresponding log file. Hopefully it gives you some insights, why the indexex are failing.

Greetings Harald

 
Nicolai Pedersen
Reply

Hi Harald

As you might be able to see from the log, the system gets a LockObtainFailedException after the 2000 ms timeout. 2 secs is a long time to write an empty file... We can of course change the timeout to a even higher number, but this server must have a (serious) problem with disk performance that I suggest you look into.

I can give you an option to overwrite the timeout and set it to 10000 or so - but that is not a real solution to the underlying problem...

BR Nicolai

 
Harald Brouwers
Reply

Hi Nicolai,

The solution is running on a Azure WebApp with a premium plan, which is backed by SSD disks. But because of the environment we dont heave any further control of the disk performance.

If you could supply me with the option to overwrite the timeout and set it to 10000, that would be nice. So we can check if this will prevent the index build errors.

Greetings Harald

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Harald

Sure, TFS#59662, I've made the fix. Look for 1.0.19 of the lucene index provider:

https://www.myget.org/feed/dynamicweb-packages/package/nuget/Dynamicweb.Indexing.Lucene

The new setting which you have to put into globalsettings your self, is :

/GlobalSettings/System/Repository/LuceneIndexWriter/WriteLockTimeout

Default value is 2000, it is in ms, so you can set it to 10000ms which is 10 seconds.

Hope this will make it work!

BR Nicolai

Votes for this answer: 1
 
Harald Brouwers
Reply

Hi Nicolai,

Thanks for te fix !

Greetings Harald

 

You must be logged in to post in the forum