Skip to content

Unstable MVC test for controllers that returns DeferredResult [SPR-11536] #16161

@spring-projects-issues

Description

@spring-projects-issues

Maxim Valyanskiy opened SPR-11536 and commented

Sometimes our tests fails with following exceptions:

java.lang.IllegalStateException: Gave up waiting on async result from handler [public org.springframework.web.context.request.async.DeferredResult<java.lang.String> SimpleController.handle()] to complete
	at org.springframework.test.web.servlet.DefaultMvcResult.getAsyncResult(DefaultMvcResult.java:133)
	at org.springframework.test.web.servlet.DefaultMvcResult.getAsyncResult(DefaultMvcResult.java:121)
	at org.springframework.test.web.servlet.result.RequestResultMatchers$3.match(RequestResultMatchers.java:94)
	at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:149)
	at SimpleControllerTest.testSimple(SimpleControllerTest.java:35)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

I reproduced this problem in sample application. Complete application is available at https://github.com/maxcom/spring-test-bug.


Affects: 4.0.2

Issue Links:

1 votes, 3 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions