triplea icon indicating copy to clipboard operation
triplea copied to clipboard

Non-deterministic NPE on rate-limiting code -> fails smoke test build check ocasionally

Open DanVanAtta opened this issue 5 years ago • 4 comments

This is sometimes observed during smoke-test execution:

 ERROR [2020-11-29 01:16:35,200] es.moki.ratelimij.dropwizard.filter.RateLimit429EnforcerFilter: Error occurred checking rate-limit. Assuming under limit
! java.lang.NullPointerException: null
! at es.moki.ratelimij.dropwizard.filter.RateLimit429EnforcerFilter.filter(RateLimit429EnforcerFilter.java:54)
! at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:108)
! at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:44)
! at org.glassfish.jersey.process.internal.Stages.process(Stages.java:173)
! at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:247)
! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)

DanVanAtta avatar Nov 29 '20 01:11 DanVanAtta

It turns out the above stack trace is a complete red-herring and is not failing the tests at all!

The problem is involving test data and ordering of which tests run. Some tests are missing a data setup and if those are run first, they fail. If those tests are run after other tests set up the required database data, then they will pass.

DanVanAtta avatar Dec 21 '20 02:12 DanVanAtta

It is hard to make sense of this scenario, we do have this code (in DropWizardServerExtension) to delete data between tests:

  @Override
  public void beforeEach(final ExtensionContext context) throws Exception {
    final URL cleanupFileUrl = getClass().getClassLoader().getResource("db-cleanup.sql");
    if (cleanupFileUrl != null) {
      final String cleanupSql = Files.readString(Path.of(cleanupFileUrl.toURI()));
      jdbi.withHandle(handle -> handle.execute(cleanupSql));
    }
  }

DanVanAtta avatar Dec 21 '20 02:12 DanVanAtta

I noticed there has not been much activity on this issue. Please check this issue and close it if it no longer applies. Otherwise to help move this issue move forward, please add a comment summarizing any further actions that need to be taken in order to resolve this issue.

stale[bot] avatar Aug 21 '21 03:08 stale[bot]

@DanVanAtta Does this issue still occur sometimes during smoke-test execution?

frigoref avatar May 30 '25 13:05 frigoref