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

Deferred not working with tomcat 8 [SPR-12204] #16818

Closed
spring-issuemaster opened this issue Sep 16, 2014 · 4 comments
Closed

Deferred not working with tomcat 8 [SPR-12204] #16818

spring-issuemaster opened this issue Sep 16, 2014 · 4 comments
Assignees
Labels

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Sep 16, 2014

Moosh Ben opened SPR-12204 and commented

I have a fully working program in tomcat 7 (spring 4.0.6) that uses DeferredResult .
I am using long polling to get a message from the server, and when a message is dispatched it immediately reaches the client.

After upgrading to tomcat 8 (tried pivotal TC server 3.0.0 as well as Tomcat 8.0.11), this stops working and client waits forever for a response.
After a while the messages do appear on the client's end.

I tried upgrading to spring 4.1 and this did not help.

The only resolution I've found is going back to tomcat 7 or making my function that runs deferredResult.setResult(...) @Async (not sure why this resolves the issue... maybe because it leaves tomcat http threads and moves to my thread pool?).

May this be related to tomcat 8 using NIO connector as default?


Affects: 4.0.6, 4.1 GA

Attachments:

Referenced from: commits spring-projects/spring-framework-issues@caedc19

1 votes, 6 watchers

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 16, 2014

Rossen Stoyanchev commented

The spring-mvc-showcase has DeferredResult examples on the "Async Requests" tab (DeferredResultController). Those work with Tomcat 8 so it doesn't appear to be as simple as upgrading to Tomcat 8. Can you create a simple example? Try the project templates in spring-framework-issues.

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 17, 2014

Moosh Ben commented

  1. Create a new maven project in STS 3.6.1 .
  2. Set up pivotal TC 3.0 to work with tomcat 8.0.9 .
  3. Run on server .
  4. Access from browser: http://.../get_message
  5. Open another tab and access: http://.../send_message
  6. Nothing happens in first tab
  7. Switch pivotal TC 3.0 to tomcat 7 .
  8. Try again
  9. First tab prints the word message
@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 22, 2014

Sébastien Deleuze commented

I confirm this issue, I have added the provided test project to the spring-framework-issues repository.

I have also been able to reproduce it with spring-mvc-showcase, if I disable the 3 seconds timeout.
This issue seems to occur with Tomcat 8 when the deferredResult.setResult(...) method is called from the Tomcat thread.
That's why other spring-mvc-showcase async examples work, the deferredResult.setResult(...) is called from a timer or a timeout, not from a Tomcat thread.

It still occurs when using the blocking connector instead of the NIO one.

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 30, 2018

Rossen Stoyanchev commented

Resolving due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.