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

DeferredResult broken when running Wildfly 8.2 [SPR-13412] #17991

Closed
spring-projects-issues opened this issue Aug 31, 2015 · 7 comments
Closed
Assignees
Labels
in: web

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Aug 31, 2015

Mikael Norrman opened SPR-13412 and commented

When running my Spring MVC application on Wildfly 8.2 application server and using DeferredResult I get an exception from the application server, caught by Spring, that no servlet context is found.

I tried using the simplest possible form of DeferredResult to get this error and it fails every time.

(I erased company-specific class from the following stacktrace)

Exception in thread "Thread-118" java.lang.IllegalArgumentException: UT010046: No servlet context at  to dispatch to
        at io.undertow.servlet.spec.AsyncContextImpl.dispatch(AsyncContextImpl.java:158)
        at org.springframework.security.web.servletapi.HttpServlet3RequestFactory$SecurityContextAsyncContext.dispatch(HttpServlet3RequestFactory.java:251)
        at org.springframework.web.context.request.async.StandardServletAsyncWebRequest.dispatch(StandardServletAsyncWebRequest.java:123)
        at org.springframework.web.context.request.async.WebAsyncManager.setConcurrentResultAndDispatch(WebAsyncManager.java:351)
        at org.springframework.web.context.request.async.WebAsyncManager.access$200(WebAsyncManager.java:57)
        at org.springframework.web.context.request.async.WebAsyncManager$7.handleResult(WebAsyncManager.java:417)
        at org.springframework.web.context.request.async.DeferredResult.setResultInternal(DeferredResult.java:194)
        at org.springframework.web.context.request.async.DeferredResult.setResult(DeferredResult.java:183)
        at com.*******.Controller$1.run(********Controller.java:444)
        at java.lang.Thread.run(Thread.java:745)

Affects: 4.0.5

Referenced from: commits spring-attic/spring-framework-issues@3affcf7

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Aug 31, 2015

Rossen Stoyanchev commented

So did it stop working in 8.2, i.e. did work before? It sounds more like a Wildfly issue based on the stack trace but I'll try for myself. Can you provide a sketch of the controller (method signatures, annotations)? Or if you have a sample somewhere..

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Aug 31, 2015

Mikael Norrman commented

It worked fine when running the application on JBoss AS7. I found one other issue with this problem, directed towards Tomcat8. It would seem that the problem is in Undertow.io since that is included in both application servers.

Here is a stripped down version of the controller method in question (With my simplified DeferredResult example):

@RequestMapping(value = "/getAsync", method = GET)
@ResponseBody
public DeferredResult<String> getAsync() {
	final DeferredResult<String> res = new DeferredResult<>();
	new Thread(new Runnable() {
		@Override
		public void run() {
			try {
				Thread.sleep(5000);
				res.setResult("Test string");
			} catch(InterruptedException e) {
			       e.printStackTrace();
			}
		}
	}).start();
	return res;
}

The controllerclass is simply annotated with @Controller

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 2, 2015

Rossen Stoyanchev commented

I am unable to reproduce the failure. Here is the project source https://github.com/spring-projects/spring-framework-issues/tree/master/SPR-13412.

$ curl -v http://localhost:8080/SPR-13412/getAsync
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /SPR-13412/getAsync HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8080
> Accept: */*
> 
< HTTP/1.1 200 OK
< Connection: keep-alive
< X-Powered-By: Undertow/1
* Server WildFly/8 is not blacklisted
< Server: WildFly/8
< Content-Type: text/plain;charset=ISO-8859-1
< Content-Length: 11
< Date: Wed, 02 Sep 2015 18:05:27 GMT
< 
* Connection #0 to host localhost left intact
Test string

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 2, 2015

Mikael Norrman commented

Thank you for looking into this matter.

I will try to deploy your code to my application server tomorrow just as a sanity check.
However, is it possible that some of my dependencies may be causing the problem in some way?

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 3, 2015

Rossen Stoyanchev commented

Hard to say, looks very odd. From an API perspective we are simply calling request.startAsync and then using the returned AsyncContext to perform a dispatch.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 3, 2015

Mikael Norrman commented

I deployed your test-war to my application server and it worked just fine.
I'll try to investigate this a bit more on my own and return with a new issue if I find anything, either way I've been able to solve my problem in other ways for now.

Thank you for your time.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 3, 2015

Rossen Stoyanchev commented

Okay resolving for now. Feel free to comment further, or re-open.

@spring-projects-issues spring-projects-issues added type: bug in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug label Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web
Projects
None yet
Development

No branches or pull requests

2 participants