Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutOfMemoryError causes jqwik to print "empty" statistics #5

Closed
luvarqpp opened this issue May 5, 2020 · 5 comments
Closed

OutOfMemoryError causes jqwik to print "empty" statistics #5

luvarqpp opened this issue May 5, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@luvarqpp
Copy link

luvarqpp commented May 5, 2020

I have run spring integration test with tries set to 100 (in jqwik.propterie), but that was ignored (I think, that running from IDE does cause this. I will investigate). tries was effectively set to 1000 and out of memory has happened (after more than hour). I am a bit curious, why statistics get printed empty. I would expect not to print anything, or print partial data.

Can be something done about this behavior? Other thing is why does OOM happened. I would like to see at least number of successful tries, which can I use to set for particular property test.

2020-05-05 09:18:39.954 DEBUG 15847 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : ControllerAdvice beans: 0 @ModelAttribute, 0 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
2020-05-05 09:21:09.756 DEBUG 15847 --- [           main] .m.m.a.ExceptionHandlerExceptionResolver : ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Catalina-utility-2"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Catalina-utility-1"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "HikariPool-454 housekeeper"
timestamp = 2020-05-05T09:48:35.738892, SignUpJqwikTests:signUpAndLoginAsNewInternalQaronUser = 

java.lang.OutOfMemoryError: Java heap space

                              |-------------------jqwik-------------------
tries = 0                     | # of calls to property
checks = 0                    | # of not rejected calls
generation-mode = <none>      | 
after-failure = PREVIOUS_SEED | use the previous seed
seed = <none>                 | random seed to reproduce generated values




java.lang.OutOfMemoryError: Java heap space
@jlink
Copy link
Collaborator

jlink commented May 5, 2020

An OutOfMemoryError should get special treatment because one cannot recover from it. So you are right, nothing should be printed. Do you know if the OOME is thrown during setup (e.g. while creating a spring context) or during execution of a property?

As for the number of tries: The value in jqwik.properties should always be considered. Does the file reside in src/test/resources?

@jlink jlink added the bug Something isn't working label May 5, 2020
@luvarqpp
Copy link
Author

luvarqpp commented May 5, 2020

I am no expert in spring internals, so here are my assumptions with data I have used.

I think that OOM happened during spring application set-up/startup. On normal try run I see log like this:

2020-05-05 09:00:38.373 DEBUG 15847 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : 10 mappings in 'requestMappingHandlerMapping'
2020-05-05 09:00:54.083  INFO 15847 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 13 endpoint(s) beneath base path '/actuator'
2020-05-05 09:01:01.989  INFO 15847 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@2e8199e, org.springframework.security.web.context.SecurityContextPersistenceFilter@5542f1cd, org.springframework.security.web.header.HeaderWriterFilter@77eb661c, org.springframework.web.filter.CorsFilter@4d56e7d2, org.springframework.security.web.authentication.logout.LogoutFilter@a56284d, org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter@39e4bc7b, org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter@5f62ad50, sk.qpp.qaron.security.TokenAuthenticationFilter@7d19353a, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@649af01a, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@36ca1007, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@41443d77, org.springframework.security.web.session.SessionManagementFilter@72627646, org.springframework.security.web.access.ExceptionTranslationFilter@3d425ec2, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@73e30730]
2020-05-05 09:01:09.951 DEBUG 15847 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : ControllerAdvice beans: 0 @ModelAttribute, 0 @InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
2020-05-05 09:01:09.965 DEBUG 15847 --- [           main] .m.m.a.ExceptionHandlerExceptionResolver : ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice
2020-05-05 09:01:43.642  INFO 15847 --- [           main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
2020-05-05 09:02:00.770  INFO 15847 --- [           main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2020-05-05 09:02:00.780  INFO 15847 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 33569 (http) with context path ''
2020-05-05 09:02:00.785  INFO 15847 --- [           main] sk.qpp.qaron.security.SignUpJqwikTests   : Started SignUpJqwikTests in 190.579 seconds (JVM running for 3021.962)

... continued some CommandLineRunner beans logging, which start during tests to fill in database and do other preparation things. So we are here still in middle of app startup.

In OOM case I see last line with normal log message this: .m.m.a.ExceptionHandlerExceptionResolver : ControllerAdvice beans: 1 @ExceptionHandler, 1 ResponseBodyAdvice. This is in normal run at beginning.

PS: I think that in some cases (if not all three), there can be handled OOME correctly and "finish" work just before exit of JVM. I think that pre-allocated structures before catch(OutOfMemoryException){} can be used safely inside catch block. But I am not sure, if there is no allocation done in system.out.println() or log.error() methods....

@jlink
Copy link
Collaborator

jlink commented May 5, 2020

Have you experimented with a lower number of tries like that:
@Property(tries = 10)

@luvarqpp
Copy link
Author

luvarqpp commented May 5, 2020

Two things:

  • I have jqwik.properties file directly in project folder (next to .jqwik-database file). Moving it to src/test/resources does make use of given defaults...
  • jop, using lover number of tries does work like a charm

jlink added a commit to jqwik-team/jqwik that referenced this issue May 5, 2020
@jlink
Copy link
Collaborator

jlink commented May 5, 2020

I could reproduce the behaviour with throwing OOME in property method.

Has been fixed in jqwik "1.3.0-SNAPSHOT".

@jlink jlink closed this as completed May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants