meilisearch-rust icon indicating copy to clipboard operation
meilisearch-rust copied to clipboard

Unexpected test failure

Open Mubelotix opened this issue 4 years ago • 6 comments

The test progress::test::test_wait_for_pending_updates_time_out randomly fails in rare cases.

Mubelotix avatar Jun 15 '21 08:06 Mubelotix

Do you have any more information about the failure? I can’t recreate it on my end. Looking at the test my best guess is it finishes adding the documents before the time out. The timeout is currently set to 1 nanosecond so I guess it could be changed to 0? Since I can’t recreate the failure on my in I’m not sure how to test if that would make any difference.

sanders41 avatar Jun 15 '21 10:06 sanders41

I have run some experiments and am still unsuccessful at getting the current test to fail. I found that I can make the test fail by setting the interval to 0 like Some(Duration::from_nanos(0)), Some(Duration::from_nanos(1)). I think this implies the random failures are indeed a timing issue?

I did test setting the timeout to 0 like Some(Duration::from_millis(1)), Some(Duration::from_nanos(0)) and it passes, but because I couldn't get it to fail with this interval I don't know if it makes a difference in the random failure. @Mubelotix do you think it is worth you trying this since you were able to get the random failure?

sanders41 avatar Jun 15 '21 12:06 sanders41

I think you are right about this. It is the last assertion that failed. The thing is: the test did not timeout because Meilisearch returned a result in less than a millisecond. This should not have happened. So it is a Meilisearch bug, but the test should be able to handle it. Setting timeout to 0 should solve the problem as the while condition will be 0 > 0, which is false. But it makes the test almost useless.

Mubelotix avatar Jun 15 '21 14:06 Mubelotix

Yes I agree with you about setting it to 0. However I can't think of any other solution so I'm not sure the best way to go with this.

How are you running MeiliSearch? I'm running it in docker, are you doing the same? I don't think it would make any difference running it outside docker, but maybe that is why I can't get it to fail and you can?

sanders41 avatar Jun 15 '21 14:06 sanders41

It happened right here on the CI while we were trying to merge #132. I can't reproduce it either.

Maybe we should just modify the test so that it logs more information next time it fails. I have no idea what happened yet.

Mubelotix avatar Jun 15 '21 18:06 Mubelotix

This takes the docker vs installed MeiliSearch out as a possible cause since CI is using docker also. Probably a good idea to try to log it. Currently its next to impossible to debug since we can't reproduce it.

sanders41 avatar Jun 15 '21 18:06 sanders41

Fixed!

bidoubiwa avatar Sep 27 '22 15:09 bidoubiwa